fix: responsive in project details.

This commit is contained in:
charlesgauthereau
2026-01-11 10:59:42 +01:00
parent 419b6d4891
commit a03a1d635f
2 changed files with 36 additions and 13 deletions
@@ -15,6 +15,11 @@ import {eq} from "drizzle-orm";
import {getActiveMember, getOrganization} from "@/lib/auth/auth"; import {getActiveMember, getOrganization} from "@/lib/auth/auth";
import * as drizzleDb from "@/db"; import * as drizzleDb from "@/db";
import {capitalizeFirstLetter} from "@/utils/text"; import {capitalizeFirstLetter} from "@/utils/text";
import {RetentionPolicySheet} from "@/components/wrappers/dashboard/database/retention-policy/retention-policy-sheet";
import {CronButton} from "@/components/wrappers/dashboard/database/cron-button/cron-button";
import {AlertPolicyModal} from "@/components/wrappers/dashboard/database/alert-policy/alert-policy-modal";
import {ImportModal} from "@/components/wrappers/dashboard/database/import/import-modal";
import {BackupButton} from "@/components/wrappers/dashboard/backup/backup-button/backup-button";
export default async function RoutePage(props: PageParams<{ export default async function RoutePage(props: PageParams<{
projectId: string projectId: string
@@ -55,22 +60,37 @@ export default async function RoutePage(props: PageParams<{
return ( return (
<Page> <Page>
<div className="justify-between gap-2 sm:flex"> <div className="justify-between gap-2 sm:flex">
<PageTitle className="flex items-center"> <PageTitle className="flex flex-col md:flex-row items-center justify-between w-full ">
{capitalizeFirstLetter(proj.name)} <div className="min-w-full md:min-w-fit ">
{capitalizeFirstLetter(proj.name)}
</div>
{!isMember && ( {!isMember && (
<Link className={buttonVariants({variant: "outline"})} <div className="flex items-center gap-2 md:justify-between w-full ">
href={`/dashboard/projects/${proj.id}/edit`}> <div className="flex items-center gap-2">
<GearIcon className="w-7 h-7"/> <Link className={buttonVariants({variant: "outline"})}
</Link> href={`/dashboard/projects/${proj.id}/edit`}>
<GearIcon className="w-7 h-7"/>
</Link>
</div>
<div className="flex items-center gap-2">
<ButtonDeleteProject projectId={projectId} text={"Delete Project"}/>
</div>
</div>
)} )}
</PageTitle> </PageTitle>
{!isMember && (
<PageActions className="justify-between">
<ButtonDeleteProject projectId={projectId} text={"Delete Project"}/>
</PageActions>
)}
</div> </div>
<PageDescription>The list of associated databases</PageDescription>
<PageContent className="flex flex-col w-full h-full"> <PageContent className="flex flex-col w-full h-full">
{proj.databases.length > 0 ? ( {proj.databases.length > 0 ? (
<CardsWithPagination <CardsWithPagination
@@ -8,6 +8,7 @@ import {
} from "@/components/wrappers/dashboard/projects/button-delete-project/delete-project.action"; } from "@/components/wrappers/dashboard/projects/button-delete-project/delete-project.action";
import {useRouter} from "next/navigation"; import {useRouter} from "next/navigation";
import {toast} from "sonner"; import {toast} from "sonner";
import {useIsMobile} from "@/hooks/use-mobile";
export type ButtonDeleteProjectProps = { export type ButtonDeleteProjectProps = {
text?: string; text?: string;
@@ -16,6 +17,8 @@ export type ButtonDeleteProjectProps = {
export const ButtonDeleteProject = (props: ButtonDeleteProjectProps) => { export const ButtonDeleteProject = (props: ButtonDeleteProjectProps) => {
const router = useRouter(); const router = useRouter();
const isMobile = useIsMobile()
const mutation = useMutation({ const mutation = useMutation({
mutationFn: () => deleteProjectAction(props.projectId), mutationFn: () => deleteProjectAction(props.projectId),
onSuccess: async (result: any) => { onSuccess: async (result: any) => {
@@ -35,7 +38,7 @@ export const ButtonDeleteProject = (props: ButtonDeleteProjectProps) => {
description="Are you sure you want to delete this project ? This action cannot be undone." description="Are you sure you want to delete this project ? This action cannot be undone."
button={{ button={{
main: { main: {
text: props.text ? props.text : "", text: props.text ? !isMobile ? props.text: "" : "",
variant: "outline", variant: "outline",
icon: <Trash2 color="red"/>, icon: <Trash2 color="red"/>,
}, },