diff --git a/src/app/(main)/settings/teams/TeamsPage.tsx b/src/app/(main)/settings/teams/TeamsSettingsPage.tsx similarity index 79% rename from src/app/(main)/settings/teams/TeamsPage.tsx rename to src/app/(main)/settings/teams/TeamsSettingsPage.tsx index 33ddda3d..9b45845b 100644 --- a/src/app/(main)/settings/teams/TeamsPage.tsx +++ b/src/app/(main)/settings/teams/TeamsSettingsPage.tsx @@ -2,7 +2,7 @@ import TeamsDataTable from './TeamsDataTable'; import TeamsHeader from './TeamsHeader'; -export default function TeamsPage() { +export default function TeamsSettingsPage() { return ( <> diff --git a/src/app/(main)/settings/teams/page.tsx b/src/app/(main)/settings/teams/page.tsx index 93be83a2..4342b607 100644 --- a/src/app/(main)/settings/teams/page.tsx +++ b/src/app/(main)/settings/teams/page.tsx @@ -1,8 +1,8 @@ import { Metadata } from 'next'; -import TeamsPage from './TeamsPage'; +import TeamsSettingsPage from './TeamsSettingsPage'; export default function () { - return ; + return ; } export const metadata: Metadata = { diff --git a/src/app/(main)/settings/users/UsersPage.tsx b/src/app/(main)/settings/users/UsersSettingsPage.tsx similarity index 79% rename from src/app/(main)/settings/users/UsersPage.tsx rename to src/app/(main)/settings/users/UsersSettingsPage.tsx index 348c5a33..664f58d1 100644 --- a/src/app/(main)/settings/users/UsersPage.tsx +++ b/src/app/(main)/settings/users/UsersSettingsPage.tsx @@ -2,7 +2,7 @@ import UsersDataTable from './UsersDataTable'; import UsersHeader from './UsersHeader'; -export default function UsersPage() { +export default function UsersSettingsPage() { return ( <> diff --git a/src/app/(main)/settings/users/page.tsx b/src/app/(main)/settings/users/page.tsx index a3209ab3..01d5156f 100644 --- a/src/app/(main)/settings/users/page.tsx +++ b/src/app/(main)/settings/users/page.tsx @@ -1,8 +1,8 @@ import { Metadata } from 'next'; -import UsersPage from './UsersPage'; +import UsersSettingsPage from './UsersSettingsPage'; export default function () { - return ; + return ; } export const metadata: Metadata = { title: 'Users', diff --git a/src/app/(main)/settings/websites/WebsitesDataTable.tsx b/src/app/(main)/settings/websites/WebsitesDataTable.tsx index a9d99f9a..6ffe6fd0 100644 --- a/src/app/(main)/settings/websites/WebsitesDataTable.tsx +++ b/src/app/(main)/settings/websites/WebsitesDataTable.tsx @@ -4,21 +4,19 @@ import DataTable from 'components/common/DataTable'; import { useWebsites } from 'components/hooks'; export function WebsitesDataTable({ - userId, teamId, allowEdit = true, allowView = true, showActions = true, children, }: { - userId?: string; teamId?: string; allowEdit?: boolean; allowView?: boolean; showActions?: boolean; children?: ReactNode; }) { - const queryResult = useWebsites({ userId, teamId }); + const queryResult = useWebsites({ teamId }); return ( diff --git a/src/app/(main)/settings/websites/WebsitesPage.tsx b/src/app/(main)/settings/websites/WebsitesPage.tsx deleted file mode 100644 index 4de8f105..00000000 --- a/src/app/(main)/settings/websites/WebsitesPage.tsx +++ /dev/null @@ -1,15 +0,0 @@ -'use client'; -import { useLogin } from 'components/hooks'; -import WebsitesDataTable from './WebsitesDataTable'; -import WebsitesHeader from './WebsitesHeader'; - -export default function WebsitesPage({ teamId }: { teamId: string }) { - const { user } = useLogin(); - - return ( - <> - - - - ); -} diff --git a/src/app/(main)/settings/websites/WebsitesSettingsPage.tsx b/src/app/(main)/settings/websites/WebsitesSettingsPage.tsx new file mode 100644 index 00000000..14411da1 --- /dev/null +++ b/src/app/(main)/settings/websites/WebsitesSettingsPage.tsx @@ -0,0 +1,12 @@ +'use client'; +import WebsitesDataTable from './WebsitesDataTable'; +import WebsitesHeader from './WebsitesHeader'; + +export default function WebsitesSettingsPage({ teamId }: { teamId: string }) { + return ( + <> + + + + ); +} diff --git a/src/app/(main)/settings/websites/[websiteId]/WebsitePage.tsx b/src/app/(main)/settings/websites/[websiteId]/WebsiteSettingsPage.tsx similarity index 76% rename from src/app/(main)/settings/websites/[websiteId]/WebsitePage.tsx rename to src/app/(main)/settings/websites/[websiteId]/WebsiteSettingsPage.tsx index 752fd33c..00147629 100644 --- a/src/app/(main)/settings/websites/[websiteId]/WebsitePage.tsx +++ b/src/app/(main)/settings/websites/[websiteId]/WebsiteSettingsPage.tsx @@ -2,7 +2,7 @@ import WebsiteProvider from 'app/(main)/websites/[websiteId]/WebsiteProvider'; import WebsiteSettings from './WebsiteSettings'; -export default function WebsitePage({ websiteId }: { websiteId: string }) { +export default function WebsiteSettingsPage({ websiteId }: { websiteId: string }) { return ( diff --git a/src/app/(main)/settings/websites/[websiteId]/page.tsx b/src/app/(main)/settings/websites/[websiteId]/page.tsx index 33caff5a..f3d87c78 100644 --- a/src/app/(main)/settings/websites/[websiteId]/page.tsx +++ b/src/app/(main)/settings/websites/[websiteId]/page.tsx @@ -1,8 +1,8 @@ -import WebsitePage from './WebsitePage'; +import WebsiteSettingsPage from './WebsiteSettingsPage'; import { Metadata } from 'next'; export default async function ({ params: { websiteId } }) { - return ; + return ; } export const metadata: Metadata = { diff --git a/src/app/(main)/settings/websites/page.tsx b/src/app/(main)/settings/websites/page.tsx index 8d305e6b..d073b32b 100644 --- a/src/app/(main)/settings/websites/page.tsx +++ b/src/app/(main)/settings/websites/page.tsx @@ -1,8 +1,8 @@ import { Metadata } from 'next'; -import WebsitesPage from './WebsitesPage'; +import WebsitesSettingsPage from './WebsitesSettingsPage'; export default function ({ params: { teamId } }: { params: { teamId: string } }) { - return ; + return ; } export const metadata: Metadata = { diff --git a/src/app/(main)/websites/WebsitesPage.tsx b/src/app/(main)/websites/WebsitesPage.tsx index fa2e9f71..75776c4c 100644 --- a/src/app/(main)/websites/WebsitesPage.tsx +++ b/src/app/(main)/websites/WebsitesPage.tsx @@ -1,12 +1,15 @@ 'use client'; import WebsitesHeader from 'app/(main)/settings/websites/WebsitesHeader'; import WebsitesDataTable from 'app/(main)/settings/websites/WebsitesDataTable'; +import { useLogin } from 'components/hooks'; + +export default function WebsitesPage({ teamId }: { teamId: string; userId: string }) { + const { user } = useLogin(); -export default function WebsitesPage({ teamId, userId }: { teamId: string; userId: string }) { return ( <> - - + + ); } diff --git a/src/components/common/Pager.tsx b/src/components/common/Pager.tsx index 82292156..3e0a8033 100644 --- a/src/components/common/Pager.tsx +++ b/src/components/common/Pager.tsx @@ -23,6 +23,7 @@ export function Pager({ page, pageSize, count, onPageChange, className }: PagerP const handlePageChange = (value: number) => { const nextPage = page + value; + if (nextPage > 0 && nextPage <= maxPage) { onPageChange(nextPage); } diff --git a/src/components/hooks/queries/useWebsites.ts b/src/components/hooks/queries/useWebsites.ts index 8bfad333..94198975 100644 --- a/src/components/hooks/queries/useWebsites.ts +++ b/src/components/hooks/queries/useWebsites.ts @@ -13,8 +13,9 @@ export function useWebsites( return useFilterQuery({ queryKey: ['websites', { userId, teamId, modified, ...params }], - queryFn: () => { + queryFn: (data: any) => { return get(teamId ? `/teams/${teamId}/websites` : `/users/${userId || user.id}/websites`, { + ...data, ...params, }); }, diff --git a/src/components/input/WebsiteSelect.tsx b/src/components/input/WebsiteSelect.tsx index 1ea8d392..0540ed38 100644 --- a/src/components/input/WebsiteSelect.tsx +++ b/src/components/input/WebsiteSelect.tsx @@ -7,12 +7,10 @@ import styles from './WebsiteSelect.module.css'; export function WebsiteSelect({ websiteId, teamId, - userId, onSelect, }: { websiteId?: string; teamId?: string; - userId?: string; onSelect?: (key: any) => void; }) { const { formatMessage, labels, messages } = useMessages(); @@ -21,7 +19,7 @@ export function WebsiteSelect({ const { data: website } = useWebsite(selectedId as string); - const queryResult = useWebsites({ teamId, userId }, { query, pageSize: 5 }); + const queryResult = useWebsites({ teamId }, { query, pageSize: 5 }); const renderValue = () => { return website?.name;