mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Website components. Update chart component.
This commit is contained in:
parent
d81ee3932d
commit
bdcdcd9d13
9 changed files with 165 additions and 43 deletions
|
|
@ -4,11 +4,11 @@ import { useAuth } from 'lib/middleware';
|
|||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { id, start_at, end_at, tz } = req.query;
|
||||
const { id, start_at, end_at, unit, tz } = req.query;
|
||||
|
||||
const [pageviews, uniques] = await Promise.all([
|
||||
getPageviewData(+id, new Date(+start_at), new Date(+end_at), tz, 'day', '*'),
|
||||
getPageviewData(+id, new Date(+start_at), new Date(+end_at), tz, 'day', 'distinct session_id'),
|
||||
getPageviewData(+id, new Date(+start_at), new Date(+end_at), tz, unit, '*'),
|
||||
getPageviewData(+id, new Date(+start_at), new Date(+end_at), tz, unit, 'distinct session_id'),
|
||||
]);
|
||||
|
||||
res.status(200).json({ pageviews, uniques });
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ import React from 'react';
|
|||
import Link from 'next/link';
|
||||
import { parse } from 'cookie';
|
||||
import Layout from 'components/Layout';
|
||||
import Chart from 'components/Chart';
|
||||
import PageviewsChart from 'components/PageviewsChart';
|
||||
import { verifySecureToken } from 'lib/crypto';
|
||||
import { subDays, endOfDay } from 'date-fns';
|
||||
import WebsiteList from '../components/WebsiteList';
|
||||
|
||||
export default function HomePage({ username }) {
|
||||
return (
|
||||
|
|
@ -12,8 +13,9 @@ export default function HomePage({ username }) {
|
|||
<h2>
|
||||
You've successfully logged in as <b>{username}</b>.
|
||||
</h2>
|
||||
<WebsiteList />
|
||||
<div>
|
||||
<Chart
|
||||
<PageviewsChart
|
||||
websiteId={3}
|
||||
startDate={subDays(endOfDay(new Date()), 6)}
|
||||
endDate={endOfDay(new Date())}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue