diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx
index 297cd6e5..d3b6bfa3 100644
--- a/app/(auth)/layout.tsx
+++ b/app/(auth)/layout.tsx
@@ -6,13 +6,13 @@ import {prisma} from "@/prisma";
export default async function Layout({children}: { children: React.ReactNode }) {
const user = await currentUser()
- const userInfo = await prisma.user.findUnique({
- where: {
- email: user.email
- }
- })
-
- if(userInfo){
+ // const userInfo = await prisma.user.findUnique({
+ // where: {
+ // email: user?.email
+ // }
+ // })
+ //
+ if(user){
redirect('/dashboard')
}
diff --git a/app/(customer)/dashboard/settings/page.tsx b/app/(customer)/dashboard/settings/page.tsx
index 6cd018f0..be4d5cb5 100644
--- a/app/(customer)/dashboard/settings/page.tsx
+++ b/app/(customer)/dashboard/settings/page.tsx
@@ -1,8 +1,24 @@
import {PageParams} from "@/types/next";
-import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
+import {Page, PageContent, PageDescription, PageHeader, PageTitle} from "@/features/layout/page";
+import {prisma} from "@/prisma";
+import {requiredCurrentUser} from "@/auth/current-user";
+import {DataTableWithPagination} from "@/components/wrappers/table/data-table-with-pagination";
+import {usersColumns} from "@/components/wrappers/Dashboard/Settings/SettingsTabs/columns-users";
+import {SettingsTabs} from "@/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs";
export default async function RoutePage(props: PageParams<{}>) {
+ const user = await requiredCurrentUser()
+
+
+ const users = await prisma.user.findMany({
+ where:{
+ id: {
+ not: user.id
+ }
+ }
+ })
+
return (
@@ -11,8 +27,11 @@ export default async function RoutePage(props: PageParams<{}>) {
Settings
+
+ Manage your Portabase settings
+
- content
+
)
diff --git a/prisma/migrations/20241116144000_2024_11_16/migration.sql b/prisma/migrations/20241116144000_2024_11_16/migration.sql
new file mode 100644
index 00000000..c2988586
--- /dev/null
+++ b/prisma/migrations/20241116144000_2024_11_16/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "Settings" ADD COLUMN "s3EndPointUrl" TEXT;
diff --git a/prisma/migrations/20241116144522_2024_11_16/migration.sql b/prisma/migrations/20241116144522_2024_11_16/migration.sql
new file mode 100644
index 00000000..6b07c705
--- /dev/null
+++ b/prisma/migrations/20241116144522_2024_11_16/migration.sql
@@ -0,0 +1,6 @@
+-- AlterTable
+ALTER TABLE "Settings" ADD COLUMN "smtpFrom" TEXT,
+ADD COLUMN "smtpHost" TEXT,
+ADD COLUMN "smtpPassword" TEXT,
+ADD COLUMN "smtpPort" TEXT,
+ADD COLUMN "smtpUser" TEXT;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index d2de6d9b..8f946f1e 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -135,7 +135,13 @@ enum TypeStorage {
model Settings {
id String @id @default(cuid())
storage TypeStorage @default(local)
+ s3EndPointUrl String?
s3AccessKeyId String?
s3SecretAccessKey String?
S3BucketName String?
+ smtpPassword String?
+ smtpFrom String?
+ smtpHost String?
+ smtpPort String?
+ smtpUser String?
}
diff --git a/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx b/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx
new file mode 100644
index 00000000..e3c40b1f
--- /dev/null
+++ b/src/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs.tsx
@@ -0,0 +1,36 @@
+"use client"
+import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
+import {DataTableWithPagination} from "@/components/wrappers/table/data-table-with-pagination";
+import {usersColumns} from "@/components/wrappers/Dashboard/Settings/SettingsTabs/columns-users";
+import {User} from "@prisma/client";
+import {backupColumns} from "@/features/backup/columns";
+
+
+export type SettingsTabsProps = {
+ users: User[];
+}
+
+export const SettingsTabs = (props: SettingsTabsProps) => {
+
+
+
+
+ return(
+
+
+ Informations
+ Users
+ Email
+ Storage
+
+
+ ok
+
+
+
+
+ Change your password here.
+ Change your password here.
+
+ )
+}
diff --git a/src/components/wrappers/Dashboard/Settings/SettingsTabs/columns-users.tsx b/src/components/wrappers/Dashboard/Settings/SettingsTabs/columns-users.tsx
new file mode 100644
index 00000000..1e4cdbee
--- /dev/null
+++ b/src/components/wrappers/Dashboard/Settings/SettingsTabs/columns-users.tsx
@@ -0,0 +1,34 @@
+"use client"
+
+import {ColumnDef} from "@tanstack/react-table"
+import {Badge} from "@/components/ui/badge";
+import {User} from "@prisma/client";
+
+export const usersColumns: ColumnDef[] = [
+ {
+ accessorKey: "id",
+ header: "Id",
+ },
+ {
+ accessorKey: "name",
+ header: "Name"
+ },
+ {
+ accessorKey: "email",
+ header: "Email"
+ },
+ {
+ accessorKey: "createdAt",
+ header: "Created At",
+ cell: ({row}) => {
+ return new Date(row.getValue("createdAt")).toLocaleString("fr-FR");
+ },
+ },
+ {
+ accessorKey: "authMethod",
+ header: "Method",
+ cell: ({row}) => {
+ return {row.getValue("authMethod")}
+ },
+ }
+]
\ No newline at end of file
diff --git a/src/components/wrappers/Dashboard/SideBar/SideBarMenu/SideBarMenu.tsx b/src/components/wrappers/Dashboard/SideBar/SideBarMenu/SideBarMenu.tsx
index 0913dddf..eccb0923 100644
--- a/src/components/wrappers/Dashboard/SideBar/SideBarMenu/SideBarMenu.tsx
+++ b/src/components/wrappers/Dashboard/SideBar/SideBarMenu/SideBarMenu.tsx
@@ -3,14 +3,16 @@ import {SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem} from
import Link from "next/link";
import {cn} from "@/lib/utils";
import {buttonVariants} from "@/components/ui/button";
-import {PropsWithChildren, useState} from "react";
+import {PropsWithChildren, useEffect, useState} from "react";
import {ChartArea, Home, Settings, ShieldHalf} from "lucide-react";
+import {usePathname} from "next/navigation";
export type SidebarMenuCustomProps = {}
export const SidebarMenuCustom = (props: SidebarMenuCustomProps) => {
const BASE_URL = "/dashboard";
+ const pathname = usePathname();
// Menu items.
const items = [
{
@@ -35,6 +37,14 @@ export const SidebarMenuCustom = (props: SidebarMenuCustomProps) => {
},
]
+ useEffect(() => {
+ const currentUrl = pathname;
+ const currentItem = items.find((item) => `${BASE_URL}/${item.url}` === currentUrl);
+ if (currentItem) {
+ setActiveItem(currentItem.title);
+ }
+ }, [pathname]);
+
const [activeItem, setActiveItem] = useState(items[0].title);
const handleItemClick = (title: string) => {
setActiveItem(title);
diff --git a/src/components/wrappers/table/data-table-with-pagination.tsx b/src/components/wrappers/table/data-table-with-pagination.tsx
index b1e68d38..a8ae4e2e 100644
--- a/src/components/wrappers/table/data-table-with-pagination.tsx
+++ b/src/components/wrappers/table/data-table-with-pagination.tsx
@@ -18,7 +18,7 @@ export function DataTableWithPagination({columns, data}: DataTabl
const [sorting, setSorting] = useState([])
const table = useReactTable({
- data,
+ data: data,
columns,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
diff --git a/src/components/wrappers/table/data-table.tsx b/src/components/wrappers/table/data-table.tsx
index 62662140..4eea740b 100644
--- a/src/components/wrappers/table/data-table.tsx
+++ b/src/components/wrappers/table/data-table.tsx
@@ -6,7 +6,6 @@ export type dataTableProps = {
}
export const DataTable = ({table}: dataTableProps) => {
-
return (
@@ -43,7 +42,7 @@ export const DataTable = ({table}: dataTableProps) => {
))
) : (
-
+
No results.
diff --git a/src/features/layout/page.tsx b/src/features/layout/page.tsx
index 015e69d9..2b2c5c30 100644
--- a/src/features/layout/page.tsx
+++ b/src/features/layout/page.tsx
@@ -18,7 +18,7 @@ export const PageTitle = twx.h1((props) => [
export const PageDescription = twx.h2((props) => [
- cn(`text-s mb-6 text-gray-700`, props.className),
+ cn(`text-s mb-6 `, props.className),
])