Skip to content

Commit 2fe9ef2

Browse files
marcelopepisclaude
andcommitted
fix: read app version dynamically from Tauri config
Replaces hardcoded APP_VERSION constant with getVersion() from @tauri-apps/api/app, so the About page always reflects the actual version from tauri.conf.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 01030bd commit 2fe9ef2

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/pages/About.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
// Manifesto completo, versão, links (GitHub, autor), verificar atualizações,
44
// licença GPL v3 e referência sutil à Volt.
55

6-
import { useState } from 'react';
6+
import { useState, useEffect } from 'react';
77
import { openUrl } from '@tauri-apps/plugin-opener';
88
import { check } from '@tauri-apps/plugin-updater';
99
import { relaunch } from '@tauri-apps/plugin-process';
10+
import { getVersion } from '@tauri-apps/api/app';
1011
import {
1112
Github,
1213
ExternalLink,
@@ -28,7 +29,6 @@ import FrameGuardIcon from '../components/FrameGuardIcon';
2829

2930
// ── Constantes ──────────────────────────────────────────────────────────────────
3031

31-
const APP_VERSION = '0.2.1';
3232
const GITHUB_URL = 'https://github.com/marcelopepis/FrameGuard';
3333
const RELEASES_URL = 'https://github.com/marcelopepis/FrameGuard/releases';
3434
const AUTHOR_NAME = 'Marcelo Pepis';
@@ -48,8 +48,13 @@ type UpdaterState =
4848
// ── Componente ──────────────────────────────────────────────────────────────────
4949

5050
export default function About() {
51+
const [appVersion, setAppVersion] = useState('...');
5152
const [updaterState, setUpdaterState] = useState<UpdaterState>({ status: 'idle' });
5253

54+
useEffect(() => {
55+
getVersion().then(setAppVersion).catch(() => setAppVersion('?'));
56+
}, []);
57+
5358
async function handleOpenUrl(url: string) {
5459
try {
5560
await openUrl(url);
@@ -125,7 +130,7 @@ export default function About() {
125130
<div className={styles.identityText}>
126131
<div className={styles.appName}>FrameGuard</div>
127132
<div className={styles.tagline}>Para quem joga, por quem entende.</div>
128-
<div className={styles.version}>Versão {APP_VERSION} · GPL v3 · Windows 11</div>
133+
<div className={styles.version}>Versão {appVersion} · GPL v3 · Windows 11</div>
129134
</div>
130135
</div>
131136
</div>
@@ -287,7 +292,7 @@ export default function About() {
287292
<div className={styles.updaterCard}>
288293
<div className={`${styles.statusRow} ${styles.successText}`}>
289294
<CheckCircle2 size={16} />
290-
<span>Você está na versão mais recente (v{APP_VERSION})</span>
295+
<span>Você está na versão mais recente (v{appVersion})</span>
291296
</div>
292297
</div>
293298
)}
@@ -300,7 +305,7 @@ export default function About() {
300305
Nova versão v{updaterState.version} disponível
301306
</div>
302307
<div className={styles.statusRow}>
303-
<span>Versão atual: v{APP_VERSION}</span>
308+
<span>Versão atual: v{appVersion}</span>
304309
</div>
305310
{updaterState.body && (
306311
<div className={styles.changelogText}>{updaterState.body}</div>

0 commit comments

Comments
 (0)