From 6a367c1dec3a27b2be3cd8a86187ec525dda7fc1 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Mon, 11 May 2026 23:25:34 +0300 Subject: [PATCH] refactor: consolidate web app UI foundation --- bot/app/web/frontend/jsconfig.json | 10 + bot/app/web/frontend/src/App.svelte | 2 +- bot/app/web/frontend/src/PreviewBoard.svelte | 4 +- .../web/frontend/src/admin/AdminPanel.svelte | 2 +- .../src/admin/sections/AdsSection.svelte | 4 +- .../admin/sections/BroadcastSection.svelte | 2 +- .../src/admin/sections/PromosSection.svelte | 4 +- .../src/admin/sections/SettingsSection.svelte | 2 +- .../src/admin/sections/StatsSection.svelte | 66 ++-- .../admin/sections/TariffEditorModal.svelte | 4 +- .../src/admin/sections/UserDetailModal.svelte | 4 +- .../src/admin/sections/UsersSection.svelte | 2 +- .../patterns/admin/AdminDashboardGrid.svelte | 18 ++ .../patterns/admin/AdminDashboardStack.svelte | 10 + .../patterns/admin/AdminEmptyState.svelte | 11 + .../patterns/admin/AdminSectionHeader.svelte | 11 + .../lib/components/patterns/admin/index.js | 4 + .../components/{shadcn => ui}/badge.svelte | 6 +- .../src/lib/components/ui/button.svelte | 44 +-- .../src/lib/components/ui/card.svelte | 2 +- .../{shadcn => ui}/card/card-action.svelte | 2 +- .../{shadcn => ui}/card/card-content.svelte | 2 +- .../card/card-description.svelte | 2 +- .../{shadcn => ui}/card/card-footer.svelte | 2 +- .../{shadcn => ui}/card/card-header.svelte | 2 +- .../{shadcn => ui}/card/card-title.svelte | 2 +- .../{shadcn => ui}/card/card.svelte | 2 +- .../components/{shadcn => ui}/card/index.js | 0 .../src/lib/components/ui/dialog.svelte | 2 +- .../frontend/src/lib/components/ui/index.js | 7 + .../src/lib/components/ui/input.svelte | 2 +- .../src/lib/components/ui/primitives.js | 1 + bot/app/web/frontend/src/styles.css | 2 + bot/app/web/frontend/src/styles/admin.css | 172 ----------- .../web/frontend/src/styles/components.css | 182 +++++++++++ bot/app/web/frontend/src/styles/tailwind.css | 31 ++ .../frontend/src/webapp/PaymentDialogs.svelte | 10 +- .../frontend/src/webapp/TariffDialogs.svelte | 6 +- .../src/webapp/auth/AuthScreen.svelte | 8 +- .../src/webapp/screens/DevicesScreen.svelte | 4 +- .../src/webapp/screens/HomeScreen.svelte | 4 +- .../src/webapp/screens/InviteScreen.svelte | 8 +- .../src/webapp/screens/SettingsScreen.svelte | 6 +- bot/app/web/frontend/vite.config.mjs | 9 +- components.json | 15 + package-lock.json | 292 ++++++++++++++++++ package.json | 1 + 47 files changed, 713 insertions(+), 275 deletions(-) create mode 100644 bot/app/web/frontend/jsconfig.json create mode 100644 bot/app/web/frontend/src/lib/components/patterns/admin/AdminDashboardGrid.svelte create mode 100644 bot/app/web/frontend/src/lib/components/patterns/admin/AdminDashboardStack.svelte create mode 100644 bot/app/web/frontend/src/lib/components/patterns/admin/AdminEmptyState.svelte create mode 100644 bot/app/web/frontend/src/lib/components/patterns/admin/AdminSectionHeader.svelte create mode 100644 bot/app/web/frontend/src/lib/components/patterns/admin/index.js rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/badge.svelte (61%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-action.svelte (81%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-content.svelte (81%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-description.svelte (82%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-footer.svelte (81%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-header.svelte (81%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card-title.svelte (81%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/card.svelte (80%) rename bot/app/web/frontend/src/lib/components/{shadcn => ui}/card/index.js (100%) create mode 100644 bot/app/web/frontend/src/lib/components/ui/index.js create mode 100644 bot/app/web/frontend/src/lib/components/ui/primitives.js create mode 100644 bot/app/web/frontend/src/styles/components.css create mode 100644 bot/app/web/frontend/src/styles/tailwind.css create mode 100644 components.json diff --git a/bot/app/web/frontend/jsconfig.json b/bot/app/web/frontend/jsconfig.json new file mode 100644 index 0000000..145e4ec --- /dev/null +++ b/bot/app/web/frontend/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "$lib/*": ["src/lib/*"], + "$components/*": ["src/lib/components/*"] + } + }, + "include": ["src/**/*"] +} diff --git a/bot/app/web/frontend/src/App.svelte b/bot/app/web/frontend/src/App.svelte index eb6c111..de4f3db 100644 --- a/bot/app/web/frontend/src/App.svelte +++ b/bot/app/web/frontend/src/App.svelte @@ -4,7 +4,7 @@ import { createBillingStore } from "./lib/webapp/stores/billingStore.js"; import { createDevicesStore } from "./lib/webapp/stores/devicesStore.js"; import { createAccountStore } from "./lib/webapp/stores/accountStore.js"; - import { Tooltip } from "bits-ui"; + import { Tooltip } from "$components/ui/primitives.js"; import BrandMark from "./BrandMark.svelte"; import PreviewBoard from "./PreviewBoard.svelte"; diff --git a/bot/app/web/frontend/src/PreviewBoard.svelte b/bot/app/web/frontend/src/PreviewBoard.svelte index feb94e0..cac8087 100644 --- a/bot/app/web/frontend/src/PreviewBoard.svelte +++ b/bot/app/web/frontend/src/PreviewBoard.svelte @@ -19,8 +19,8 @@ Zap, } from "lucide-svelte"; - import Button from "./lib/components/ui/button.svelte"; - import Card from "./lib/components/ui/card.svelte"; + import Button from "$components/ui/button.svelte"; + import Card from "$components/ui/card.svelte"; import BackTitle from "./preview/BackTitle.svelte"; import PhoneFrame from "./preview/PhoneFrame.svelte"; import PreviewMethods from "./preview/PreviewMethods.svelte"; diff --git a/bot/app/web/frontend/src/admin/AdminPanel.svelte b/bot/app/web/frontend/src/admin/AdminPanel.svelte index baeebe3..66c5fb8 100644 --- a/bot/app/web/frontend/src/admin/AdminPanel.svelte +++ b/bot/app/web/frontend/src/admin/AdminPanel.svelte @@ -20,7 +20,7 @@ UsersRound, } from "lucide-svelte"; import { onMount, setContext } from "svelte"; - import { Select } from "bits-ui"; + import { Select } from "$components/ui/primitives.js"; import BrandMark from "../BrandMark.svelte"; import AdsSection from "./sections/AdsSection.svelte"; diff --git a/bot/app/web/frontend/src/admin/sections/AdsSection.svelte b/bot/app/web/frontend/src/admin/sections/AdsSection.svelte index fc044dd..7dbe733 100644 --- a/bot/app/web/frontend/src/admin/sections/AdsSection.svelte +++ b/bot/app/web/frontend/src/admin/sections/AdsSection.svelte @@ -1,8 +1,8 @@ {#if statsError} -
{at("stats_error", { error: statsError }, "")}
+ {at("stats_error", { error: statsError }, "")} {:else if showSkeleton} -
-
-

{at("stats_section_audience", {}, "")}

-
-
+ + + {#each Array(3) as _, i (i)} @@ -144,7 +148,7 @@ {/each} -
+ @@ -156,9 +160,7 @@
-
-

{at("stats_recent_payments", {}, "")}

-
+
@@ -185,15 +187,15 @@
- + {:else if stats} -
-
-

{at("stats_section_audience", {}, "")}

- {at("stats_section_audience_hint", {}, "")} -
+ + -
+ {at("stats_label_users", {}, "")} @@ -243,12 +245,12 @@ -
+ -
-

{at("stats_section_revenue", {}, "")}

- {at("stats_section_revenue_hint", {}, "")} -
+ @@ -356,14 +358,10 @@ -
-

{at("stats_section_panel", {}, "")}

- {#if panelPayload?.error} - {at("stats_panel_unavailable", {}, "")} - {:else if panelMetrics} - {at("stats_section_panel_hint", {}, "")} - {/if} -
+ {#if panelPayload?.error}

{at("stats_panel_unavailable_detail", {}, "")}

@@ -511,10 +509,10 @@ {:else} -
{at("no_data", {}, "")}
+ {at("no_data", {}, "")} {/if}
- + {/if} diff --git a/bot/app/web/frontend/src/admin/sections/TariffEditorModal.svelte b/bot/app/web/frontend/src/admin/sections/TariffEditorModal.svelte index e2ac879..9f2ff32 100644 --- a/bot/app/web/frontend/src/admin/sections/TariffEditorModal.svelte +++ b/bot/app/web/frontend/src/admin/sections/TariffEditorModal.svelte @@ -1,6 +1,6 @@ + +
+ +
diff --git a/bot/app/web/frontend/src/lib/components/patterns/admin/AdminDashboardStack.svelte b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminDashboardStack.svelte new file mode 100644 index 0000000..b3f1b33 --- /dev/null +++ b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminDashboardStack.svelte @@ -0,0 +1,10 @@ + + +
+ +
diff --git a/bot/app/web/frontend/src/lib/components/patterns/admin/AdminEmptyState.svelte b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminEmptyState.svelte new file mode 100644 index 0000000..c9fc8b4 --- /dev/null +++ b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminEmptyState.svelte @@ -0,0 +1,11 @@ + + +
+ +
diff --git a/bot/app/web/frontend/src/lib/components/patterns/admin/AdminSectionHeader.svelte b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminSectionHeader.svelte new file mode 100644 index 0000000..1cd5acc --- /dev/null +++ b/bot/app/web/frontend/src/lib/components/patterns/admin/AdminSectionHeader.svelte @@ -0,0 +1,11 @@ + + +
+

{title}

+ {#if description} + {description} + {/if} +
diff --git a/bot/app/web/frontend/src/lib/components/patterns/admin/index.js b/bot/app/web/frontend/src/lib/components/patterns/admin/index.js new file mode 100644 index 0000000..a29622f --- /dev/null +++ b/bot/app/web/frontend/src/lib/components/patterns/admin/index.js @@ -0,0 +1,4 @@ +export { default as AdminDashboardGrid } from "./AdminDashboardGrid.svelte"; +export { default as AdminDashboardStack } from "./AdminDashboardStack.svelte"; +export { default as AdminEmptyState } from "./AdminEmptyState.svelte"; +export { default as AdminSectionHeader } from "./AdminSectionHeader.svelte"; diff --git a/bot/app/web/frontend/src/lib/components/shadcn/badge.svelte b/bot/app/web/frontend/src/lib/components/ui/badge.svelte similarity index 61% rename from bot/app/web/frontend/src/lib/components/shadcn/badge.svelte rename to bot/app/web/frontend/src/lib/components/ui/badge.svelte index b8b0a39..5a77bec 100644 --- a/bot/app/web/frontend/src/lib/components/shadcn/badge.svelte +++ b/bot/app/web/frontend/src/lib/components/ui/badge.svelte @@ -1,7 +1,7 @@ {#if href} - + {:else} - {/if} diff --git a/bot/app/web/frontend/src/lib/components/ui/card.svelte b/bot/app/web/frontend/src/lib/components/ui/card.svelte index 3156ce8..7f890f5 100644 --- a/bot/app/web/frontend/src/lib/components/ui/card.svelte +++ b/bot/app/web/frontend/src/lib/components/ui/card.svelte @@ -1,5 +1,5 @@