Compare commits
6 Commits
91dcff8f77
...
refactor-w
| Author | SHA1 | Date | |
|---|---|---|---|
| 7382a3a08d | |||
| ffa6afc913 | |||
| 9400c9d748 | |||
| 74d10877fc | |||
| 298b315afa | |||
| 44a2051536 |
@@ -1,78 +1,59 @@
|
|||||||
<!-- App.svelte -->
|
<!-- src/App.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Header from './components/Header.svelte';
|
import './app.css';
|
||||||
import Tabs from './components/Tabs.svelte';
|
import { onMount } from 'svelte';
|
||||||
import Overview from './components/Overview.svelte';
|
import { activeTab } from './stores/appStore';
|
||||||
import Settings from './components/Settings.svelte';
|
|
||||||
|
|
||||||
let activeTab = 'overview';
|
import Header from './components/Header.svelte';
|
||||||
let status = 'Status';
|
import Tabs from './components/Tabs.svelte';
|
||||||
let uptime = '0s';
|
import Overview from './components/Overview.svelte';
|
||||||
let qrCodesFound = 0;
|
import Settings from './components/Settings.svelte';
|
||||||
let isOnline = false;
|
import Terminal from './components/Terminal.svelte';
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const handleContextMenu = (event: MouseEvent) => event.preventDefault();
|
||||||
|
document.addEventListener('contextmenu', handleContextMenu);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('contextmenu', handleContextMenu);
|
||||||
|
};
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="app-window">
|
<div class="app-window">
|
||||||
<Header {isOnline} />
|
<Header />
|
||||||
|
<Tabs />
|
||||||
<Tabs bind:activeTab />
|
|
||||||
|
|
||||||
<main class="main-layout">
|
<main class="main-layout">
|
||||||
{#if activeTab === 'overview'}
|
{#if $activeTab === 'overview'}
|
||||||
<Overview {status} {uptime} {qrCodesFound} />
|
<Overview />
|
||||||
{:else}
|
{:else if $activeTab === 'settings'}
|
||||||
<Settings />
|
<Settings />
|
||||||
{/if}
|
{/if}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<aside class="terminal-layout">
|
||||||
|
<Terminal />
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
.app-window {
|
||||||
--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: 4px;
|
|
||||||
--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);
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-window {
|
|
||||||
border-radius: var(--border-radius-md);
|
border-radius: var(--border-radius-md);
|
||||||
background-color: var(--bg-primary);
|
background-color: var(--bg-primary);
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.main-layout {
|
.main-layout {
|
||||||
padding: var(--spacing-lg);
|
padding: var(--spacing-lg);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: auto;
|
flex: 1;
|
||||||
flex-grow: 1;
|
}
|
||||||
}
|
|
||||||
|
.terminal-layout {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,54 +1,57 @@
|
|||||||
#logo {
|
/* src/app.css */
|
||||||
display: block;
|
:root {
|
||||||
width: 50%;
|
--bg-primary: #1c1c1c;
|
||||||
height: 50%;
|
--bg-secondary: #121212;
|
||||||
margin: auto;
|
--bg-header: #811A10;
|
||||||
padding: 10% 0 0;
|
--accent-primary: #a02c2c;
|
||||||
background-position: center;
|
--accent-secondary: #7a2727;
|
||||||
background-repeat: no-repeat;
|
--text-primary: #ebebeb;
|
||||||
background-size: 100% 100%;
|
--text-secondary: rgba(235, 235, 235, 0.7);
|
||||||
background-origin: content-box;
|
--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;
|
margin: 0;
|
||||||
line-height: 20px;
|
padding: 0;
|
||||||
margin: 1.5rem auto;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-box .btn {
|
body {
|
||||||
width: 60px;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
height: 30px;
|
background-color: var(--bg-primary);
|
||||||
line-height: 30px;
|
color: var(--text-primary);
|
||||||
border-radius: 3px;
|
touch-action: manipulation;
|
||||||
border: none;
|
user-select: none;
|
||||||
margin: 0 0 0 20px;
|
-webkit-user-select: none;
|
||||||
padding: 0 8px;
|
-moz-user-select: none;
|
||||||
cursor: pointer;
|
-ms-user-select: none;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-box .btn:hover {
|
/* Utility classes */
|
||||||
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
|
.text-dim {
|
||||||
color: #333333;
|
color: var(--text-dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-box .input {
|
.text-secondary {
|
||||||
border: none;
|
color: var(--text-secondary);
|
||||||
border-radius: 3px;
|
|
||||||
outline: none;
|
|
||||||
height: 30px;
|
|
||||||
line-height: 30px;
|
|
||||||
padding: 0 10px;
|
|
||||||
background-color: rgba(240, 240, 240, 1);
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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);
|
|
||||||
}
|
}
|
||||||
27
frontend/src/assets/app.css
Normal file
27
frontend/src/assets/app.css
Normal file
@@ -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); }
|
||||||
@@ -1,82 +1,33 @@
|
|||||||
<!-- components/Header.svelte -->
|
<!-- src/components/Header.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let isOnline = true;
|
import { isOnline } from '../stores/appStore';
|
||||||
export let title = "QRminator";
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="headerbar">
|
<header class="headerbar">
|
||||||
<h1 class="header-title">{title}</h1>
|
|
||||||
<div class="header-status">
|
<div class="header-status">
|
||||||
{#if isOnline}
|
{#if $isOnline}
|
||||||
<span>Online</span>
|
<span>Online</span>
|
||||||
{:else}
|
{:else}
|
||||||
<span class="text-dim">Offline</span>
|
<span class="text-dim">Offline</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="header-controls">
|
|
||||||
<button class="control-button toggle">
|
|
||||||
<div class="toggle-indicator"></div>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.headerbar {
|
.headerbar {
|
||||||
background-color: var(--bg-header);
|
background-color: var(--bg-header);
|
||||||
padding: var(--spacing-md) var(--spacing-lg);
|
padding: var(--spacing-md) var(--spacing-lg);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-title {
|
.header-status {
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-status {
|
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-controls {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-button {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-button:hover {
|
|
||||||
transform: scale(1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-button.toggle {
|
|
||||||
background-color: var(--accent-primary);
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-indicator {
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
background-color: var(--bg-primary);
|
|
||||||
border-radius: 50%;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,41 +1,12 @@
|
|||||||
<!-- components/Overview.svelte -->
|
<!-- components/Overview.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
import StatusPanel from './StatusPanel.svelte';
|
import StatusPanel from './StatusPanel.svelte';
|
||||||
import Terminal from './Terminal.svelte';
|
|
||||||
|
|
||||||
export let status = 'Looking for QR-codes';
|
|
||||||
export let uptime = '1h 12m 15s';
|
|
||||||
export let qrCodesFound = 12;
|
|
||||||
|
|
||||||
const terminalLines = [
|
|
||||||
'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',
|
|
||||||
'[Fx] BEFORE RUN provide: git.weirdcat.su/weirdcat/auto-attendance/internal/ui.NewMainWindow()',
|
|
||||||
'[Fx] RUN provide: git.weirdcat.su/weirdcat/auto-attendance/internal/ui.NewMainWindow()',
|
|
||||||
'in 11.655448ms',
|
|
||||||
'[Fx] RUNNING',
|
|
||||||
' '
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="overview-layout">
|
<div class="overview-layout">
|
||||||
<div class="grid-layout">
|
<div class="grid-layout">
|
||||||
<!-- QR Code Section -->
|
<StatusPanel />
|
||||||
<!-- <div class="qr-container"> -->
|
|
||||||
<!-- <div class="qr-placeholder"> -->
|
|
||||||
<!-- QR Code Display -->
|
|
||||||
<!-- </div> -->
|
|
||||||
<!-- </div> -->
|
|
||||||
|
|
||||||
<!-- Status Panel -->
|
|
||||||
<StatusPanel {status} {uptime} {qrCodesFound} />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Terminal Output -->
|
|
||||||
<Terminal {terminalLines} />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -44,7 +15,6 @@ const terminalLines = [
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--spacing-lg);
|
gap: var(--spacing-lg);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-layout {
|
.grid-layout {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<!-- components/Settings.svelte -->
|
<!-- components/Settings.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
// Settings logic will go here
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="settings-content">
|
<div class="settings-content">
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
<!-- components/StatusPanel.svelte -->
|
<!-- src/components/StatusPanel.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let status = '';
|
import { status, uptime, qrCodesFound } from '../stores/appStore';
|
||||||
export let uptime = '';
|
|
||||||
export let qrCodesFound = 0;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="status-panel">
|
<div class="status-panel">
|
||||||
<div class="status-row">
|
<div class="status-row">
|
||||||
<span class="status-label">Status</span>
|
<span class="status-label">Status</span>
|
||||||
<span class="status-value">{status}</span>
|
<span class="status-value">{$status}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-row">
|
<div class="status-row">
|
||||||
<span class="status-label">Uptime</span>
|
<span class="status-label">Uptime</span>
|
||||||
<span class="status-value">{uptime}</span>
|
<span class="status-value">{$uptime}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-row">
|
<div class="status-row">
|
||||||
<span class="status-label">QR-codes found</span>
|
<span class="status-label">QR-codes found</span>
|
||||||
<span class="status-value">{qrCodesFound}</span>
|
<span class="status-value">{$qrCodesFound}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-row">
|
<div class="status-row">
|
||||||
<span class="status-label">Link</span>
|
<span class="status-label">Link</span>
|
||||||
@@ -25,46 +23,38 @@ export let qrCodesFound = 0;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.status-panel {
|
.status-panel {
|
||||||
background-color: var(--bg-primary);
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
border-radius: var(--border-radius-sm);
|
|
||||||
padding: var(--spacing-lg);
|
padding: var(--spacing-lg);
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-row {
|
.status-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
padding: var(--spacing-sm) 0;
|
padding: var(--spacing-sm) 0;
|
||||||
border-bottom: 1px solid var(--border-color);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.status-row:last-child {
|
.status-row > *:nth-child(2) {
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-row > *:nth-child(2) {
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-label {
|
.status-label {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-value {
|
.status-value {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-value.link {
|
.status-value.link {
|
||||||
color: var(--accent-primary);
|
color: var(--accent-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-value.link:hover {
|
.status-value.link:hover {
|
||||||
color: #bd6b6b;
|
color: #bd6b6b;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
<!-- components/Tabs.svelte -->
|
<!-- src/components/Tabs.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let activeTab = 'overview';
|
import { activeTab, TABS } from '../stores/appStore';
|
||||||
export let tabs = [
|
import type { Tab } from '../stores/appStore';
|
||||||
{ id: 'overview', label: 'Overview' },
|
|
||||||
{ id: 'settings', label: 'Settings' }
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
{#each tabs as tab}
|
{#each TABS as tab (tab.id)}
|
||||||
<button
|
<button
|
||||||
class="tab {activeTab === tab.id ? 'active' : ''}"
|
class="tab {$activeTab === tab.id ? 'active' : ''}"
|
||||||
on:click={() => activeTab = tab.id}
|
on:click={() => $activeTab = tab.id}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
</button>
|
</button>
|
||||||
@@ -19,13 +16,13 @@ export let tabs = [
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
background-color: var(--bg-primary);
|
background-color: var(--bg-primary);
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: var(--spacing-md) var(--spacing-lg);
|
padding: var(--spacing-md) var(--spacing-lg);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -35,17 +32,17 @@ export let tabs = [
|
|||||||
position: relative;
|
position: relative;
|
||||||
transition: color 0.2s ease;
|
transition: color 0.2s ease;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab:hover {
|
.tab:hover {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab.active {
|
.tab.active {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab.active::after {
|
.tab.active::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -53,5 +50,5 @@ export let tabs = [
|
|||||||
right: 0;
|
right: 0;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
background-color: var(--accent-primary);
|
background-color: var(--accent-primary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,50 +1,132 @@
|
|||||||
<!-- components/Terminal.svelte -->
|
<!-- src/components/Terminal.svelte -->
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let terminalLines = [];
|
import { terminalLines } from '../stores/appStore';
|
||||||
|
import { onMount, onDestroy } from 'svelte';
|
||||||
|
|
||||||
|
let terminalRef: HTMLDivElement;
|
||||||
|
let isResizing = false;
|
||||||
|
let startY: number;
|
||||||
|
let startHeight: number;
|
||||||
|
|
||||||
|
function handleMouseDown(e: MouseEvent): void {
|
||||||
|
isResizing = true;
|
||||||
|
startY = e.clientY;
|
||||||
|
startHeight = parseInt(getComputedStyle(terminalRef).height, 10);
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', handleMouseUp);
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseMove(e: MouseEvent): void {
|
||||||
|
if (!isResizing) return;
|
||||||
|
|
||||||
|
const height = startHeight - (e.clientY - startY);
|
||||||
|
const minHeight = 100;
|
||||||
|
const maxHeight = window.innerHeight * 0.8;
|
||||||
|
|
||||||
|
if (height >= minHeight && height <= maxHeight) {
|
||||||
|
terminalRef.style.height = `${height}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseUp(): void {
|
||||||
|
isResizing = false;
|
||||||
|
document.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
document.removeEventListener('mouseup', handleMouseUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollToBottom(): void {
|
||||||
|
if (terminalRef) {
|
||||||
|
const content = terminalRef.querySelector('.terminal-content') as HTMLDivElement;
|
||||||
|
if (content) {
|
||||||
|
content.scrollTop = content.scrollHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-scroll when new lines are added
|
||||||
|
$: $terminalLines, setTimeout(scrollToBottom, 0);
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
document.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
document.removeEventListener('mouseup', handleMouseUp);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="terminal">
|
<div class="terminal" bind:this={terminalRef}>
|
||||||
<div class="terminal-header">Output</div>
|
<div class="resize-handle" on:mousedown={handleMouseDown}></div>
|
||||||
|
<div class="terminal-header">Logs</div>
|
||||||
<div class="terminal-content">
|
<div class="terminal-content">
|
||||||
{#each terminalLines as line}
|
{#each $terminalLines as line}
|
||||||
<div class="terminal-line">{line}</div>
|
<div class="terminal-line">{line}</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.terminal {
|
.terminal {
|
||||||
background-color: var(--bg-primary);
|
background-color: var(--bg-secondary);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: var(--border-radius-sm);
|
border-radius: var(--border-radius-sm);
|
||||||
|
margin: var(--spacing-lg);
|
||||||
|
height: 200px;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex-grow: 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-header {
|
@media (max-height: 500px) {
|
||||||
background-color: var(--bg-secondary);
|
.terminal {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle {
|
||||||
|
position: absolute;
|
||||||
|
top: 10;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 10px;
|
||||||
|
cursor: row-resize;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle:hover {
|
||||||
|
background-color: var(--accent-primary);
|
||||||
|
border-radius: 100px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal-header {
|
||||||
|
background-color: var(--bg-header);
|
||||||
padding: var(--spacing-sm) var(--spacing-md);
|
padding: var(--spacing-sm) var(--spacing-md);
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
.terminal-content {
|
.terminal-content {
|
||||||
padding: var(--spacing-md);
|
padding: var(--spacing-md);
|
||||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
max-height: 200px;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
white-space: nowrap;
|
white-space: pre-wrap;
|
||||||
}
|
user-select: text;
|
||||||
|
}
|
||||||
|
|
||||||
.terminal-line {
|
.terminal-line {
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-line:last-child {
|
.terminal-line:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
41
frontend/src/constants/theme.js
Normal file
41
frontend/src/constants/theme.js
Normal file
@@ -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)'
|
||||||
|
}
|
||||||
|
};
|
||||||
23
frontend/src/stores/appStore.ts
Normal file
23
frontend/src/stores/appStore.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// ./stores/appStore.ts
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
|
export interface Tab {
|
||||||
|
id: 'overview' | 'settings';
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TABS: Tab[] = [
|
||||||
|
{ id: 'overview', label: 'Overview' },
|
||||||
|
{ id: 'settings', label: 'Settings' }
|
||||||
|
];
|
||||||
|
|
||||||
|
export const activeTab = writable<Tab['id']>('overview');
|
||||||
|
export const isOnline = writable<boolean>(false);
|
||||||
|
export const status = writable<string>('Stopped');
|
||||||
|
export const uptime = writable<string>('0s');
|
||||||
|
export const qrCodesFound = writable<number>(0);
|
||||||
|
export const terminalLines = writable<string[]>([
|
||||||
|
'Tea warming up...',
|
||||||
|
'Scanning QR-code...',
|
||||||
|
'Getting expelled...'
|
||||||
|
]);
|
||||||
Reference in New Issue
Block a user