From ffa6afc91390f0381adf6ed56890bd8043f2c7d4 Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Fri, 28 Nov 2025 20:57:24 +0300 Subject: [PATCH] refactor: enhanced structure --- frontend/src/App.svelte | 138 ++++++--------------- frontend/src/app.css | 93 +++++++------- frontend/src/assets/app.css | 27 ++++ frontend/src/components/Header.svelte | 69 ++--------- frontend/src/components/Overview.svelte | 10 +- frontend/src/components/Settings.svelte | 1 - frontend/src/components/StatusPanel.svelte | 70 +++++------ frontend/src/components/Tabs.svelte | 44 +++---- frontend/src/components/Terminal.svelte | 47 +++---- frontend/src/constants/theme.js | 41 ++++++ frontend/src/stores/appStore.js | 20 +++ 11 files changed, 268 insertions(+), 292 deletions(-) create mode 100644 frontend/src/assets/app.css create mode 100644 frontend/src/constants/theme.js create mode 100644 frontend/src/stores/appStore.js diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 4944ec4..17e0ee9 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,116 +1,60 @@ - +
-
- - - -
- {#if activeTab === 'overview'} - - {:else} - - {/if} -
- - +
+ + +
+ {#if $activeTab === 'overview'} + + {:else if $activeTab === 'settings'} + + {/if} +
+ +
diff --git a/frontend/src/app.css b/frontend/src/app.css index 59d06f6..349c3ef 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -1,54 +1,57 @@ -#logo { - display: block; - width: 50%; - height: 50%; - margin: auto; - padding: 10% 0 0; - background-position: center; - background-repeat: no-repeat; - background-size: 100% 100%; - background-origin: content-box; +/* src/app.css */ +:root { + --bg-primary: #1c1c1c; + --bg-secondary: #121212; + --bg-header: #811A10; + --accent-primary: #a02c2c; + --accent-secondary: #7a2727; + --text-primary: #ebebeb; + --text-secondary: rgba(235, 235, 235, 0.7); + --text-dim: rgba(235, 235, 235, 0.5); + --border-color: rgba(0, 0, 0, 0.26); + --success: #a0662c; + --warning: #2ca02c; + --error: #2ca0a0; + + --spacing-xs: 4px; + --spacing-sm: 8px; + --spacing-md: 12px; + --spacing-lg: 16px; + --spacing-xl: 24px; + + --border-radius-sm: 10px; + --border-radius-md: 6px; + --border-radius-lg: 8px; + + --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + --shadow-md: 0 3px 3px rgba(0, 0, 0, 0.16), 0 3px 3px rgba(0, 0, 0, 0.23); + --shadow-lg: 0 14px 14px rgba(0, 0, 0, 0.25), 0 10px 5px rgba(0, 0, 0, 0.22); } -.result { - height: 20px; - line-height: 20px; - margin: 1.5rem auto; +* { + margin: 0; + padding: 0; + box-sizing: border-box; } -.input-box .btn { - width: 60px; - height: 30px; - line-height: 30px; - border-radius: 3px; - border: none; - margin: 0 0 0 20px; - padding: 0 8px; - cursor: pointer; +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + background-color: var(--bg-primary); + color: var(--text-primary); + touch-action: manipulation; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + height: 100vh; + overflow: hidden; } -.input-box .btn:hover { - background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%); - color: #333333; +/* Utility classes */ +.text-dim { + color: var(--text-dim); } -.input-box .input { - border: none; - border-radius: 3px; - outline: none; - height: 30px; - line-height: 30px; - padding: 0 10px; - background-color: rgba(240, 240, 240, 1); - -webkit-font-smoothing: antialiased; +.text-secondary { + color: var(--text-secondary); } - -.input-box .input:hover { - border: none; - background-color: rgba(255, 255, 255, 1); -} - -.input-box .input:focus { - border: none; - background-color: rgba(255, 255, 255, 1); -} \ No newline at end of file diff --git a/frontend/src/assets/app.css b/frontend/src/assets/app.css new file mode 100644 index 0000000..a5fc6dd --- /dev/null +++ b/frontend/src/assets/app.css @@ -0,0 +1,27 @@ +:root { + /* CSS variables from theme.js would be injected here */ + --bg-primary: #1c1c1c; + --bg-secondary: #121212; + /* ... all other theme variables */ +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + background-color: var(--bg-primary); + color: var(--text-primary); + touch-action: manipulation; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +/* Utility classes */ +.text-dim { color: var(--text-dim); } +.text-secondary { color: var(--text-secondary); } diff --git a/frontend/src/components/Header.svelte b/frontend/src/components/Header.svelte index 54f888e..3edc193 100644 --- a/frontend/src/components/Header.svelte +++ b/frontend/src/components/Header.svelte @@ -1,76 +1,33 @@ - +
-
- {#if isOnline} - Online - {:else} - Offline - {/if} -
+
+ {#if $isOnline} + Online + {:else} + Offline + {/if} +
diff --git a/frontend/src/components/Overview.svelte b/frontend/src/components/Overview.svelte index fcbcccf..4f0b803 100644 --- a/frontend/src/components/Overview.svelte +++ b/frontend/src/components/Overview.svelte @@ -1,16 +1,11 @@
- - +
@@ -20,7 +15,6 @@ export let qrCodesFound = 12; flex-direction: column; gap: var(--spacing-lg); height: 100%; - } .grid-layout { diff --git a/frontend/src/components/Settings.svelte b/frontend/src/components/Settings.svelte index e2fbe97..d4ca83a 100644 --- a/frontend/src/components/Settings.svelte +++ b/frontend/src/components/Settings.svelte @@ -1,6 +1,5 @@
diff --git a/frontend/src/components/StatusPanel.svelte b/frontend/src/components/StatusPanel.svelte index c1bdd68..ec0bdb9 100644 --- a/frontend/src/components/StatusPanel.svelte +++ b/frontend/src/components/StatusPanel.svelte @@ -1,66 +1,60 @@ - +
-
- Status - {status} -
-
- Uptime - {uptime} -
-
- QR-codes found - {qrCodesFound} -
-
- Link - Click here! (2 s) -
+
+ Status + {$status} +
+
+ Uptime + {$uptime} +
+
+ QR-codes found + {$qrCodesFound} +
+
+ Link + Click here! (2 s) +
diff --git a/frontend/src/components/Tabs.svelte b/frontend/src/components/Tabs.svelte index 8d41f82..36e0978 100644 --- a/frontend/src/components/Tabs.svelte +++ b/frontend/src/components/Tabs.svelte @@ -1,31 +1,27 @@ - +
- {#each tabs as tab} - - {/each} + {#each TABS as tab} + + {/each}
diff --git a/frontend/src/components/Terminal.svelte b/frontend/src/components/Terminal.svelte index 7407b53..1ee7004 100644 --- a/frontend/src/components/Terminal.svelte +++ b/frontend/src/components/Terminal.svelte @@ -1,6 +1,7 @@ - +
Logs
- {#each terminalLines as line} + {#each $terminalLines as line}
{line}
{/each}
@@ -62,13 +68,11 @@ background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); - margin: 20px; - margin-top: auto; - height: 200px; /* Default height */ + margin: var(--spacing-lg); + height: 200px; position: relative; display: flex; flex-direction: column; - resize: vertical; overflow: hidden; } @@ -90,7 +94,7 @@ } .resize-handle:hover { - background-color: var(--accent-color); + background-color: var(--accent-primary); } .terminal-header { @@ -109,13 +113,10 @@ font-size: 0.75rem; line-height: 1.4; color: var(--text-primary); - flex-grow: 1; + flex: 1; overflow-y: auto; - white-space: nowrap; + white-space: pre-wrap; user-select: text; - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; } .terminal-line { diff --git a/frontend/src/constants/theme.js b/frontend/src/constants/theme.js new file mode 100644 index 0000000..f510aea --- /dev/null +++ b/frontend/src/constants/theme.js @@ -0,0 +1,41 @@ +export const THEME = { + colors: { + bg: { + primary: '#1c1c1c', + secondary: '#121212', + header: '#811A10' + }, + accent: { + primary: '#a02c2c', + secondary: '#7a2727' + }, + text: { + primary: '#ebebeb', + secondary: 'rgba(235, 235, 235, 0.7)', + dim: 'rgba(235, 235, 235, 0.5)' + }, + status: { + success: '#a0662c', + warning: '#2ca02c', + error: '#2ca0a0' + }, + border: 'rgba(0, 0, 0, 0.26)' + }, + spacing: { + xs: '4px', + sm: '8px', + md: '12px', + lg: '16px', + xl: '24px' + }, + borderRadius: { + sm: '10px', + md: '6px', + lg: '8px' + }, + shadows: { + sm: '0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)', + md: '0 3px 3px rgba(0, 0, 0, 0.16), 0 3px 3px rgba(0, 0, 0, 0.23)', + lg: '0 14px 14px rgba(0, 0, 0, 0.25), 0 10px 5px rgba(0, 0, 0, 0.22)' + } +}; diff --git a/frontend/src/stores/appStore.js b/frontend/src/stores/appStore.js new file mode 100644 index 0000000..25e22b8 --- /dev/null +++ b/frontend/src/stores/appStore.js @@ -0,0 +1,20 @@ +import { writable } from 'svelte/store'; + +// App state +export const activeTab = writable('overview'); +export const status = writable('Looking for QR-codes'); +export const uptime = writable('1h 12m 15s'); +export const qrCodesFound = writable(12); +export const isOnline = writable(true); +export const terminalLines = writable([ + 'Window()', + '[Fx] INVOKE main.main.func1()', + '[Fx] BEFORE RUN provide: git.weirdcat.su/weirdcat/auto-attendance/internal/ui.NewBuilder()', + '[Fx] RUN provide: git.weirdcat.su/weirdcat/auto-attendance/internal/ui.NewBuilder() in 46.723905ms', +]); + +// Constants +export const TABS = [ + { id: 'overview', label: 'Overview' }, + { id: 'settings', label: 'Settings' } +];