feat(web): add i18n, light/dark theme switching, and version constant
- Add i18n (English + 简体中文) with a locale store, $t() magic, and a language toggle (persisted) - Add light/dark/system theme switching via a theme store and [data-theme] token overrides - Set the theme before paint to avoid a flash of the wrong theme - Add frontend version constant web/version.js (window.YDROPBX_VERSION) shown in the app footer - Update AGENTS.md version-control convention to mention web/version.js - Bump version to 0.1.1 across frontend, webui changelog, and backend constant
This commit is contained in:
+33
-5
@@ -7,16 +7,44 @@
|
||||
<link rel="stylesheet" href="/styles/tokens.css">
|
||||
<link rel="stylesheet" href="/styles/base.css">
|
||||
<link rel="stylesheet" href="/styles/components.css">
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
var t = localStorage.getItem('yd.theme') || 'system';
|
||||
var dark = t === 'dark' || (t === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light');
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script defer src="/components/icons.js"></script>
|
||||
<script defer src="/components/i18n.js"></script>
|
||||
<script defer src="/components/theme.js"></script>
|
||||
<script defer src="/alpine.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body x-data>
|
||||
<div class="page-topbar">
|
||||
<button class="btn btn-icon" type="button"
|
||||
@click="$store.locale.toggle()"
|
||||
:title="$t('lang.label')" :aria-label="$t('lang.label')">
|
||||
<span class="icon" x-html="Icons.globe"></span>
|
||||
</button>
|
||||
<button class="btn btn-icon" type="button"
|
||||
@click="$store.theme.cycle()"
|
||||
:title="$t('theme.' + $store.theme.mode)" :aria-label="$t('theme.' + $store.theme.mode)">
|
||||
<span class="icon" x-html="Icons[$store.theme.icon()]"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="login-wrap">
|
||||
<div class="login-card">
|
||||
<h1>y<span>Dropbox</span></h1>
|
||||
<p>Enter your access token to continue</p>
|
||||
<p x-text="$t('login.subtitle')"></p>
|
||||
<form id="loginForm">
|
||||
<input type="password" id="token" placeholder="Access Token" required autocomplete="current-password">
|
||||
<div class="login-error" id="loginError">Invalid token. Please try again.</div>
|
||||
<button type="submit" class="btn btn-primary">Sign In</button>
|
||||
<input type="password" id="token" :placeholder="$t('login.token')" required autocomplete="current-password">
|
||||
<div class="login-error" id="loginError" x-text="$t('login.error')"></div>
|
||||
<button type="submit" class="btn btn-primary" x-text="$t('login.submit')"></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user