dangerzone-stats/output/components/App.js
Alexis Métaireau 2fbafed46e
First commit
2024-11-11 00:06:35 +01:00

28 lines
No EOL
1,019 B
JavaScript

import { h } from 'https://esm.sh/preact';
import { useState } from 'https://esm.sh/preact/hooks';
import { Stats } from './Stats.js';
import { Chart } from './Chart.js';
export function App({ stats, generatedAt }) {
const [activeTab, setActiveTab] = useState('charts');
return h('div', { class: 'container' }, [
h('header', { class: 'header' }, [
h('h1', null, 'Dangerzone Release Stats'),
h('p', null, `Generated at: ${new Date(generatedAt).toLocaleString()}`)
]),
h('nav', { class: 'tabs' }, [
h('button', {
class: activeTab === 'charts' ? 'active' : '',
onClick: () => setActiveTab('charts')
}, 'Charts'),
h('button', {
class: activeTab === 'overview' ? 'active' : '',
onClick: () => setActiveTab('overview')
}, 'Overview')
]),
activeTab === 'charts'
? h(Chart, { stats })
: h(Stats, { stats })
]);
}