shinkan-jinkendo/frontend/src/pages/SettingsSystemInfoPage.jsx
Lars 18fa4de055
All checks were successful
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 26s
Test Suite / pytest-backend (pull_request) Successful in 5s
Test Suite / lint-backend (pull_request) Successful in 1s
Test Suite / build-frontend (pull_request) Successful in 6s
Test Suite / playwright-tests (pull_request) Successful in 23s
feat: add system information page and update account settings
- Introduced a new SettingsSystemInfoPage to display technical system information.
- Updated AccountSettingsPage to include a link to the new system information page, enhancing user access to app version, build, environment, and database schema details.
- Removed unused version state from Dashboard component to streamline data handling.
2026-05-07 10:29:14 +02:00

101 lines
2.9 KiB
JavaScript

import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import { useAuth } from '../context/AuthContext'
import api from '../utils/api'
/**
* Technische System- und Build-Infos (ehemals Dashboard) — unter Einstellungen für Betrieb/Diagnose.
*/
function SettingsSystemInfoPage() {
const { user } = useAuth()
const [version, setVersion] = useState(null)
const [err, setErr] = useState(null)
const [loading, setLoading] = useState(true)
useEffect(() => {
let cancelled = false
;(async () => {
setErr(null)
try {
const v = await api.getVersion()
if (!cancelled) setVersion(v)
} catch (e) {
if (!cancelled) setErr(e.message || String(e))
} finally {
if (!cancelled) setLoading(false)
}
})()
return () => {
cancelled = true
}
}, [])
return (
<div className="page-padding app-page" style={{ padding: '1rem' }}>
<p style={{ marginBottom: '0.75rem' }}>
<Link to="/settings" style={{ fontSize: '0.9rem' }}>
Zurück zu Einstellungen
</Link>
</p>
<h1 style={{ marginBottom: '0.35rem', fontSize: '1.5rem' }}>Systeminformationen</h1>
<p
style={{
color: 'var(--text2)',
marginBottom: '1.25rem',
fontSize: '0.95rem',
lineHeight: 1.5,
maxWidth: '40rem',
}}
>
Build, Umgebung und Schema-Stand der App hilfreich für Support oder nach Deployments. Tarif und Rolle
beziehen sich auf dein Konto.
</p>
{loading ? (
<p className="muted" style={{ margin: 0 }}>
Version wird geladen
</p>
) : null}
{err ? (
<p role="alert" style={{ color: 'var(--danger)', marginBottom: '1rem' }}>
{err}
</p>
) : null}
{version ? (
<div className="card dashboard-sys-card">
<h2 className="dashboard-sys-card__title" style={{ marginTop: 0 }}>
System
</h2>
<div className="dashboard-sys-card__grid">
<strong>Version</strong>
<span>{version.app_version}</span>
<strong>Build</strong>
<span>{version.build_date}</span>
<strong>Umgebung</strong>
<span>{version.environment}</span>
<strong>DB Schema</strong>
<span>{version.db_schema_version}</span>
<strong>Dein Tier</strong>
<span>
<span
className={
user?.tier === 'premium'
? 'dashboard-sys-card__pill dashboard-sys-card__pill--accent'
: 'dashboard-sys-card__pill'
}
>
{user?.tier || 'free'}
</span>
</span>
<strong>Rolle</strong>
<span>{user?.role || 'user'}</span>
</div>
</div>
) : null}
</div>
)
}
export default SettingsSystemInfoPage