Cleaned up pages. Fixed SSO page.

This commit is contained in:
Mike Cao 2023-09-29 20:19:27 -07:00
parent 3720a5a2fc
commit 5e3c135388
11 changed files with 48 additions and 37 deletions

View File

@ -1,4 +1,5 @@
import TestConsole from '../TestConsole'; import TestConsole from '../TestConsole';
import { Metadata } from 'next';
async function getEnabled() { async function getEnabled() {
return !!process.env.ENABLE_TEST_CONSOLE; return !!process.env.ENABLE_TEST_CONSOLE;
@ -13,3 +14,7 @@ export default async function ConsolePage() {
return <TestConsole />; return <TestConsole />;
} }
export const metadata: Metadata = {
title: 'Test Console | umami',
};

View File

@ -1,7 +1,7 @@
import Dashboard from 'app/(app)/dashboard/Dashboard'; import Dashboard from 'app/(app)/dashboard/Dashboard';
import { Metadata } from 'next'; import { Metadata } from 'next';
export default function () { export default function DashboardPage() {
return <Dashboard />; return <Dashboard />;
} }

View File

@ -1,7 +1,7 @@
import InsightsReport from './InsightsReport'; import InsightsReport from './InsightsReport';
import { Metadata } from 'next'; import { Metadata } from 'next';
export default function () { export default function InsightsReportPage() {
return <InsightsReport reportId={null} />; return <InsightsReport reportId={null} />;
} }

View File

@ -1,6 +1,6 @@
import RetentionReport from './RetentionReport'; import RetentionReport from './RetentionReport';
export default function () { export default function RetentionReportPage() {
return <RetentionReport reportId={null} />; return <RetentionReport reportId={null} />;
} }

View File

@ -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 (
<>
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30 }}>
<Item key={TABS.myWebsites}>{formatMessage(labels.myWebsites)}</Item>
<Item key={TABS.teamWebsites}>{formatMessage(labels.teamWebsites)}</Item>
</Tabs>
{tab === TABS.myWebsites && <WebsiteList showHeader={false} />}
{tab === TABS.teamWebsites && (
<WebsiteList showHeader={false} showTeam={true} onlyTeams={true} />
)}
</>
);
}
export default WebsitesBrowse;

View File

@ -1,7 +1,7 @@
import WebsiteHeader from '../WebsiteHeader'; import WebsiteHeader from '../WebsiteHeader';
import WebsiteEventData from './WebsiteEventData'; import WebsiteEventData from './WebsiteEventData';
export default function ({ params: { id } }) { export default function WebsiteEventDataPage({ params: { id } }) {
if (!id) { if (!id) {
return null; return null;
} }

View File

@ -1,9 +1,5 @@
import WebsiteDetails from './WebsiteDetails'; import WebsiteDetails from './WebsiteDetails';
export default function ({ params: { id } }) { export default function WebsiteReportsPage({ params: { id } }) {
if (!id) {
return null;
}
return <WebsiteDetails websiteId={id} />; return <WebsiteDetails websiteId={id} />;
} }

View File

@ -1,6 +1,6 @@
import Realtime from './Realtime'; import Realtime from './Realtime';
export default function ({ params: { id } }) { export default function WebsiteRealtimePage({ params: { id } }) {
if (!id) { if (!id) {
return null; return null;
} }

View File

@ -1,30 +1,12 @@
'use client'; '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'; import WebsitesHeader from '../settings/websites/WebsitesHeader';
import WebsitesBrowse from './WebsitesBrowse';
const TABS = {
myWebsites: 'my-websites',
teamWebsites: 'team-websites',
};
export default function WebsitesPage() { export default function WebsitesPage() {
const { formatMessage, labels } = useMessages();
const [tab, setTab] = useState(TABS.myWebsites);
return ( return (
<> <>
<WebsitesHeader /> <WebsitesHeader />
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30 }}> <WebsitesBrowse />
<Item key={TABS.myWebsites}>{formatMessage(labels.myWebsites)}</Item>
<Item key={TABS.teamWebsites}>{formatMessage(labels.teamWebsites)}</Item>
</Tabs>
{tab === TABS.myWebsites && <WebsiteList showHeader={false} />}
{tab === TABS.teamWebsites && (
<WebsiteList showHeader={false} showTeam={true} onlyTeams={true} />
)}
</> </>
); );
} }

View File

@ -1,9 +1,5 @@
import Share from './Share'; import Share from './Share';
export default function ({ params: { id } }) { export default function ({ params: { id } }) {
if (!id) {
return null;
}
return <Share shareId={id} />; return <Share shareId={id} />;
} }

View File

@ -1,12 +1,14 @@
'use client'; 'use client';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { Loading } from 'react-basics'; import { Loading } from 'react-basics';
import { useRouter } from 'next/navigation'; import { useRouter, useSearchParams } from 'next/navigation';
import { setClientAuthToken } from 'lib/client'; import { setClientAuthToken } from 'lib/client';
export default function ({ params }) { export default function SSOPage() {
const router = useRouter(); const router = useRouter();
const { token, url } = params; const search = useSearchParams();
const url = search.get('url');
const token = search.get('token');
useEffect(() => { useEffect(() => {
if (url && token) { if (url && token) {