From 5e3c1353880bdf9b87b46de674ac1debf33fb15d Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 29 Sep 2023 20:19:27 -0700 Subject: [PATCH] Cleaned up pages. Fixed SSO page. --- src/app/(app)/console/[[...id]]/page.tsx | 5 ++++ src/app/(app)/dashboard/page.tsx | 2 +- src/app/(app)/reports/insights/page.tsx | 2 +- src/app/(app)/reports/retention/page.js | 2 +- src/app/(app)/websites/WebsitesBrowse.js | 30 +++++++++++++++++++ .../(app)/websites/[id]/event-data/page.js | 2 +- src/app/(app)/websites/[id]/page.tsx | 6 +--- src/app/(app)/websites/[id]/realtime/page.tsx | 2 +- src/app/(app)/websites/page.js | 22 ++------------ src/app/share/[...id]/page.tsx | 4 --- src/app/sso/page.tsx | 8 +++-- 11 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 src/app/(app)/websites/WebsitesBrowse.js diff --git a/src/app/(app)/console/[[...id]]/page.tsx b/src/app/(app)/console/[[...id]]/page.tsx index 3eb96ee8..d020ddf9 100644 --- a/src/app/(app)/console/[[...id]]/page.tsx +++ b/src/app/(app)/console/[[...id]]/page.tsx @@ -1,4 +1,5 @@ import TestConsole from '../TestConsole'; +import { Metadata } from 'next'; async function getEnabled() { return !!process.env.ENABLE_TEST_CONSOLE; @@ -13,3 +14,7 @@ export default async function ConsolePage() { return ; } + +export const metadata: Metadata = { + title: 'Test Console | umami', +}; diff --git a/src/app/(app)/dashboard/page.tsx b/src/app/(app)/dashboard/page.tsx index 17a1ed01..7e7c095c 100644 --- a/src/app/(app)/dashboard/page.tsx +++ b/src/app/(app)/dashboard/page.tsx @@ -1,7 +1,7 @@ import Dashboard from 'app/(app)/dashboard/Dashboard'; import { Metadata } from 'next'; -export default function () { +export default function DashboardPage() { return ; } diff --git a/src/app/(app)/reports/insights/page.tsx b/src/app/(app)/reports/insights/page.tsx index a535553c..1f4db5c6 100644 --- a/src/app/(app)/reports/insights/page.tsx +++ b/src/app/(app)/reports/insights/page.tsx @@ -1,7 +1,7 @@ import InsightsReport from './InsightsReport'; import { Metadata } from 'next'; -export default function () { +export default function InsightsReportPage() { return ; } diff --git a/src/app/(app)/reports/retention/page.js b/src/app/(app)/reports/retention/page.js index 55b2de2e..7c60cee8 100644 --- a/src/app/(app)/reports/retention/page.js +++ b/src/app/(app)/reports/retention/page.js @@ -1,6 +1,6 @@ import RetentionReport from './RetentionReport'; -export default function () { +export default function RetentionReportPage() { return ; } diff --git a/src/app/(app)/websites/WebsitesBrowse.js b/src/app/(app)/websites/WebsitesBrowse.js new file mode 100644 index 00000000..006d0a40 --- /dev/null +++ b/src/app/(app)/websites/WebsitesBrowse.js @@ -0,0 +1,30 @@ +'use client'; +import WebsiteList from 'app/(app)/settings/websites/WebsitesList'; +import { useMessages } from 'components/hooks'; +import { useState } from 'react'; +import { Item, Tabs } from 'react-basics'; + +const TABS = { + myWebsites: 'my-websites', + teamWebsites: 'team-websites', +}; + +export function WebsitesBrowse() { + const { formatMessage, labels } = useMessages(); + const [tab, setTab] = useState(TABS.myWebsites); + + return ( + <> + + {formatMessage(labels.myWebsites)} + {formatMessage(labels.teamWebsites)} + + {tab === TABS.myWebsites && } + {tab === TABS.teamWebsites && ( + + )} + + ); +} + +export default WebsitesBrowse; diff --git a/src/app/(app)/websites/[id]/event-data/page.js b/src/app/(app)/websites/[id]/event-data/page.js index 66d1df66..14e878c6 100644 --- a/src/app/(app)/websites/[id]/event-data/page.js +++ b/src/app/(app)/websites/[id]/event-data/page.js @@ -1,7 +1,7 @@ import WebsiteHeader from '../WebsiteHeader'; import WebsiteEventData from './WebsiteEventData'; -export default function ({ params: { id } }) { +export default function WebsiteEventDataPage({ params: { id } }) { if (!id) { return null; } diff --git a/src/app/(app)/websites/[id]/page.tsx b/src/app/(app)/websites/[id]/page.tsx index 2a0f3794..4b7d6ff3 100644 --- a/src/app/(app)/websites/[id]/page.tsx +++ b/src/app/(app)/websites/[id]/page.tsx @@ -1,9 +1,5 @@ import WebsiteDetails from './WebsiteDetails'; -export default function ({ params: { id } }) { - if (!id) { - return null; - } - +export default function WebsiteReportsPage({ params: { id } }) { return ; } diff --git a/src/app/(app)/websites/[id]/realtime/page.tsx b/src/app/(app)/websites/[id]/realtime/page.tsx index 89e5ae54..b2957fa0 100644 --- a/src/app/(app)/websites/[id]/realtime/page.tsx +++ b/src/app/(app)/websites/[id]/realtime/page.tsx @@ -1,6 +1,6 @@ import Realtime from './Realtime'; -export default function ({ params: { id } }) { +export default function WebsiteRealtimePage({ params: { id } }) { if (!id) { return null; } diff --git a/src/app/(app)/websites/page.js b/src/app/(app)/websites/page.js index 7772c252..a30bc583 100644 --- a/src/app/(app)/websites/page.js +++ b/src/app/(app)/websites/page.js @@ -1,30 +1,12 @@ 'use client'; -import WebsiteList from 'app/(app)/settings/websites/WebsitesList'; -import { useMessages } from 'components/hooks'; -import { useState } from 'react'; -import { Item, Tabs } from 'react-basics'; import WebsitesHeader from '../settings/websites/WebsitesHeader'; - -const TABS = { - myWebsites: 'my-websites', - teamWebsites: 'team-websites', -}; +import WebsitesBrowse from './WebsitesBrowse'; export default function WebsitesPage() { - const { formatMessage, labels } = useMessages(); - const [tab, setTab] = useState(TABS.myWebsites); - return ( <> - - {formatMessage(labels.myWebsites)} - {formatMessage(labels.teamWebsites)} - - {tab === TABS.myWebsites && } - {tab === TABS.teamWebsites && ( - - )} + ); } diff --git a/src/app/share/[...id]/page.tsx b/src/app/share/[...id]/page.tsx index 736abe7d..b674d56a 100644 --- a/src/app/share/[...id]/page.tsx +++ b/src/app/share/[...id]/page.tsx @@ -1,9 +1,5 @@ import Share from './Share'; export default function ({ params: { id } }) { - if (!id) { - return null; - } - return ; } diff --git a/src/app/sso/page.tsx b/src/app/sso/page.tsx index 914efdf1..75ea945d 100644 --- a/src/app/sso/page.tsx +++ b/src/app/sso/page.tsx @@ -1,12 +1,14 @@ 'use client'; import { useEffect } from 'react'; import { Loading } from 'react-basics'; -import { useRouter } from 'next/navigation'; +import { useRouter, useSearchParams } from 'next/navigation'; import { setClientAuthToken } from 'lib/client'; -export default function ({ params }) { +export default function SSOPage() { const router = useRouter(); - const { token, url } = params; + const search = useSearchParams(); + const url = search.get('url'); + const token = search.get('token'); useEffect(() => { if (url && token) {