From be8f3bd98cb29039bc98b0283eb138cdaf2d38c2 Mon Sep 17 00:00:00 2001 From: charlesgauthereau Date: Sun, 11 Jan 2026 12:37:57 +0100 Subject: [PATCH] fix: organization settings page responsive on mobile. --- .../(admin)/agents/[agentId]/page.tsx | 24 +++++--- .../dashboard/(admin)/agents/page.tsx | 2 +- .../projects/[projectId]/page.tsx | 12 ---- .../(organization)/settings/page.tsx | 35 ++++++++---- .../dashboard/agent/agent-database-card.tsx | 4 +- .../button-delete-agent.tsx | 4 +- .../delete-organization-button.tsx | 4 +- .../project-card/project-database-card.tsx | 56 +++++++++++-------- 8 files changed, 81 insertions(+), 60 deletions(-) diff --git a/app/(customer)/dashboard/(admin)/agents/[agentId]/page.tsx b/app/(customer)/dashboard/(admin)/agents/[agentId]/page.tsx index 08484d53..19a978e6 100644 --- a/app/(customer)/dashboard/(admin)/agents/[agentId]/page.tsx +++ b/app/(customer)/dashboard/(admin)/agents/[agentId]/page.tsx @@ -33,16 +33,22 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>) return (
- - {capitalizeFirstLetter(agent.name)} - - - + +
+ {capitalizeFirstLetter(agent.name)} +
+
+
+ + + +
+
+ +
+
- - -
{agent.description && ( diff --git a/app/(customer)/dashboard/(admin)/agents/page.tsx b/app/(customer)/dashboard/(admin)/agents/page.tsx index 6864d1cc..230026a7 100644 --- a/app/(customer)/dashboard/(admin)/agents/page.tsx +++ b/app/(customer)/dashboard/(admin)/agents/page.tsx @@ -22,7 +22,7 @@ export default async function RoutePage(props: PageParams<{}>) { with: { databases: true }, - orderBy: (fields) => desc(fields.createdAt), + orderBy: (fields) => desc(fields.lastContact), }); diff --git a/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx b/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx index 284bf0d4..0798540e 100644 --- a/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx +++ b/app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx @@ -78,18 +78,6 @@ export default async function RoutePage(props: PageParams<{ )} - - - - - - - - - - - - {proj.databases.length > 0 ? ( diff --git a/app/(customer)/dashboard/(organization)/settings/page.tsx b/app/(customer)/dashboard/(organization)/settings/page.tsx index dc1ff52a..131e2d62 100644 --- a/app/(customer)/dashboard/(organization)/settings/page.tsx +++ b/app/(customer)/dashboard/(organization)/settings/page.tsx @@ -11,6 +11,13 @@ import {Metadata} from "next"; import {OrganizationTabs} from "@/components/wrappers/dashboard/organization/tabs/organization-tabs"; import {getOrganizationChannels} from "@/db/services/notification-channel"; import {computeOrganizationPermissions} from "@/lib/acl/organization-acl"; +import {capitalizeFirstLetter} from "@/utils/text"; +import Link from "next/link"; +import {buttonVariants} from "@/components/ui/button"; +import {GearIcon} from "@radix-ui/react-icons"; +import { + ButtonDeleteProject +} from "@/components/wrappers/dashboard/projects/button-delete-project/button-delete-project"; export const metadata: Metadata = { title: "Settings", @@ -26,25 +33,29 @@ export default async function RoutePage(props: PageParams<{ slug: string }>) { } const notificationChannels = await getOrganizationChannels(organization.id) - const permissions = computeOrganizationPermissions(activeMember); return ( - - Organization settings - {permissions.canManageSettings && organization.slug !== "default" && ( - - )} + +
+ Organization settings +
+
+
+ {permissions.canManageSettings && organization.slug !== "default" && ( + + )} +
+
+ {permissions.canManageDangerZone && organization.slug !== "default" && ( + + )} +
+
- - - {permissions.canManageDangerZone && organization.slug !== "default" && ( - - )} -
{ const {data: database} = props; - return ; + return ; - //todo: à remettre quand on aura fait l'impersonation des admins + //Todo: Add again when impersonation system will be implemented /* if (!database.projectId) { return ; } diff --git a/src/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent.tsx b/src/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent.tsx index c7788bb3..0fccbd59 100644 --- a/src/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent.tsx +++ b/src/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent.tsx @@ -6,6 +6,7 @@ import {useMutation} from "@tanstack/react-query"; import {useRouter} from "next/navigation"; import {toast} from "sonner"; import {deleteAgentAction} from "@/components/wrappers/dashboard/agent/button-delete-agent/delete-agent.action"; +import {useIsMobile} from "@/hooks/use-mobile"; export type ButtonDeleteAgentProps = { text?: string; @@ -14,6 +15,7 @@ export type ButtonDeleteAgentProps = { export const ButtonDeleteAgent = (props: ButtonDeleteAgentProps) => { const router = useRouter(); + const isMobile = useIsMobile(); const mutation = useMutation({ mutationFn: () => deleteAgentAction(props.agentId), @@ -33,7 +35,7 @@ export const ButtonDeleteAgent = (props: ButtonDeleteAgentProps) => { description="Are you sure you want to remove this agent? This action cannot be undone." button={{ main: { - text: props.text ? props.text : "", + text: props.text ? !isMobile ? props.text: "" : "", variant: "outline", icon: , }, diff --git a/src/components/wrappers/dashboard/organization/delete-organization/delete-organization-button.tsx b/src/components/wrappers/dashboard/organization/delete-organization/delete-organization-button.tsx index 3a7f3b54..6a5dc069 100644 --- a/src/components/wrappers/dashboard/organization/delete-organization/delete-organization-button.tsx +++ b/src/components/wrappers/dashboard/organization/delete-organization/delete-organization-button.tsx @@ -6,6 +6,7 @@ import {useRouter} from "next/navigation"; import {toast} from "sonner"; import {authClient} from "@/lib/auth/auth-client"; import {Trash2} from "lucide-react"; +import {useIsMobile} from "@/hooks/use-mobile"; export type DeleteOrganizationButtonProps = { organizationSlug: string; @@ -13,6 +14,7 @@ export type DeleteOrganizationButtonProps = { export const DeleteOrganizationButton = (props: DeleteOrganizationButtonProps) => { const router = useRouter(); + const isMobile = useIsMobile(); const {data: organizations, refetch} = authClient.useListOrganizations(); const mutation = useMutation({ @@ -47,7 +49,7 @@ export const DeleteOrganizationButton = (props: DeleteOrganizationButtonProps) = description="Are you sure you want to remove this organization? This action cannot be undone." button={{ main: { - text: "Delete Organization", + text: !isMobile ? "Delete Organization" : "", variant: "outline", icon: , }, diff --git a/src/components/wrappers/dashboard/projects/project-card/project-database-card.tsx b/src/components/wrappers/dashboard/projects/project-card/project-database-card.tsx index 8e8c1256..c7399e7c 100644 --- a/src/components/wrappers/dashboard/projects/project-card/project-database-card.tsx +++ b/src/components/wrappers/dashboard/projects/project-card/project-database-card.tsx @@ -19,8 +19,9 @@ export const ProjectDatabaseCard = (props: projectDatabaseCardProps) => { const {data: database, extendedProps: extendedProps} = props; return ( - + ); @@ -28,10 +29,11 @@ export const ProjectDatabaseCard = (props: projectDatabaseCardProps) => { export type databaseCardProps = { data: Database; + withDetails?: boolean; }; export const DatabaseCard = (props: databaseCardProps) => { - const {data: database} = props; + const {data: database, withDetails = true} = props; const [isCopied, setIsCopied] = useState(false); const handleCopy = (e: React.MouseEvent) => { @@ -43,13 +45,15 @@ export const DatabaseCard = (props: databaseCardProps) => { }; return ( - +
-
- + {`${database.dbms} @@ -60,16 +64,17 @@ export const DatabaseCard = (props: databaseCardProps) => {
- +

{database.name}

- +
-
+
- +
{database.agentDatabaseId} @@ -79,12 +84,14 @@ export const DatabaseCard = (props: databaseCardProps) => { className="ml-1 p-0.5 hover:bg-muted rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 z-10" title="Copy ID" > - {isCopied ? : } + {isCopied ? : + }
-
+
- +
{formatDateLastContact(database.lastContact)} @@ -92,14 +99,19 @@ export const DatabaseCard = (props: databaseCardProps) => {
- -
- Open -
- Details - + + {withDetails && ( +
+ Open +
+ Details + +
-
+ )} ); };