mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 10:35:35 +01:00
Changed route ids to be more explicit.
This commit is contained in:
parent
1a70350936
commit
18e36aa7b3
105 changed files with 86 additions and 76 deletions
32
src/app/(main)/settings/users/[userId]/UserSettings.tsx
Normal file
32
src/app/(main)/settings/users/[userId]/UserSettings.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'use client';
|
||||
import { Key, useState } from 'react';
|
||||
import { Item, Loading, Tabs } from 'react-basics';
|
||||
import Icons from 'components/icons';
|
||||
import UserEditForm from '../UserEditForm';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import { useMessages, useUser } from 'components/hooks';
|
||||
import UserWebsites from './UserWebsites';
|
||||
|
||||
export function UserSettings({ userId }: { userId: string }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const [tab, setTab] = useState<Key>('details');
|
||||
const { data: user, isLoading } = useUser(userId, { gcTime: 0 });
|
||||
|
||||
if (isLoading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title={user?.username} icon={<Icons.User />} />
|
||||
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30, fontSize: 14 }}>
|
||||
<Item key="details">{formatMessage(labels.details)}</Item>
|
||||
<Item key="websites">{formatMessage(labels.websites)}</Item>
|
||||
</Tabs>
|
||||
{tab === 'details' && <UserEditForm userId={userId} data={user} />}
|
||||
{tab === 'websites' && <UserWebsites userId={userId} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default UserSettings;
|
||||
18
src/app/(main)/settings/users/[userId]/UserWebsites.tsx
Normal file
18
src/app/(main)/settings/users/[userId]/UserWebsites.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'use client';
|
||||
import WebsitesTable from 'app/(main)/settings/websites/WebsitesTable';
|
||||
import DataTable from 'components/common/DataTable';
|
||||
import { useWebsites } from 'components/hooks';
|
||||
|
||||
export function UserWebsites({ userId }) {
|
||||
const queryResult = useWebsites({ userId });
|
||||
|
||||
return (
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => (
|
||||
<WebsitesTable data={data} showActions={true} allowEdit={true} allowView={true} />
|
||||
)}
|
||||
</DataTable>
|
||||
);
|
||||
}
|
||||
|
||||
export default UserWebsites;
|
||||
9
src/app/(main)/settings/users/[userId]/page.tsx
Normal file
9
src/app/(main)/settings/users/[userId]/page.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import UserSettings from './UserSettings';
|
||||
|
||||
export default function ({ params: { userId } }) {
|
||||
if (process.env.cloudMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <UserSettings userId={userId} />;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue