Skip to content

Commit 5d29d10

Browse files
committed
Add About section to SettingsMenu and update translations
1 parent 1b0e246 commit 5d29d10

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

src/components/SettingsMenu.svelte

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import { t } from '../lib/i18n.js'
55
66
let open = $state(false)
7+
let showAbout = $state(false)
8+
const appVersion = __APP_VERSION__
79
const SCALES = [1, 1.2, 1.4]
810
const SCALE_LABELS = { 1: '100%', 1.2: '120%', 1.4: '140%' }
911
@@ -180,6 +182,42 @@
180182
<span class="row-value on">{$preferences.lang === 'no' ? 'EN →' : 'NO →'}</span>
181183
</button>
182184
185+
<div class="divider"></div>
186+
187+
<!-- About -->
188+
<button class="row" onclick={() => showAbout = !showAbout} role="menuitem">
189+
<span class="row-icon">
190+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
191+
<circle cx="12" cy="12" r="10"/>
192+
<line x1="12" y1="16" x2="12" y2="12"/>
193+
<line x1="12" y1="8" x2="12.01" y2="8"/>
194+
</svg>
195+
</span>
196+
<span class="row-label">{$t('about')}</span>
197+
<span class="row-value on">{showAbout ? '' : ''}</span>
198+
</button>
199+
200+
{#if showAbout}
201+
<div class="about-section">
202+
<div class="about-row">
203+
<span class="about-label">{$t('version')}</span>
204+
<span class="about-value">{appVersion}</span>
205+
</div>
206+
<div class="about-row">
207+
<span class="about-label">{$t('sourceCode')}</span>
208+
<a class="about-link" href="https://github.com/GilbN/nsf-timer" target="_blank" rel="noopener">GitHub</a>
209+
</div>
210+
<div class="about-row">
211+
<span class="about-label">{$t('license')}</span>
212+
<span class="about-value">MIT</span>
213+
</div>
214+
<div class="about-row">
215+
<span class="about-label">{$t('reportBug')}</span>
216+
<a class="about-link" href="https://github.com/GilbN/nsf-timer/issues" target="_blank" rel="noopener">GitHub Issues</a>
217+
</div>
218+
</div>
219+
{/if}
220+
183221
</div>
184222
{/if}
185223
</div>
@@ -299,4 +337,40 @@
299337
background: rgba(255,255,255,0.06);
300338
margin: 2px 0;
301339
}
340+
341+
.about-section {
342+
padding: 6px 14px 10px;
343+
display: flex;
344+
flex-direction: column;
345+
gap: 6px;
346+
}
347+
348+
.about-row {
349+
display: flex;
350+
justify-content: space-between;
351+
align-items: center;
352+
font-size: 0.75rem;
353+
}
354+
355+
.about-label {
356+
color: var(--text-secondary);
357+
}
358+
359+
.about-value {
360+
color: var(--text-primary);
361+
font-weight: 600;
362+
font-size: 0.6875rem;
363+
letter-spacing: 0.04em;
364+
}
365+
366+
.about-link {
367+
color: var(--accent);
368+
text-decoration: none;
369+
font-weight: 600;
370+
font-size: 0.6875rem;
371+
}
372+
373+
.about-link:hover {
374+
text-decoration: underline;
375+
}
302376
</style>

src/lib/i18n.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ const translations = {
126126
watchDisplay: 'Vis',
127127
watchDisplayHint: 'Stor skjermvisning for monitor/nettbrett uten kontroller',
128128
tagline: 'NSF 25m Konkurransetimer',
129+
about: 'Om',
130+
version: 'Versjon',
131+
sourceCode: 'Kildekode',
132+
license: 'Lisens',
133+
reportBug: 'Rapporter feil',
129134
},
130135
en: {
131136
appName: 'NSF Timer',
@@ -251,6 +256,11 @@ const translations = {
251256
watchDisplay: 'Display',
252257
watchDisplayHint: 'Large-screen view for monitors/tablets — no controls',
253258
tagline: 'NSF 25m Competition Timer',
259+
about: 'About',
260+
version: 'Version',
261+
sourceCode: 'Source Code',
262+
license: 'License',
263+
reportBug: 'Report a Bug',
254264
},
255265
}
256266

vite.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import { svelte } from '@sveltejs/vite-plugin-svelte'
33
import { VitePWA } from 'vite-plugin-pwa'
44
import tailwindcss from '@tailwindcss/vite'
55
import basicSsl from '@vitejs/plugin-basic-ssl'
6+
import { readFileSync } from 'fs'
7+
8+
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'))
69

710
export default defineConfig(({ command, mode }) => {
811
const env = loadEnv(mode, process.cwd(), '')
912
const wsPort = env.WS_PORT || '8080'
1013
return {
14+
define: {
15+
__APP_VERSION__: JSON.stringify(pkg.version),
16+
},
1117
base: env.VITE_BASE_PATH || '/',
1218
server: command === 'serve' ? {
1319
https: env.VITE_HTTPS === 'true',

0 commit comments

Comments
 (0)