From e770fcd1a9aff513d5f44fbd7067d3d96300b473 Mon Sep 17 00:00:00 2001 From: charles-gauthereau Date: Sat, 23 Nov 2024 18:54:47 +0100 Subject: [PATCH] Correcting some bugs and working on responsive. --- app/(customer)/dashboard/layout.tsx | 18 ++-- app/(customer)/dashboard/profile/page.tsx | 9 +- .../Settings/SettingsTabs/SettingsTabs.tsx | 14 +-- .../SettingsUsersTab/SettingsUsersTab.tsx | 1 + src/components/wrappers/table/data-table.tsx | 85 ++++++++++--------- .../wrappers/table/table-pagination-size.tsx | 17 ++-- .../wrappers/table/table-pagination.tsx | 8 +- 7 files changed, 81 insertions(+), 71 deletions(-) diff --git a/app/(customer)/dashboard/layout.tsx b/app/(customer)/dashboard/layout.tsx index 1aa31257..6de904b3 100644 --- a/app/(customer)/dashboard/layout.tsx +++ b/app/(customer)/dashboard/layout.tsx @@ -12,7 +12,7 @@ export default async function Layout({children}: { children: React.ReactNode }) const user = await currentUser() console.log(user) - if(user){ + if (user) { const userInfo = await prisma.user.findUnique({ where: { email: user?.email @@ -25,13 +25,15 @@ export default async function Layout({children}: { children: React.ReactNode }) return ( - - -
-
- {children} -
- +
+ + +
+
+ {children} +
+ +
) } \ No newline at end of file diff --git a/app/(customer)/dashboard/profile/page.tsx b/app/(customer)/dashboard/profile/page.tsx index e9846af0..170153c3 100644 --- a/app/(customer)/dashboard/profile/page.tsx +++ b/app/(customer)/dashboard/profile/page.tsx @@ -27,13 +27,18 @@ export default async function RoutePage(props: PageParams<{}>) { {user.name} {userInfo.authMethod} + {userInfo.role} - + - + +
+ +
+
) diff --git a/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx b/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx index 9beba942..143a320c 100644 --- a/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx +++ b/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx @@ -17,12 +17,13 @@ export type SettingsTabsProps = { export const SettingsTabs = (props: SettingsTabsProps) => { return( + - - Informations - Users - Email - Storage + + Info + Users + Email + Storage
@@ -34,7 +35,7 @@ export const SettingsTabs = (props: SettingsTabsProps) => {
- + @@ -44,5 +45,6 @@ export const SettingsTabs = (props: SettingsTabsProps) => { + ) } diff --git a/src/components/wrappers/Dashboard/Settings/SettingsUsersTab/SettingsUsersTab.tsx b/src/components/wrappers/Dashboard/Settings/SettingsUsersTab/SettingsUsersTab.tsx index cd6cc802..13fa5fff 100644 --- a/src/components/wrappers/Dashboard/Settings/SettingsUsersTab/SettingsUsersTab.tsx +++ b/src/components/wrappers/Dashboard/Settings/SettingsUsersTab/SettingsUsersTab.tsx @@ -9,6 +9,7 @@ export type SettingsUsersTabProps = { export const SettingsUsersTab = (props: SettingsUsersTabProps) => { return ( +

List of Portabase users

diff --git a/src/components/wrappers/table/data-table.tsx b/src/components/wrappers/table/data-table.tsx index 4eea740b..ae433b11 100644 --- a/src/components/wrappers/table/data-table.tsx +++ b/src/components/wrappers/table/data-table.tsx @@ -7,47 +7,50 @@ export type dataTableProps = { export const DataTable = ({table}: dataTableProps) => { return ( - - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} - - ) - })} - - ))} - - - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} +
+
+ + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => { + return ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext() + )} + + ) + })} - )) - ) : ( - - - No results. - - - )} - -
+ ))} + + + {table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender(cell.column.columnDef.cell, cell.getContext())} + + ))} + + )) + ) : ( + + + No results. + + + )} + + +
) } \ No newline at end of file diff --git a/src/components/wrappers/table/table-pagination-size.tsx b/src/components/wrappers/table/table-pagination-size.tsx index f9a20a7d..d4d08a27 100644 --- a/src/components/wrappers/table/table-pagination-size.tsx +++ b/src/components/wrappers/table/table-pagination-size.tsx @@ -8,26 +8,24 @@ export type tablePaginationSizeProps = { pageSizeOptions?: number[] } - export const TablePaginationSize = (props: tablePaginationSizeProps) => { - - const {className, table, pageSizeOptions = [10, 20, 30, 40, 50]} = props + const { className, table, pageSizeOptions = [10, 20, 30, 40, 50] } = props; useEffect(() => { - table.setPageSize(Number(pageSizeOptions[0])) + table.setPageSize(Number(pageSizeOptions[0])); }, []); return ( -
+

Rows per page

- ) - -} \ No newline at end of file + ); +}; diff --git a/src/components/wrappers/table/table-pagination.tsx b/src/components/wrappers/table/table-pagination.tsx index 912ca28c..f68f5e67 100644 --- a/src/components/wrappers/table/table-pagination.tsx +++ b/src/components/wrappers/table/table-pagination.tsx @@ -16,9 +16,9 @@ export function TablePagination(props: tablePaginationProps) { const {className, table, maxVisiblePages = 3, pageSizeOptions = [10, 20, 30, 40, 50]} = props return ( -
- - +
+ +
- ) + ); }