diff --git a/dashboard/app.vue b/dashboard/app.vue
index 21ef47b..2f23af9 100644
--- a/dashboard/app.vue
+++ b/dashboard/app.vue
@@ -10,7 +10,7 @@ const { alerts, closeAlert } = useAlert();
const { showDialog, closeDialog, dialogComponent, dialogParams, dialogStyle, dialogClosable } = useCustomDialog();
-const { visible } = usePricingDrawer();
+const { drawerVisible, hideDrawer, drawerClasses } = useDrawer();
@@ -18,10 +18,10 @@ const { visible } = usePricingDrawer();
-
-
-
+
+
+
@@ -78,18 +78,18 @@ const { visible } = usePricingDrawer();
diff --git a/dashboard/components/CVerticalNavigation.vue b/dashboard/components/CVerticalNavigation.vue
index 6f0e135..91831fc 100644
--- a/dashboard/components/CVerticalNavigation.vue
+++ b/dashboard/components/CVerticalNavigation.vue
@@ -105,8 +105,6 @@ const { data: maxProjects } = useFetch("/api/user/max_projects", {
});
-const pricingDrawer = usePricingDrawer();
-
diff --git a/dashboard/components/banner/LimitsInfo.vue b/dashboard/components/banner/LimitsInfo.vue
index 4456271..b04bc11 100644
--- a/dashboard/components/banner/LimitsInfo.vue
+++ b/dashboard/components/banner/LimitsInfo.vue
@@ -5,10 +5,10 @@ const limitsInfo = await useFetch("/api/project/limits_info", {
lazy: true, headers: useComputedHeaders({ useSnapshotDates: false })
});
-const pricingDrawer = usePricingDrawer();
+const { showDrawer } = useDrawer();
function goToUpgrade() {
- pricingDrawer.visible.value = true;
+ showDrawer('PRICING');
}
diff --git a/dashboard/components/banner/Offer.vue b/dashboard/components/banner/Offer.vue
index 2a2fd63..49a8680 100644
--- a/dashboard/components/banner/Offer.vue
+++ b/dashboard/components/banner/Offer.vue
@@ -1,10 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dashboard/components/drawer/Generic.vue b/dashboard/components/drawer/Generic.vue
new file mode 100644
index 0000000..be155d5
--- /dev/null
+++ b/dashboard/components/drawer/Generic.vue
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/dashboard/components/pricing/PricingDrawer.vue b/dashboard/components/drawer/Pricing.vue
similarity index 68%
rename from dashboard/components/pricing/PricingDrawer.vue
rename to dashboard/components/drawer/Pricing.vue
index b530519..fd452fb 100644
--- a/dashboard/components/pricing/PricingDrawer.vue
+++ b/dashboard/components/drawer/Pricing.vue
@@ -1,6 +1,5 @@
-
-
-
-
@@ -218,52 +193,6 @@ async function onLifetimeUpgradeClick() {
-
-
@@ -282,7 +211,5 @@ async function onLifetimeUpgradeClick() {
-
-
\ No newline at end of file
diff --git a/dashboard/components/pricing/PricingCardGeneric.vue b/dashboard/components/pricing/PricingCardGeneric.vue
index e1e1054..a01055f 100644
--- a/dashboard/components/pricing/PricingCardGeneric.vue
+++ b/dashboard/components/pricing/PricingCardGeneric.vue
@@ -15,8 +15,6 @@ export type PricingCardProp = {
const props = defineProps<{ datas: PricingCardProp[], defaultIndex?: number }>();
-const { project } = useProject();
-
const currentIndex = ref
(props.defaultIndex || 0);
const data = computed(() => {
diff --git a/dashboard/components/settings/billing.vue b/dashboard/components/settings/billing.vue
index 6e8dc0f..b3334b6 100644
--- a/dashboard/components/settings/billing.vue
+++ b/dashboard/components/settings/billing.vue
@@ -111,8 +111,7 @@ async function saveBillingInfo() {
}
-
-const { visible } = usePricingDrawer();
+const { showDrawer } = useDrawer();
@@ -128,9 +127,11 @@ const { visible } = usePricingDrawer();
@@ -195,7 +198,7 @@ const { visible } = usePricingDrawer();
Expire date:
{{ prettyExpireDate }}
-
+
Upgrade plan
diff --git a/dashboard/composables/useDrawer.ts b/dashboard/composables/useDrawer.ts
new file mode 100644
index 0000000..1bbf374
--- /dev/null
+++ b/dashboard/composables/useDrawer.ts
@@ -0,0 +1,34 @@
+
+const drawerVisible = ref(false);
+const drawerComponent = ref();
+
+const drawerClasses = ref('')
+
+type ComponentType = "DOCS" | "PRICING";
+
+async function loadComponent(component: ComponentType): Promise {
+ switch (component) {
+ case "DOCS":
+ const DrawerDocs = await import("../components/drawer/Docs.vue");
+ return DrawerDocs.default;
+ case "PRICING":
+ const DrawerPricing = await import("../components/drawer/Pricing.vue");
+ return DrawerPricing.default;
+ default:
+ throw new Error("Unknown component type");
+ }
+}
+
+async function showDrawer(component: ComponentType, classes: string = "") {
+ drawerComponent.value = await loadComponent(component);
+ drawerVisible.value = true;
+ drawerClasses.value = classes;
+}
+
+function hideDrawer() {
+ drawerVisible.value = false;
+}
+
+export function useDrawer() {
+ return { drawerClasses, drawerVisible, drawerComponent, showDrawer, hideDrawer };
+}
\ No newline at end of file
diff --git a/dashboard/composables/usePricingDrawer.ts b/dashboard/composables/usePricingDrawer.ts
deleted file mode 100644
index 2b4c754..0000000
--- a/dashboard/composables/usePricingDrawer.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-const pricingDrawerVisible = ref(false);
-
-
-export function usePricingDrawer() {
- return { visible: pricingDrawerVisible };
-}
\ No newline at end of file
diff --git a/dashboard/layouts/dashboard.vue b/dashboard/layouts/dashboard.vue
index 51c85c9..901f77c 100644
--- a/dashboard/layouts/dashboard.vue
+++ b/dashboard/layouts/dashboard.vue
@@ -7,8 +7,6 @@ import { Lit } from 'litlyx-js';
const { userRoles, isLogged } = useLoggedUser();
const { project } = useProject();
-const pricingDrawer = usePricingDrawer();
-
const selfhosted = useSelfhosted();
const sections: Section[] = [
diff --git a/dashboard/layouts/header.vue b/dashboard/layouts/header.vue
index 3990d70..06cf3b9 100644
--- a/dashboard/layouts/header.vue
+++ b/dashboard/layouts/header.vue
@@ -23,12 +23,6 @@ const entries = [
const loggedUser = useLoggedUser();
const { setToken } = useAccessToken();
-function logout() {
- loggedUser.value = { logged: false }
- setToken('');
- location.reload();
-}
-
diff --git a/dashboard/pages/analyst.vue b/dashboard/pages/analyst.vue
index 4c05d20..71fa4f4 100644
--- a/dashboard/pages/analyst.vue
+++ b/dashboard/pages/analyst.vue
@@ -222,7 +222,7 @@ async function deleteChat(chat_id: string) {
await reloadChatsList();
}
-const { visible: pricingDrawerVisible } = usePricingDrawer()
+const { showDrawer } = useDrawer();
async function clearAllChats() {
@@ -386,7 +386,7 @@ async function clearAllChats() {
{{ chatsRemaining }} remaining requests
-
+
Upgrade
diff --git a/dashboard/pages/dashboard/events.vue b/dashboard/pages/dashboard/events.vue
index f956cef..4d988fd 100644
--- a/dashboard/pages/dashboard/events.vue
+++ b/dashboard/pages/dashboard/events.vue
@@ -70,10 +70,10 @@ const showWarning = computed(() => {
})
-const pricingDrawer = usePricingDrawer();
+const { showDrawer } = useDrawer();
function goToUpgrade() {
- pricingDrawer.visible.value = true;
+ showDrawer('PRICING');
}
diff --git a/dashboard/pages/dashboard/visits.vue b/dashboard/pages/dashboard/visits.vue
index f8785fc..da7a570 100644
--- a/dashboard/pages/dashboard/visits.vue
+++ b/dashboard/pages/dashboard/visits.vue
@@ -77,10 +77,10 @@ const showWarning = computed(() => {
return options.indexOf(selectedTimeFrom.value) > 1
})
-const pricingDrawer = usePricingDrawer();
+const { showDrawer } = useDrawer();
function goToUpgrade() {
- pricingDrawer.visible.value = true;
+ showDrawer('PRICING');
}
diff --git a/dashboard/pages/index.vue b/dashboard/pages/index.vue
index 58c3b46..ce5ce15 100644
--- a/dashboard/pages/index.vue
+++ b/dashboard/pages/index.vue
@@ -32,12 +32,18 @@ const firstInteraction = useFetch('/api/project/first_interaction', {
const showDashboard = computed(() => project.value && firstInteraction.data.value);
const selfhosted = useSelfhosted();
+
+const { showDrawer } = useDrawer();
+
+ test
+
+
@@ -85,7 +91,7 @@ const selfhosted = useSelfhosted();
-
+