diff --git a/apps/clients/src/pages/ClientTabloPage.test.tsx b/apps/clients/src/pages/ClientTabloPage.test.tsx index 8380d98..4055037 100644 --- a/apps/clients/src/pages/ClientTabloPage.test.tsx +++ b/apps/clients/src/pages/ClientTabloPage.test.tsx @@ -102,9 +102,24 @@ describe("ClientTabloPage parity shell", () => { expect(screen.getByText("Client Project")).toBeInTheDocument(); expect(screen.getAllByRole("button", { name: "Discussion" })).toHaveLength(2); - expect(screen.getByText("Rôle :")).toBeInTheDocument(); - expect(screen.getByText("Créé le :")).toBeInTheDocument(); - expect(screen.getByText("Progression :")).toBeInTheDocument(); + expect(screen.getAllByText("Rôle").length).toBeGreaterThan(0); + expect(screen.getAllByText("Créé le").length).toBeGreaterThan(0); + expect(screen.getAllByText("Progression").length).toBeGreaterThan(0); + }); + + it("keeps the shared main-app header labels even when the client locale is english", () => { + renderWithProviders(, { + route: "/tablo/tablo-1", + path: "/tablo/:tabloId", + language: "en", + }); + + expect(screen.getAllByText("Rôle").length).toBeGreaterThan(0); + expect(screen.getAllByText("Créé le").length).toBeGreaterThan(0); + expect(screen.getAllByText("Progression").length).toBeGreaterThan(0); + expect(screen.queryByText("Role")).not.toBeInTheDocument(); + expect(screen.queryByText("Created on")).not.toBeInTheDocument(); + expect(screen.queryByText("Progress")).not.toBeInTheDocument(); }); it("keeps client restrictions by hiding invite and layout-edit controls", () => { diff --git a/apps/clients/src/pages/ClientTabloPage.tsx b/apps/clients/src/pages/ClientTabloPage.tsx index 0f536d4..aaeb3eb 100644 --- a/apps/clients/src/pages/ClientTabloPage.tsx +++ b/apps/clients/src/pages/ClientTabloPage.tsx @@ -4,31 +4,15 @@ import { buildApi } from "@xtablo/shared"; import { useSession } from "@xtablo/shared/contexts/SessionContext"; import type { Etape, KanbanTask, TabloFolder, UserTablo } from "@xtablo/shared-types"; import { - CalendarIcon, - Compass, - Flame, FolderIcon, - Gem, - Heart, - KanbanIcon, - LayoutDashboardIcon, - Leaf, - ListChecksIcon, - MapIcon, - MessageCircleIcon, - Sparkles, - Star, - Sun, - Waves, - Zap, } from "lucide-react"; import { useState } from "react"; -import { useTranslation } from "react-i18next"; import { useParams } from "react-router-dom"; import { EtapesSection, RoadmapSection, - TabloDetailsShell, + SingleTabloView, + type SingleTabloTabId, TabloDiscussionSection, TabloEventsSection, TabloFilesSection, @@ -158,43 +142,6 @@ function useClientTabloFolders(tabloId: string, accessToken: string | undefined) }); } -function getTabloIcon(color: string | null | undefined) { - switch (color) { - case "bg-blue-500": - return Zap; - case "bg-green-500": - return Leaf; - case "bg-purple-500": - return Gem; - case "bg-red-500": - return Flame; - case "bg-yellow-500": - return Star; - case "bg-indigo-500": - return Compass; - case "bg-pink-500": - return Heart; - case "bg-teal-500": - return Waves; - case "bg-orange-500": - return Sun; - case "bg-cyan-500": - return Sparkles; - default: - return FolderIcon; - } -} - -function getTabloIconColor(color: string | null | undefined): string { - switch (color) { - case "bg-yellow-500": - case "bg-cyan-500": - return "text-gray-700"; - default: - return "text-white"; - } -} - function getStatusConfig(status: string) { switch (status) { case "in_progress": @@ -238,27 +185,12 @@ function getEtapeProgressStats(etapes: Etape[]) { }; } -// ─── Tabs ───────────────────────────────────────────────────────────────────── - -type TabId = "overview" | "etapes" | "tasks" | "files" | "discussion" | "events" | "roadmap"; - -const TABS: { id: TabId; label: string; icon: React.ElementType }[] = [ - { id: "overview", label: "Aperçu", icon: LayoutDashboardIcon }, - { id: "etapes", label: "Étapes", icon: ListChecksIcon }, - { id: "tasks", label: "Tâches", icon: KanbanIcon }, - { id: "files", label: "Fichiers", icon: FolderIcon }, - { id: "discussion", label: "Discussion", icon: MessageCircleIcon }, - { id: "events", label: "Événements", icon: CalendarIcon }, - { id: "roadmap", label: "Roadmap", icon: MapIcon }, -]; - // ─── Page ───────────────────────────────────────────────────────────────────── export function ClientTabloPage() { - const { t } = useTranslation(["pages", "chat"]); const { tabloId } = useParams<{ tabloId: string }>(); const { session } = useSession(); - const [activeTab, setActiveTab] = useState("overview"); + const [activeTab, setActiveTab] = useState("overview"); const accessToken = session?.access_token; const currentUserId = session?.user.id ?? ""; @@ -293,93 +225,17 @@ export function ClientTabloPage() { const { label: statusLabel, badgeClass } = getStatusConfig(tablo.status); const progress = getEtapeProgressStats(etapes); - const isDiscussionView = activeTab === "discussion"; - const TabloIcon = getTabloIcon(tablo.color); - const iconColor = getTabloIconColor(tablo.color); - - const metadata = [ - { - key: "role", - label: t("pages:tablo.details.roleLabel"), - value: ( - {t("pages:tablo.role.guest")} - ), - }, - { - key: "created-at", - label: t("pages:tablo.details.createdAtLabel"), - value: ( - - {new Intl.DateTimeFormat("fr-FR", { - year: "numeric", - month: "short", - day: "2-digit", - }).format(new Date(tablo.created_at))} - - ), - }, - { - key: "status", - label: t("pages:tablo.details.statusLabel"), - value: {statusLabel}, - }, - { - key: "progress", - label: t("pages:tablo.details.progressLabel"), - value: ( - <> -
-
-
-
- {progress.donePercentage}% - - ), - }, - ]; - - const headerVisual = ( -
- {tablo.image ? ( - {tablo.name} - ) : ( - - )} -
- ); - - const headerActions = ( - - ); return ( - setActiveTab(tabId as TabId)} - isDiscussionView={isDiscussionView} + onTabChange={setActiveTab} + discussionAction={{ kind: "button", onClick: () => setActiveTab("discussion") }} > {activeTab === "overview" && (
@@ -464,7 +320,7 @@ export function ClientTabloPage() {
Rôle
-
{t("pages:tablo.role.guest")}
+
Invité
@@ -540,6 +396,6 @@ export function ClientTabloPage() { onTaskStatusChange={() => {}} /> )} - + ); }