Skip to content

Commit

Permalink
Cleaned up pages. Fixed SSO page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Sep 30, 2023
1 parent 3720a5a commit 5e3c135
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 37 deletions.
5 changes: 5 additions & 0 deletions src/app/(app)/console/[[...id]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import TestConsole from '../TestConsole';
import { Metadata } from 'next';

async function getEnabled() {
return !!process.env.ENABLE_TEST_CONSOLE;
Expand All @@ -13,3 +14,7 @@ export default async function ConsolePage() {

return <TestConsole />;
}

export const metadata: Metadata = {
title: 'Test Console | umami',
};
2 changes: 1 addition & 1 deletion src/app/(app)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Dashboard from 'app/(app)/dashboard/Dashboard';
import { Metadata } from 'next';

export default function () {
export default function DashboardPage() {
return <Dashboard />;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/(app)/reports/insights/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import InsightsReport from './InsightsReport';
import { Metadata } from 'next';

export default function () {
export default function InsightsReportPage() {
return <InsightsReport reportId={null} />;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/(app)/reports/retention/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import RetentionReport from './RetentionReport';

export default function () {
export default function RetentionReportPage() {
return <RetentionReport reportId={null} />;
}

Expand Down
30 changes: 30 additions & 0 deletions src/app/(app)/websites/WebsitesBrowse.js
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/app/(app)/websites/[id]/event-data/page.js
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
6 changes: 1 addition & 5 deletions src/app/(app)/websites/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import WebsiteDetails from './WebsiteDetails';

export default function ({ params: { id } }) {
if (!id) {
return null;
}

export default function WebsiteReportsPage({ params: { id } }) {
return <WebsiteDetails websiteId={id} />;
}
2 changes: 1 addition & 1 deletion src/app/(app)/websites/[id]/realtime/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Realtime from './Realtime';

export default function ({ params: { id } }) {
export default function WebsiteRealtimePage({ params: { id } }) {
if (!id) {
return null;
}
Expand Down
22 changes: 2 additions & 20 deletions src/app/(app)/websites/page.js
Original file line number Diff line number Diff line change
@@ -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 (
<>
<WebsitesHeader />
<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} />
)}
<WebsitesBrowse />
</>
);
}
4 changes: 0 additions & 4 deletions src/app/share/[...id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import Share from './Share';

export default function ({ params: { id } }) {
if (!id) {
return null;
}

return <Share shareId={id} />;
}
8 changes: 5 additions & 3 deletions src/app/sso/page.tsx
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 5e3c135

Please sign in to comment.