chore: add placeholder pages for report and stats
This commit is contained in:
parent
4083641a6a
commit
50fb9af24f
37
app/routes/report.tsx
Normal file
37
app/routes/report.tsx
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
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: 'Report | WorkTimer',
|
||||||
|
description:
|
||||||
|
'Generate a report of 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>Report</h1>
|
||||||
|
<Paper p="lg" radius="md">
|
||||||
|
Coming soon
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
37
app/routes/statistics.tsx
Normal file
37
app/routes/statistics.tsx
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue