chore: remove stats page, rename reports

This commit is contained in:
Nicola Zambello 2023-02-18 23:48:21 +01:00
parent eccd7b5d96
commit 130698a317
Signed by: nzambello
GPG key ID: 56E4A92C2C1E50BA
3 changed files with 6 additions and 55 deletions

View file

@ -285,11 +285,11 @@ function Layout({ children }: React.PropsWithChildren<{}>) {
/> />
<NavLink <NavLink
component={Link} component={Link}
to="/report" to="/reports"
label="Report" label="Reports"
icon={ icon={
<ThemeIcon variant="light"> <ThemeIcon variant="light">
<FileText size={16} /> <BarChart2 size={16} />
</ThemeIcon> </ThemeIcon>
} }
variant="light" variant="light"
@ -307,18 +307,6 @@ function Layout({ children }: React.PropsWithChildren<{}>) {
variant="light" variant="light"
active={location.pathname.includes('/importexport')} active={location.pathname.includes('/importexport')}
/> />
<NavLink
component={Link}
to="/statistics"
label="Statistics"
icon={
<ThemeIcon variant="light">
<BarChart2 size={16} />
</ThemeIcon>
}
variant="light"
active={location.pathname.includes('/statistics')}
/>
</Navbar.Section> </Navbar.Section>
)} )}
{user && ( {user && (

View file

@ -6,9 +6,9 @@ import { requireUserId } from '~/session.server';
export const meta: MetaFunction = () => { export const meta: MetaFunction = () => {
return { return {
title: 'Report | WorkTimer', title: 'Reports | WorkTimer',
description: description:
'Generate a report of your time entries. You must be logged in to do this.' 'Generate reports of your time entries. You must be logged in to do this.'
}; };
}; };
@ -41,7 +41,7 @@ export default function ReportPage() {
border: 0 border: 0
}} }}
> >
Report Reports
</h1> </h1>
<Paper p="lg" radius="md"> <Paper p="lg" radius="md">
Coming soon Coming soon

View file

@ -1,37 +0,0 @@
import { Box, Paper } from '@mantine/core';
import { MetaFunction, LoaderArgs, redirect, json } from '@remix-run/node';
import { useLoaderData } from '@remix-run/react';
import { getTimeEntries } from '~/models/timeEntry.server';
import { requireUserId } from '~/session.server';
export const meta: MetaFunction = () => {
return {
title: 'Statistics | WorkTimer',
description:
'See statistics about your time entries. You must be logged in to do this.'
};
};
export async function loader({ request }: LoaderArgs) {
const userId = await requireUserId(request);
if (!userId) return redirect('/login');
return json({
...(await getTimeEntries({
userId
}))
});
}
export default function ReportPage() {
const data = useLoaderData();
return (
<>
<h1>Statistics</h1>
<Paper p="lg" radius="md">
Coming soon
</Paper>
</>
);
}