Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
refactor(invitations): one invitations page; the switcher links to it (MUL-8997) (#10339)
Jiayuan Zhang828bc83ee3c7
diff --git a/apps/desktop/src/renderer/src/App.tsx b/apps/desktop/src/renderer/src/App.tsxindex 46de05b822..973a5fa0ee 100644--- a/apps/desktop/src/renderer/src/App.tsx+++ b/apps/desktop/src/renderer/src/App.tsx@@ -142,12 +142,12 @@ function AppContent() {// Listen for invite IDs delivered via deep link (multica://invite/<id>).// We open the overlay regardless of login state — if the user isn't logged- // in, InvitePage's queries will fail and render the "not found" state,+ // in, InvitationsPage's queries will fail and render the "not found" state,// which is acceptable; the expected pre-flight happens in the web app// (login + next=/invite/... dance) before the deep link is ever dispatched.useEffect(() => {return window.desktopAPI.onInviteOpen((invitationId) => {- useWindowOverlayStore.getState().open({ type: "invite", invitationId });+ useWindowOverlayStore.getState().open({ type: "invitations", invitationId });});}, []);diff --git a/apps/desktop/src/renderer/src/components/window-overlay.tsx b/apps/desktop/src/renderer/src/components/window-overlay.tsxindex 67bb1e9a5a..c37501f1bd 100644--- a/apps/desktop/src/renderer/src/components/window-overlay.tsx+++ b/apps/desktop/src/renderer/src/components/window-overlay.tsx@@ -1,5 +1,4 @@import { useQuery } from "@tanstack/react-query";-import { InvitePage } from "@multica/views/invite";import { InvitationsPage } from "@multica/views/invitations";import { OnboardingFlow } from "@multica/views/onboarding";import { useNavigation } from "@multica/views/navigation";@@ -16,7 +15,7 @@ import { useLocalRuntimesPending } from "../platform/use-local-runtimes-pending"* This component is intentionally thin — just a fixed positioning shell* that covers the tab system. It does NOT hide traffic lights or provide* a drag strip: each contained view (OnboardingFlow, NewWorkspacePage,- * InvitePage) renders its own `<DragStrip />` as a flex-child at top so+ * InvitationsPage) renders its own `<DragStrip />` as a flex-child at top so* native macOS traffic lights stay visible and the page content can fill* the window edge-to-edge. This matches the Linear/Notion/Arc pattern for* pre-dashboard flows and keeps platform chrome consistent across every@@ -79,13 +78,12 @@ function WindowOverlayInner() {}}/>)}- {overlay.type === "invite" && (- <InvitePage+ {overlay.type === "invitations" && (+ <InvitationsPageinvitationId={overlay.invitationId}onBack={onBack}/>)}- {overlay.type === "invitations" && <InvitationsPage />}{overlay.type === "onboarding" && (<OnboardingFlowonComplete={(ws, destination) => {diff --git a/apps/desktop/src/renderer/src/platform/diagnostic-route-reporter.tsx b/apps/desktop/src/renderer/src/platform/diagnostic-route-reporter.tsxindex b21216c1d8..530658ecb1 100644--- a/apps/desktop/src/renderer/src/platform/diagnostic-route-reporter.tsx+++ b/apps/desktop/src/renderer/src/platform/diagnostic-route-reporter.tsx@@ -99,9 +99,7 @@ function overlayPath(overlay: WindowOverlay): string {return "/workspaces/new";case "onboarding":return "/onboarding";- case "invite":- return `/invite/${overlay.invitationId}`;case "invitations":- return "/invitations";+ return overlay.invitationId ? `/invite/${overlay.invitationId}` : "/invitations";}}diff --git a/apps/desktop/src/renderer/src/platform/navigation.tsx b/apps/desktop/src/renderer/src/platform/navigation.tsxindex 937a4c4780..0381e0e8d8 100644--- a/apps/desktop/src/renderer/src/platform/navigation.tsx+++ b/apps/desktop/src/renderer/src/platform/navigation.tsx@@ -62,7 +62,7 @@ function tryRouteToOverlay(path: string): boolean {return true;}if (id) {- overlay.open({ type: "invite", invitationId: id });+ overlay.open({ type: "invitations", invitationId: id });return true;}}diff --git a/apps/desktop/src/renderer/src/stores/window-overlay-store.ts b/apps/desktop/src/renderer/src/stores/window-overlay-store.tsindex 78aefe0512..3710281ed5 100644--- a/apps/desktop/src/renderer/src/stores/window-overlay-store.ts+++ b/apps/desktop/src/renderer/src/stores/window-overlay-store.ts@@ -14,8 +14,7 @@ import { create } from "zustand";*/export type WindowOverlay =| { type: "new-workspace" }- | { type: "invite"; invitationId: string }- | { type: "invitations" }+ | { type: "invitations"; invitationId?: string }| { type: "onboarding" };interface WindowOverlayStore {diff --git a/apps/web/app/(auth)/invitations/page.tsx b/apps/web/app/(auth)/invitations/page.tsxindex 54efecad1f..1f14347a74 100644--- a/apps/web/app/(auth)/invitations/page.tsx+++ b/apps/web/app/(auth)/invitations/page.tsx@@ -2,14 +2,20 @@import { useEffect } from "react";import { useRouter } from "next/navigation";+import { useQuery } from "@tanstack/react-query";import { useAuthStore } from "@multica/core/auth";import { paths } from "@multica/core/paths";+import { workspaceListOptions } from "@multica/core/workspace/queries";import { InvitationsPage } from "@multica/views/invitations";export default function InvitationsRoutePage() {const router = useRouter();const user = useAuthStore((s) => s.user);const isLoading = useAuthStore((s) => s.isLoading);+ const { data: wsList = [] } = useQuery({+ ...workspaceListOptions(),+ enabled: !!user,+ });// Unauthenticated users have nowhere meaningful to land here — kick them// through login and bring them back. The login page will eventually run@@ -24,5 +30,8 @@ export default function InvitationsRoutePage() {if (isLoading || !user) return null;- return <InvitationsPage />;+ const onBack =+ wsList.length > 0 ? () => router.push(paths.root()) : undefined;++ return <InvitationsPage onBack={onBack} />;}diff --git a/apps/web/app/(auth)/invite/[id]/page.tsx b/apps/web/app/(auth)/invite/[id]/page.tsxindex c26bc2328e..a35ed906a5 100644--- a/apps/web/app/(auth)/invite/[id]/page.tsx+++ b/apps/web/app/(auth)/invite/[id]/page.tsx@@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query";import { useAuthStore } from "@multica/core/auth";import { paths } from "@multica/core/paths";import { workspaceListOptions } from "@multica/core/workspace/queries";-import { InvitePage } from "@multica/views/invite";+import { InvitationsPage } from "@multica/views/invitations";export default function InviteAcceptPage() {const router = useRouter();@@ -32,5 +32,5 @@ export default function InviteAcceptPage() {const onBack =wsList.length > 0 ? () => router.push(paths.root()) : undefined;- return <InvitePage invitationId={params.id} onBack={onBack} />;+ return <InvitationsPage invitationId={params.id} onBack={onBack} />;}diff --git a/packages/views/invitations/invitations-page.test.tsx b/packages/views/invitations/invitations-page.test.tsxindex 442fa9ac31..abe6874b90 100644--- a/packages/views/invitations/invitations-page.test.tsx+++ b/packages/views/invitations/invitations-page.test.tsx@@ -1,27 +1,42 @@import { describe, expect, it, vi, beforeEach } from "vitest";-import { render, screen, waitFor, fireEvent } from "@testing-library/react";+import { render, screen, waitFor, fireEvent, within } from "@testing-library/react";import {QueryClient,QueryClientProvider,} from "@tanstack/react-query";const {+ auth,navigate,logout,refreshMe,+ setUser,acceptInvitation,+ declineInvitation,+ getInvitation,markOnboardingComplete,listMyInvitations,listWorkspaces,-} = vi.hoisted(() => ({- navigate: vi.fn(),- logout: vi.fn(),- refreshMe: vi.fn(),- acceptInvitation: vi.fn(),- markOnboardingComplete: vi.fn(),- listMyInvitations: vi.fn(),- listWorkspaces: vi.fn(),-}));+} = vi.hoisted(() => {+ const auth = { user: null as { onboarded_at: string | null } | null };+ return {+ auth,+ navigate: vi.fn(),+ logout: vi.fn(),+ refreshMe: vi.fn(),+ setUser: vi.fn((user: { onboarded_at: string | null }) => {+ auth.user = user;+ }),+ acceptInvitation: vi.fn(),+ declineInvitation: vi.fn(),+ getInvitation: vi.fn(),+ markOnboardingComplete: vi.fn(),+ listMyInvitations: vi.fn(),+ listWorkspaces: vi.fn(),+ };+});++const ONBOARDED = { onboarded_at: "2026-11-10T00:00:00Z" };// Mocked at the context module rather than the barrel so <AppLink> stays the// real component and its click contract is what the test exercises.@@ -40,18 +55,21 @@ vi.mock("../platform", () => ({vi.mock("@multica/core/auth", () => ({useAuthStore: Object.assign((selector?: (s: unknown) => unknown) => {- const state = { refreshMe };+ const state = { user: auth.user, refreshMe, setUser };return selector ? selector(state) : state;},{- getState: () => ({ refreshMe }),+ getState: () => ({ user: auth.user, refreshMe, setUser }),},),}));vi.mock("@multica/core/api", () => ({api: {+ getBaseUrl: () => "http://127.0.0.1:8080",acceptInvitation,+ declineInvitation,+ getInvitation,markOnboardingComplete,listMyInvitations,listWorkspaces,@@ -61,21 +79,22 @@ vi.mock("@multica/core/api", () => ({import { I18nProvider } from "@multica/core/i18n/react";import enCommon from "../locales/en/common.json";import enInvite from "../locales/en/invite.json";-import { InvitationsPage } from "./invitations-page";+import { InvitationsPage, type InvitationsPageProps } from "./invitations-page";const TEST_RESOURCES = { en: { common: enCommon, invite: enInvite } };-function renderWithClient(client: QueryClient = new QueryClient()) {+function renderPage(props: InvitationsPageProps = {}) {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });return render(<I18nProvider locale="en" resources={TEST_RESOURCES}><QueryClientProvider client={client}>- <InvitationsPage />+ <InvitationsPage {...props} /></QueryClientProvider></I18nProvider>,);}-const mkInvite = (id: string, wsId: string, wsName: string) => ({+const mkInvite = (id: string, wsId: string, wsName: string, overrides = {}) => ({id,workspace_id: wsId,inviter_id: "u-2",@@ -85,9 +104,10 @@ const mkInvite = (id: string, wsId: string, wsName: string) => ({status: "pending" as const,created_at: "",updated_at: "",- expires_at: "",+ expires_at: "2999-01-01T00:00:00Z",workspace_name: wsName,inviter_name: "Alice",+ ...overrides,});const mkWs = (id: string, slug: string) => ({@@ -104,78 +124,181 @@ const mkWs = (id: string, slug: string) => ({updated_at: "",});+const row = (name: string) => screen.getByText(name).closest("li")!;+describe("InvitationsPage", () => {beforeEach(() => {- navigate.mockReset();- logout.mockReset();- refreshMe.mockReset();- acceptInvitation.mockReset();- markOnboardingComplete.mockReset();- listMyInvitations.mockReset();- listWorkspaces.mockReset();- refreshMe.mockResolvedValue(undefined);+ vi.clearAllMocks();+ auth.user = { onboarded_at: null };+ refreshMe.mockImplementation(async () => {+ auth.user = ONBOARDED;+ });acceptInvitation.mockResolvedValue({});- markOnboardingComplete.mockResolvedValue({});+ declineInvitation.mockResolvedValue(undefined);+ markOnboardingComplete.mockResolvedValue(ONBOARDED);+ listWorkspaces.mockResolvedValue([]);});- it("renders pending invitations with workspace names", async () => {+ it("lists every pending invitation with its own actions and a skip link", async () => {listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme"),mkInvite("inv-2", "ws-2", "Beta Corp"),]);- renderWithClient();- await waitFor(() => {- expect(screen.getByText("Acme")).toBeInTheDocument();- expect(screen.getByText("Beta Corp")).toBeInTheDocument();- });- });-- it("with no selections, submitting routes to /onboarding", async () => {- listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme")]);- renderWithClient();+ renderPage();await waitFor(() => screen.getByText("Acme"));- fireEvent.click(screen.getByRole("button", { name: /skip/i }));+ expect(within(row("Acme")).getByRole("button", { name: "Join" })).toBeInTheDocument();+ expect(within(row("Beta Corp")).getByRole("button", { name: "Decline" })).toBeInTheDocument();++ fireEvent.click(screen.getByRole("link", { name: /skip/i }));expect(navigate).toHaveBeenCalledWith("/onboarding");- // Empty submit doesn't accept anything or touch onboarding state.expect(acceptInvitation).not.toHaveBeenCalled();- expect(markOnboardingComplete).not.toHaveBeenCalled();});- it("accepts selected invitations, marks onboarded, navigates to first ws", async () => {+ it("joining a row accepts it, marks onboarded, and enters that workspace", async () => {listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme"),mkInvite("inv-2", "ws-2", "Beta"),]);listWorkspaces.mockResolvedValue([mkWs("ws-1", "acme"), mkWs("ws-2", "beta")]);- renderWithClient();+ renderPage();+ await waitFor(() => screen.getByText("Beta"));- await waitFor(() => screen.getByText("Acme"));- // Select Acme via its label/checkbox row.- fireEvent.click(screen.getByText("Acme"));-- fireEvent.click(screen.getByRole("button", { name: /join 1 workspace/i }));+ fireEvent.click(within(row("Beta")).getByRole("button", { name: "Join" }));await waitFor(() => {- expect(acceptInvitation).toHaveBeenCalledWith("inv-1");+ expect(acceptInvitation).toHaveBeenCalledWith("inv-2");expect(markOnboardingComplete).toHaveBeenCalledWith({completion_path: "invite_accept",- workspace_id: "ws-1",+ workspace_id: "ws-2",});- expect(refreshMe).toHaveBeenCalled();- expect(navigate).toHaveBeenCalledWith("/acme/issues");+ expect(navigate).toHaveBeenCalledWith("/beta/issues");});+ expect(acceptInvitation).toHaveBeenCalledTimes(1);+ expect(auth.user?.onboarded_at).toBe(ONBOARDED.onboarded_at);});- it("empty list falls through to onboarding via Continue button", async () => {+ // The workspace layout sends an un-onboarded local user back to onboarding,+ // so the store must hold the onboarded user before navigating.+ it("onboards the local user from the mark response, without a separate refresh", async () => {+ listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme")]);+ listWorkspaces.mockResolvedValue([mkWs("ws-1", "acme")]);+ refreshMe.mockRejectedValue(new Error("network"));+ renderPage();+ await waitFor(() => screen.getByText("Acme"));++ fireEvent.click(within(row("Acme")).getByRole("button", { name: "Join" }));++ await waitFor(() => expect(navigate).toHaveBeenCalledWith("/acme/issues"));+ expect(auth.user?.onboarded_at).toBe(ONBOARDED.onboarded_at);+ expect(refreshMe).not.toHaveBeenCalled();+ });++ it("falls back to refreshing the user when recording onboarding fails", async () => {+ listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme")]);+ listWorkspaces.mockResolvedValue([mkWs("ws-1", "acme")]);+ markOnboardingComplete.mockRejectedValue(new Error("boom"));+ renderPage();+ await waitFor(() => screen.getByText("Acme"));++ fireEvent.click(within(row("Acme")).getByRole("button", { name: "Join" }));++ await waitFor(() => expect(navigate).toHaveBeenCalledWith("/acme/issues"));+ expect(refreshMe).toHaveBeenCalled();+ expect(auth.user?.onboarded_at).toBe(ONBOARDED.onboarded_at);+ expect(screen.queryByText("boom")).toBeNull();+ });++ it("declining a row drops it and keeps the user on the page", async () => {+ listMyInvitations+ .mockResolvedValueOnce([mkInvite("inv-1", "ws-1", "Acme"), mkInvite("inv-2", "ws-2", "Beta")])+ .mockResolvedValue([mkInvite("inv-2", "ws-2", "Beta")]);+ renderPage();+ await waitFor(() => screen.getByText("Acme"));++ fireEvent.click(within(row("Acme")).getByRole("button", { name: "Decline" }));++ await waitFor(() => expect(screen.queryByText("Acme")).toBeNull());+ expect(declineInvitation).toHaveBeenCalledWith("inv-1");+ expect(screen.getByText("Beta")).toBeInTheDocument();+ expect(navigate).not.toHaveBeenCalled();+ });++ // The invitation was concluded on another surface while this row was on+ // screen: show why, and refetch so the stale row drops.+ it("a failed join surfaces the error and refetches the pending list", async () => {+ listMyInvitations+ .mockResolvedValueOnce([mkInvite("inv-1", "ws-1", "Acme"), mkInvite("inv-2", "ws-2", "Beta")])+ .mockResolvedValue([mkInvite("inv-2", "ws-2", "Beta")]);+ acceptInvitation.mockRejectedValue(new Error("invitation is not pending"));+ renderPage();+ await waitFor(() => screen.getByText("Acme"));++ fireEvent.click(within(row("Acme")).getByRole("button", { name: "Join" }));++ await waitFor(() => expect(screen.getByText("invitation is not pending")).toBeInTheDocument());+ await waitFor(() => expect(screen.queryByText("Acme")).toBeNull());+ expect(navigate).not.toHaveBeenCalled();+ expect(markOnboardingComplete).not.toHaveBeenCalled();+ });++ it("pins and highlights the linked invitation for an onboarded user", async () => {+ auth.user = { onboarded_at: "2026-01-01T00:00:00Z" };+ const linked = mkInvite("inv-2", "ws-2", "Beta");+ listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme"), linked]);+ getInvitation.mockResolvedValue(linked);+ listWorkspaces.mockResolvedValue([mkWs("ws-0", "home"), mkWs("ws-2", "beta")]);+ renderPage({ invitationId: "inv-2", onBack: vi.fn() });+ await waitFor(() => screen.getByText("Beta"));++ const items = screen.getAllByRole("listitem");+ expect(within(items[0]!).getByText("Beta")).toBeInTheDocument();+ expect(items[0]).toHaveAttribute("aria-current", "true");+ expect(items[1]).not.toHaveAttribute("aria-current");+ expect(screen.getByRole("button", { name: "Back" })).toBeInTheDocument();+ expect(screen.queryByRole("link", { name: /skip/i })).toBeNull();++ fireEvent.click(within(items[0]!).getByRole("button", { name: "Join" }));+ await waitFor(() => expect(navigate).toHaveBeenCalledWith("/beta/issues"));+ expect(markOnboardingComplete).not.toHaveBeenCalled();+ });++ it("explains a linked invitation that can no longer be joined above the others", async () => {+ listMyInvitations.mockResolvedValue([mkInvite("inv-1", "ws-1", "Acme")]);+ getInvitation.mockResolvedValue(mkInvite("inv-9", "ws-9", "Gone", { status: "declined" }));+ renderPage({ invitationId: "inv-9" });++ await waitFor(() =>+ expect(screen.getByText("This invitation has already been declined.")).toBeInTheDocument(),+ );+ expect(screen.getByText("Acme")).toBeInTheDocument();+ });++ it("sends an onboarded user with nothing left to join back to the dashboard", async () => {+ auth.user = { onboarded_at: "2026-01-01T00:00:00Z" };listMyInvitations.mockResolvedValue([]);- renderWithClient();+ getInvitation.mockRejectedValue(new Error("invitation does not belong to you"));+ listWorkspaces.mockResolvedValue([mkWs("ws-0", "home")]);+ renderPage({ invitationId: "inv-9" });await waitFor(() =>- screen.getByRole("button", { name: /continue to setup/i }),+ expect(screen.getByText(/doesn't belong to your account/)).toBeInTheDocument(),+ );+ await waitFor(() =>+ expect(screen.getByRole("button", { name: "Go to dashboard" })).toHaveAttribute(+ "href",+ "/home/issues",+ ),);- fireEvent.click(+ });++ it("empty list falls through to onboarding via Continue button", async () => {+ listMyInvitations.mockResolvedValue([]);+ renderPage();++ await waitFor(() =>screen.getByRole("button", { name: /continue to setup/i }),);+ fireEvent.click(screen.getByRole("button", { name: /continue to setup/i }));expect(navigate).toHaveBeenCalledWith("/onboarding");});});diff --git a/packages/views/invitations/invitations-page.tsx b/packages/views/invitations/invitations-page.tsxindex 20f4efa196..e856c0d7c2 100644--- a/packages/views/invitations/invitations-page.tsx+++ b/packages/views/invitations/invitations-page.tsx@@ -1,145 +1,75 @@"use client";import { useState, type ReactNode } from "react";-import { useQuery, useQueryClient } from "@tanstack/react-query";+import { useQuery } from "@tanstack/react-query";import { api } from "@multica/core/api";-import { useAuthStore } from "@multica/core/auth";import {myInvitationListOptions,- workspaceKeys,workspaceListOptions,} from "@multica/core/workspace/queries";-import { paths } from "@multica/core/paths";+import {+ paths,+ resolvePostAuthDestination,+ useHasOnboarded,+} from "@multica/core/paths";import type { Invitation } from "@multica/core/types";-import { AppLink, useNavigation } from "../navigation";+import { AppLink } from "../navigation";import { useLogout } from "../auth";import { DragStrip } from "../platform";import { useT } from "../i18n";+import { WorkspaceAvatar } from "../workspace/workspace-avatar";+import { useInvitationActions } from "./use-invitation-actions";import { Button } from "@multica/ui/components/ui/button";import { Card, CardContent } from "@multica/ui/components/ui/card";-import { Checkbox } from "@multica/ui/components/ui/checkbox";import { Skeleton } from "@multica/ui/components/ui/skeleton";-import { LogOut, Mail, Users } from "@multica/ui/icons";+import { cn } from "@multica/ui/lib/utils";+import { ArrowLeft, LogOut, Mail, Users } from "@multica/ui/icons";++export interface InvitationsPageProps {+ /**+ * The invitation the user followed a link for (`/invite/:id`). It is pinned+ * to the top and highlighted; when it can no longer be joined, the page+ * says why above the remaining invitations.+ */+ invitationId?: string;+ /**+ * Optional "go back" handler. Callers pass it only when there's somewhere+ * to go (the user has a workspace). Otherwise Log out is the only exit.+ */+ onBack?: () => void;+}/**- * Batch invitation handling page for first-contact users who land here- * because callback / login detected pending invitations on their email.+ * The one place to answer workspace invitations before entering a+ * workspace. Shared between web (`/invitations`, `/invite/[id]`) and the+ * desktop window overlay.*- * Design:- * - This route is only reachable for un-onboarded users (the entry-point- * judgment in callback/login routes already-onboarded users straight- * into their workspace; new invites for those users surface in the- * sidebar's pending-invitations dropdown instead).- * - The user picks zero or more invitations to accept. "Submit" then:- * • zero selected → continue to /onboarding- * • ≥1 selected → accept each, mark onboarding complete, navigate- * into the first accepted workspace.- * - Unselected invitations are intentionally left as `pending` in the DB.- * The user can later decline them from the sidebar; we don't auto-decline- * here because closing/refreshing this page should not be a destructive- * action.+ * Each invitation is joined or declined on its own row. Joining navigates+ * into that workspace; the rest stay pending and remain reachable from the+ * workspace switcher. Un-onboarded users also get a way to skip to+ * onboarding — leaving this page never declines anything.*/-export function InvitationsPage() {+export function InvitationsPage({ invitationId, onBack }: InvitationsPageProps) {const { t } = useT("invite");- const { push } = useNavigation();- const qc = useQueryClient();- const [selected, setSelected] = useState<Set<string>>(new Set());- const [submitting, setSubmitting] = useState(false);+ const hasOnboarded = useHasOnboarded();+ const { accept, decline } = useInvitationActions();const [error, setError] = useState<string | null>(null);- const {- data: invitations,- isLoading,- error: fetchError,- refetch,- } = useQuery(myInvitationListOptions());-- const toggle = (id: string) => {- setSelected((prev) => {- const next = new Set(prev);- if (next.has(id)) next.delete(id);- else next.add(id);- return next;- });- };-- const handleSubmit = async () => {- setError(null);-- // Zero selected: hand off to onboarding. Pending invites stay pending and- // can be picked up later from the sidebar.- if (selected.size === 0) {- push(paths.onboarding());- return;- }-- setSubmitting(true);- const acceptedIds: string[] = [];- try {- for (const id of selected) {- await api.acceptInvitation(id);- acceptedIds.push(id);- }-- const firstAcceptedInvite = invitations?.find(- (inv) => inv.id === acceptedIds[0],- );-- // markOnboardingComplete is a frontend-side belt to the backend braces:- // each AcceptInvitation transaction already sets onboarded_at via- // MarkUserOnboarded, but calling this from the client makes sure the- // returned `User` is freshly written and gives refreshMe something- // canonical to read.- await api.markOnboardingComplete({- completion_path: "invite_accept",- workspace_id: firstAcceptedInvite?.workspace_id,- });- await useAuthStore.getState().refreshMe();-- qc.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- const wsList = await qc.fetchQuery({- ...workspaceListOptions(),- staleTime: 0,- });+ const { data: pending = [], isLoading } = useQuery(myInvitationListOptions());+ // Read once on arrival so the notice explains why a linked invitation is+ // missing from the list; declining it here must not turn into "already+ // declined", so this query is never invalidated by the actions.+ const linked = useQuery({+ queryKey: ["invitation", invitationId],+ queryFn: () => api.getInvitation(invitationId!),+ enabled: !!invitationId,+ staleTime: 0,+ });+ const { data: workspaces = [] } = useQuery(workspaceListOptions());- const targetWs = firstAcceptedInvite- ? wsList.find((w) => w.id === firstAcceptedInvite.workspace_id)- : undefined;-- // If we can't resolve the just-accepted workspace by id (shouldn't- // happen — the backend just inserted the membership and we just- // refetched), fall back to the resolver. Don't blindly route to- // wsList[0]: that could teleport the user into an unrelated old- // workspace they happen to also belong to.- push(- targetWs ? paths.workspace(targetWs.slug).issues() : paths.newWorkspace(),- );- } catch (e) {- setError(- e instanceof Error- ? e.message- : t(($) => $.batch.error_generic),- );- // Partial success: any accepts that landed before the failure ALREADY- // set onboarded_at on the backend (the AcceptInvitation transaction- // is atomic per invite). Refresh local user + workspace state so the- // sidebar reflects the partial accept and the user isn't stuck with a- // stale `onboarded_at == null` view. The next submit is safe — the- // server returns 4xx on re-accept and the catch path will surface that.- if (acceptedIds.length > 0) {- await useAuthStore.getState().refreshMe().catch(() => {});- qc.invalidateQueries({ queryKey: workspaceKeys.list() });- }- qc.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- refetch();- } finally {- setSubmitting(false);- }- };-- if (isLoading) {+ if (isLoading || linked.isLoading) {return (- <InvitationsShell>+ <InvitationsShell onBack={onBack}><Card className="w-full max-w-lg"><CardContent className="flex flex-col gap-4 py-12"><Skeleton className="h-6 w-48" />@@ -152,40 +82,57 @@ export function InvitationsPage() {);}- // Empty / error: send the user on to onboarding so they're never stuck.- // Genuine fetch failure is rare; treating it as "no invites" is safer than- // trapping the user on an error screen they can't act on.- if (fetchError || !invitations || invitations.length === 0) {+ const highlighted = pending.find((inv) => inv.id === invitationId);+ const rows = highlighted+ ? [highlighted, ...pending.filter((inv) => inv.id !== invitationId)]+ : pending;+ const notice =+ invitationId && !highlighted ? linkedNotice(linked.data, linked.isError) : null;+ const busy = accept.isPending || decline.isPending;++ const handleAccept = (invitation: Invitation) => {+ setError(null);+ accept.mutate(invitation, {+ onError: (e) => setError(e instanceof Error ? e.message : t(($) => $.errors.accept_failed)),+ });+ };+ const handleDecline = (invitation: Invitation) => {+ setError(null);+ decline.mutate(invitation, {+ onError: (e) => setError(e instanceof Error ? e.message : t(($) => $.errors.decline_failed)),+ });+ };++ if (rows.length === 0) {return (- <InvitationsShell>+ <InvitationsShell onBack={onBack}><Card className="w-full max-w-md"><CardContent className="flex flex-col items-center gap-4 py-12"><div className="flex h-12 w-12 items-center justify-center rounded-full bg-muted"><Mail className="h-6 w-6 text-muted-foreground" /></div>- <h2 className="text-title font-semibold">{t(($) => $.batch.empty_title)}</h2>- <p className="text-body text-muted-foreground text-center">- {t(($) => $.batch.empty_hint)}- </p>+ <h2 className="text-title font-semibold">{t(($) => $.empty.title)}</h2>+ {(notice || !hasOnboarded) && (+ <p className="text-body text-muted-foreground text-center">+ {notice ? t(($) => $.linked[notice]) : t(($) => $.empty.hint)}+ </p>+ )}<Button- render={<AppLink href={paths.onboarding()} />}+ variant={hasOnboarded ? "outline" : "default"}+ render={<AppLink href={resolvePostAuthDestination(workspaces, hasOnboarded)} />}nativeButton={false}>- {t(($) => $.batch.empty_continue)}+ {hasOnboarded ? t(($) => $.empty.go_to_dashboard) : t(($) => $.empty.continue)}</Button>+ {error && <p className="text-body text-destructive text-center">{error}</p>}</CardContent></Card></InvitationsShell>);}- const submitLabel =- selected.size === 0- ? t(($) => $.batch.submit_skip)- : t(($) => $.batch.submit_join, { count: selected.size });-return (- <InvitationsShell>+ <InvitationsShell onBack={onBack}><Card className="w-full max-w-lg"><CardContent className="flex flex-col gap-6 py-10"><div className="flex flex-col items-center gap-3 text-center">@@ -193,90 +140,147 @@ export function InvitationsPage() {<Users className="h-6 w-6 text-primary" /></div><div className="space-y-1">- <h2 className="text-title-lg font-semibold">- {t(($) => $.batch.title)}- </h2>- <p className="text-body text-muted-foreground">- {t(($) => $.batch.subtitle)}- </p>+ <h2 className="text-title-lg font-semibold">{t(($) => $.list.title)}</h2>+ {rows.length > 1 && (+ <p className="text-body text-muted-foreground">{t(($) => $.list.subtitle)}</p>+ )}</div></div>+ {notice && (+ <p className="rounded-md bg-muted px-4 py-3 text-body text-muted-foreground">+ {t(($) => $.linked[notice])}+ </p>+ )}+<ul className="flex flex-col gap-2">- {invitations.map((inv) => (+ {rows.map((inv) => (<InvitationRowkey={inv.id}invitation={inv}- checked={selected.has(inv.id)}- onToggle={() => toggle(inv.id)}+ highlighted={inv === highlighted}+ primary={!highlighted || inv === highlighted}+ disabled={busy}+ joining={accept.isPending && accept.variables?.id === inv.id}+ declining={decline.isPending && decline.variables?.id === inv.id}+ onAccept={() => handleAccept(inv)}+ onDecline={() => handleDecline(inv)}/>))}</ul>- <Button- className="w-full"- onClick={handleSubmit}- disabled={submitting}- >- {submitting ? t(($) => $.batch.joining) : submitLabel}- </Button>-- {error && (- <p className="text-body text-destructive text-center">{error}</p>+ {!hasOnboarded && (+ <AppLink+ href={paths.onboarding()}+ className="self-center text-body text-muted-foreground hover:text-foreground"+ >+ {t(($) => $.list.skip)}+ </AppLink>)}++ {error && <p className="text-body text-destructive text-center">{error}</p>}</CardContent></Card></InvitationsShell>);}+type LinkedNotice = "not_found" | "accepted" | "declined" | "expired";++/**+ * Why a linked invitation is not among the pending ones. A still-pending,+ * unexpired invitation gets no notice: it was just declined on this page.+ */+function linkedNotice(invitation: Invitation | undefined, failed: boolean): LinkedNotice | null {+ if (failed || !invitation) return "not_found";+ if (invitation.status === "accepted" || invitation.status === "declined") {+ return invitation.status;+ }+ if (invitation.status !== "pending" || Date.parse(invitation.expires_at) <= Date.now()) {+ return "expired";+ }+ return null;+}+function InvitationRow({invitation,- checked,- onToggle,+ highlighted,+ primary,+ disabled,+ joining,+ declining,+ onAccept,+ onDecline,}: {invitation: Invitation;- checked: boolean;- onToggle: () => void;+ highlighted: boolean;+ primary: boolean;+ disabled: boolean;+ joining: boolean;+ declining: boolean;+ onAccept: () => void;+ onDecline: () => void;}) {const { t } = useT("invite");+ const name = invitation.workspace_name ?? t(($) => $.list.workspace_fallback);const inviter =- invitation.inviter_name ||- invitation.inviter_email ||- t(($) => $.batch.row_inviter_fallback);- const roleLine =- invitation.role === "admin"- ? t(($) => $.batch.row_invited_admin, { inviter })- : t(($) => $.batch.row_invited_member, { inviter });+ invitation.inviter_name || invitation.inviter_email || t(($) => $.list.inviter_fallback);return (- <li>- <label- className="flex cursor-pointer items-start gap-3 rounded-md border border-border bg-card p-4 hover:bg-accent/40"- >- <Checkbox- checked={checked}- onCheckedChange={onToggle}- className="mt-1"- />- <div className="flex-1 min-w-0 space-y-1">- <div className="font-medium truncate">- {invitation.workspace_name ?? t(($) => $.batch.row_workspace_fallback)}- </div>- <div className="text-caption text-muted-foreground truncate">- {roleLine}- </div>+ <li+ aria-current={highlighted ? "true" : undefined}+ className={cn(+ "flex items-center gap-3 rounded-md border p-4",+ highlighted ? "border-brand/50 bg-brand/5" : "border-border bg-card",+ )}+ >+ <WorkspaceAvatar name={name} size="lg" className="rounded-md" />+ <div className="min-w-0 flex-1 space-y-1">+ <div className="truncate font-medium">{name}</div>+ <div className="truncate text-caption text-muted-foreground">+ {invitation.role === "admin"+ ? t(($) => $.list.invited_admin, { inviter })+ : t(($) => $.list.invited_member, { inviter })}</div>- </label>+ </div>+ <Button variant="ghost" size="sm" onClick={onDecline} disabled={disabled} aria-busy={declining}>+ {declining ? t(($) => $.list.declining) : t(($) => $.list.decline)}+ </Button>+ <Button+ variant={primary ? "default" : "outline"}+ size="sm"+ onClick={onAccept}+ disabled={disabled}+ aria-busy={joining}+ >+ {joining ? t(($) => $.list.joining) : t(($) => $.list.accept)}+ </Button></li>);}-function InvitationsShell({ children }: { children: ReactNode }) {+function InvitationsShell({+ onBack,+ children,+}: {+ onBack?: () => void;+ children: ReactNode;+}) {const { t } = useT("invite");const logout = useLogout();return (<div className="relative flex min-h-svh flex-col bg-background"><DragStrip />+ {onBack && (+ <Button+ variant="ghost"+ size="sm"+ className="absolute top-16 left-12 text-muted-foreground"+ onClick={onBack}+ >+ <ArrowLeft />+ {t(($) => $.header.back)}+ </Button>+ )}<Buttonvariant="ghost"size="sm"@@ -284,7 +288,7 @@ function InvitationsShell({ children }: { children: ReactNode }) {onClick={logout}><LogOut />- {t(($) => $.batch.log_out)}+ {t(($) => $.header.log_out)}</Button><div className="flex flex-1 flex-col items-center justify-center px-6 pb-12">{children}diff --git a/packages/views/invitations/use-invitation-actions.ts b/packages/views/invitations/use-invitation-actions.tsnew file mode 100644index 0000000000..f9e3e1c01e--- /dev/null+++ b/packages/views/invitations/use-invitation-actions.ts@@ -0,0 +1,69 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { api } from "@multica/core/api";+import { useAuthStore } from "@multica/core/auth";+import { paths, useHasOnboarded } from "@multica/core/paths";+import type { Invitation } from "@multica/core/types";+import {+ workspaceKeys,+ workspaceListOptions,+} from "@multica/core/workspace/queries";+import { useNavigation } from "../navigation";++/**+ * Accept / decline for a pending invitation. The invitations page is the only+ * surface that answers invitations; the workspace switcher links to it.+ */+export function useInvitationActions() {+ const queryClient = useQueryClient();+ const { push } = useNavigation();+ const hasOnboarded = useHasOnboarded();++ const accept = useMutation({+ mutationFn: async (invitation: Invitation) => {+ await api.acceptInvitation(invitation.id);+ // The accept transaction already sets onboarded_at; this records the+ // completion path and brings the local user out of the+ // un-onboarded state before guards look at it. Losing the completion+ // path is fine, but the local user must be onboarded before entering+ // the workspace or its layout bounces back to onboarding.+ if (!hasOnboarded) {+ const { setUser, refreshMe } = useAuthStore.getState();+ try {+ setUser(+ await api.markOnboardingComplete({+ completion_path: "invite_accept",+ workspace_id: invitation.workspace_id,+ }),+ );+ } catch {+ await refreshMe();+ }+ }+ // staleTime: 0 forces a real fetch — the joined workspace has to be in+ // the list before its slug can be resolved.+ return queryClient.fetchQuery({ ...workspaceListOptions(), staleTime: 0 });+ },+ // Land inside the joined workspace; staying put and just dropping the+ // invitation reads as nothing happened (MUL-820).+ onSuccess: (workspaces, invitation) => {+ const joined = workspaces.find((w) => w.id === invitation.workspace_id);+ if (joined) push(paths.workspace(joined.slug).issues());+ },+ // On failure the invitation was usually concluded on another surface+ // while it was on screen, or the join went through and a later step+ // failed; refetch both so the page reflects what the server has.+ onSettled: () => {+ queryClient.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });+ queryClient.invalidateQueries({ queryKey: workspaceKeys.list() });+ },+ });++ const decline = useMutation({+ mutationFn: (invitation: Invitation) => api.declineInvitation(invitation.id),+ onSettled: () => {+ queryClient.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });+ },+ });++ return { accept, decline };+}diff --git a/packages/views/invite/index.ts b/packages/views/invite/index.tsdeleted file mode 100644index 2451ececde..0000000000--- a/packages/views/invite/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { InvitePage } from "./invite-page";-export type { InvitePageProps } from "./invite-page";diff --git a/packages/views/invite/invite-page.tsx b/packages/views/invite/invite-page.tsxdeleted file mode 100644index d41024a2c0..0000000000--- a/packages/views/invite/invite-page.tsx+++ /dev/null@@ -1,298 +0,0 @@-"use client";--import { useState, type ReactNode } from "react";-import { useQuery, useQueryClient } from "@tanstack/react-query";-import { api } from "@multica/core/api";-import { useAuthStore } from "@multica/core/auth";-import {- workspaceKeys,- workspaceListOptions,-} from "@multica/core/workspace/queries";-import {- paths,- resolvePostAuthDestination,- useHasOnboarded,-} from "@multica/core/paths";-import { AppLink, useNavigation } from "../navigation";-import { useLogout } from "../auth";-import { DragStrip } from "../platform";-import { useT } from "../i18n";-import { Button } from "@multica/ui/components/ui/button";-import { Card, CardContent } from "@multica/ui/components/ui/card";-import { Skeleton } from "@multica/ui/components/ui/skeleton";-import { ArrowLeft, LogOut, Users, Check, X } from "@multica/ui/icons";--export interface InvitePageProps {- invitationId: string;- /**- * Optional "go back" handler. Caller passes it only when there's a- * sensible destination (user has at least one workspace, or arrived- * from an in-app flow). Omitted on first-invite/zero-workspace paths- * where Back would have nowhere to go — Log out is then the only exit.- */- onBack?: () => void;-}--/**- * Full-page shell for the "accept invitation" transition. Shared between- * web (Next.js route `/invite/[id]`) and desktop (window-overlay).- * Top-bar affordances (Back, Log out) live here so both platforms get- * identical UX. Platform chrome (window drag region, immersive mode) is- * layered on by the desktop overlay; web just renders the page directly.- */-export function InvitePage({ invitationId, onBack }: InvitePageProps) {- const { t } = useT("invite");- const { push } = useNavigation();- const qc = useQueryClient();- const [accepting, setAccepting] = useState(false);- const [declining, setDeclining] = useState(false);- const [error, setError] = useState<string | null>(null);- const [done, setDone] = useState<"accepted" | "declined" | null>(null);-- const { data: invitation, isLoading, error: fetchError } = useQuery({- queryKey: ["invitation", invitationId],- queryFn: () => api.getInvitation(invitationId),- });-- // Workspace list for the fallback "Go to dashboard" destinations. The invite- // page is a pre-workspace global route so we can't rely on WorkspaceSlugProvider.- const { data: wsList = [] } = useQuery(workspaceListOptions());- const hasOnboarded = useHasOnboarded();- const fallbackDest = resolvePostAuthDestination(wsList, hasOnboarded);-- const handleAccept = async () => {- setAccepting(true);- setError(null);- try {- await api.acceptInvitation(invitationId);- // Belt to the backend's braces: AcceptInvitation already sets- // onboarded_at inside the same transaction, but explicitly calling- // markOnboardingComplete + refreshMe here keeps local user state in- // sync immediately so downstream guards don't see stale `null`.- await api.markOnboardingComplete({- completion_path: "invite_accept",- workspace_id: invitation?.workspace_id,- });- await useAuthStore.getState().refreshMe();- setDone("accepted");- // Fetch the refreshed workspace list so we know the joined workspace's slug.- const nextList = await qc.fetchQuery({- ...workspaceListOptions(),- staleTime: 0,- });- const joined = nextList.find((w) => w.id === invitation?.workspace_id);- qc.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- // Navigate into the joined workspace. The [workspaceSlug]/layout will- // sync api client, stores, and the last_workspace_slug cookie from the URL.- const dest = joined- ? paths.workspace(joined.slug).issues()- : fallbackDest;- setTimeout(() => push(dest), 1000);- } catch (e) {- setError(e instanceof Error ? e.message : t(($) => $.errors.accept_failed));- } finally {- setAccepting(false);- }- };-- const handleDecline = async () => {- setDeclining(true);- setError(null);- try {- await api.declineInvitation(invitationId);- setDone("declined");- qc.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- } catch (e) {- setError(e instanceof Error ? e.message : t(($) => $.errors.decline_failed));- } finally {- setDeclining(false);- }- };-- if (isLoading) {- return (- <InviteShell onBack={onBack}>- <Card className="w-full max-w-md">- <CardContent className="flex flex-col items-center gap-4 py-12">- <Skeleton className="h-12 w-12 rounded-full" />- <Skeleton className="h-5 w-48" />- <Skeleton className="h-4 w-64" />- <Skeleton className="h-9 w-32 rounded-md" />- </CardContent>- </Card>- </InviteShell>- );- }-- if (fetchError || !invitation) {- return (- <InviteShell onBack={onBack}>- <Card className="w-full max-w-md">- <CardContent className="flex flex-col items-center gap-4 py-12">- <div className="flex h-12 w-12 items-center justify-center rounded-full bg-muted">- <X className="h-6 w-6 text-muted-foreground" />- </div>- <h2 className="text-title font-semibold">{t(($) => $.not_found.title)}</h2>- <p className="text-body text-muted-foreground text-center">- {t(($) => $.not_found.description)}- </p>- <Button- variant="outline"- render={<AppLink href={fallbackDest} />}- nativeButton={false}- >- {t(($) => $.not_found.go_to_dashboard)}- </Button>- </CardContent>- </Card>- </InviteShell>- );- }-- if (done === "accepted") {- return (- <InviteShell onBack={onBack}>- <Card className="w-full max-w-md">- <CardContent className="flex flex-col items-center gap-4 py-12">- <div className="flex h-12 w-12 items-center justify-center rounded-full bg-primary/10">- <Check className="h-6 w-6 text-primary" />- </div>- <h2 className="text-title font-semibold">- {t(($) => $.accepted.title, { workspace_name: invitation.workspace_name })}- </h2>- <p className="text-body text-muted-foreground">- {t(($) => $.accepted.redirecting)}- </p>- </CardContent>- </Card>- </InviteShell>- );- }-- if (done === "declined") {- return (- <InviteShell onBack={onBack}>- <Card className="w-full max-w-md">- <CardContent className="flex flex-col items-center gap-4 py-12">- <h2 className="text-title font-semibold">{t(($) => $.declined.title)}</h2>- <p className="text-body text-muted-foreground">{t(($) => $.declined.description)}</p>- <Button- variant="outline"- render={<AppLink href={fallbackDest} />}- nativeButton={false}- >- {t(($) => $.declined.go_to_dashboard)}- </Button>- </CardContent>- </Card>- </InviteShell>- );- }-- const isExpired = invitation.status !== "pending";- const isAlreadyHandled = invitation.status === "accepted" || invitation.status === "declined";-- return (- <InviteShell onBack={onBack}>- <Card className="w-full max-w-md">- <CardContent className="flex flex-col items-center gap-6 py-12">- <div className="flex h-14 w-14 items-center justify-center rounded-full bg-primary/10">- <Users className="h-7 w-7 text-primary" />- </div>-- <div className="text-center space-y-2">- <h2 className="text-title-lg font-semibold">- {t(($) => $.main.join_title, {- workspace_name: invitation.workspace_name ?? t(($) => $.main.fallback_workspace_name),- })}- </h2>- <p className="text-body text-muted-foreground">- <strong>{invitation.inviter_name || invitation.inviter_email}</strong>{" "}- {invitation.role === "admin"- ? t(($) => $.main.invited_role_admin)- : t(($) => $.main.invited_role_member)}- </p>- </div>-- {isAlreadyHandled ? (- <div className="text-body text-muted-foreground">- {invitation.status === "accepted"- ? t(($) => $.main.already_handled_accepted)- : t(($) => $.main.already_handled_declined)}- </div>- ) : isExpired ? (- <div className="text-body text-muted-foreground">- {t(($) => $.main.expired)}- </div>- ) : (- <div className="flex gap-3 w-full">- <Button- variant="outline"- className="flex-1"- onClick={handleDecline}- disabled={accepting || declining}- >- {declining ? t(($) => $.main.declining) : t(($) => $.main.decline)}- </Button>- <Button- className="flex-1"- onClick={handleAccept}- disabled={accepting || declining}- >- {accepting ? t(($) => $.main.joining) : t(($) => $.main.accept)}- </Button>- </div>- )}-- {error && (- <p className="text-body text-destructive text-center">{error}</p>- )}- </CardContent>- </Card>- </InviteShell>- );-}--/**- * Shared chrome for every InvitePage render state (loading, error,- * default, accepted, declined). Keeps Back + Log out buttons in a- * consistent position across all branches and across platforms.- */-function InviteShell({- onBack,- children,-}: {- onBack?: () => void;- children: ReactNode;-}) {- const { t } = useT("invite");- const logout = useLogout();- return (- <div className="relative flex min-h-svh flex-col bg-background">- <DragStrip />- {onBack && (- <Button- variant="ghost"- size="sm"- className="absolute top-16 left-12 text-muted-foreground"- onClick={onBack}- >- <ArrowLeft />- {t(($) => $.header.back)}- </Button>- )}- <Button- variant="ghost"- size="sm"- className="absolute top-16 right-12 text-muted-foreground hover:text-destructive"- onClick={logout}- >- <LogOut />- {t(($) => $.header.log_out)}- </Button>- <div className="flex flex-1 flex-col items-center justify-center px-6 pb-12">- {children}- </div>- </div>- );-}diff --git a/packages/views/layout/rail-workspaces.test.tsx b/packages/views/layout/rail-workspaces.test.tsxindex 0c23af548f..fedd7b03ab 100644--- a/packages/views/layout/rail-workspaces.test.tsx+++ b/packages/views/layout/rail-workspaces.test.tsx@@ -10,11 +10,7 @@ const state = vi.hoisted(() => ({workspaces: [] as Ws[],invitations: [] as { id: string; workspace_id: string; workspace_name?: string; inviter_name?: string }[],summary: [] as { workspace_id: string; count: number }[],- accept: vi.fn(),setPinned: vi.fn(),- decline: vi.fn(),- invalidateQueries: vi.fn(),- mutations: [] as Array<Record<string, unknown>>,workspaceCreationDisabled: false,openWorkspaceInNewWindow: undefined as undefined | Mock<(slug: string) => void>,workspacesInOtherWindows: undefined as undefined | (() => string[]),@@ -53,8 +49,6 @@ vi.mock("@multica/core/api", async (importOriginal) => {api: {...actual.api,getBaseUrl: () => "http://127.0.0.1:8080",- acceptInvitation: state.accept,- declineInvitation: state.decline,},};});@@ -66,22 +60,16 @@ vi.mock("@multica/core/inbox/queries", () => ({}));vi.mock("@multica/core/workspace/queries", () => ({myInvitationListOptions: () => ({ queryKey: ["invitations"] }),- workspaceKeys: { myInvitations: () => ["invitations"] },workspaceListOptions: () => ({ queryKey: ["workspaces"] }),}));vi.mock("@tanstack/react-query", async (importOriginal) => ({...(await importOriginal<typeof import("@tanstack/react-query")>()),- useMutation: (options: Record<string, unknown> = {}) => {- state.mutations.push(options);- return { isPending: false, mutate: vi.fn() };- },useQuery: ({ queryKey }: { queryKey: readonly unknown[] }) => {if (queryKey[0] === "workspaces") return { data: state.workspaces };if (queryKey[0] === "invitations") return { data: state.invitations };if (queryKey[0] === "inbox") return { data: state.summary };return { data: undefined };},- useQueryClient: () => ({ fetchQuery: vi.fn(), invalidateQueries: state.invalidateQueries }),}));vi.mock("@multica/ui/components/common/tooltip-hint", () => ({TooltipHint: ({ children }: { children: ReactNode }) => <>{children}</>,@@ -99,7 +87,6 @@ beforeEach(() => {state.workspaces = [ws(1), ws(2)];state.invitations = [];state.summary = [];- state.mutations.length = 0;state.setPinned.mockClear();state.workspaceCreationDisabled = false;state.openWorkspaceInNewWindow = undefined;@@ -173,13 +160,24 @@ describe("RailWorkspaces", () => {expect(triggerHasDot()).toBe(false);});- it("lists pending invitations in the menu and dots the switcher", async () => {- state.invitations = [{ id: "inv-1", workspace_id: "ws-9", workspace_name: "Copilot Hub" }];+ it("links pending invitations to the invitations page and dots the switcher", async () => {+ state.invitations = [+ { id: "inv-1", workspace_id: "ws-8", workspace_name: "Copilot Hub" },+ { id: "inv-2", workspace_id: "ws-9", workspace_name: "Lumen Labs" },+ ];renderWithI18n(<RailWorkspaces />);expect(triggerHasDot()).toBe(true);const menu = await openMenu();- expect(within(menu).getByText("Pending invitations")).toBeInTheDocument();- expect(within(menu).getByRole("menuitem", { name: /Copilot Hub$/ })).toBeInTheDocument();+ const entry = within(menu).getByRole("menuitem", { name: /Pending invitations/ });+ expect(entry).toHaveAttribute("href", "/invitations");+ expect(entry).toHaveTextContent("2");+ expect(within(menu).queryByText("Copilot Hub")).toBeNull();+ });++ it("offers no invitations entry when none are pending", async () => {+ renderWithI18n(<RailWorkspaces />);+ const menu = await openMenu();+ expect(within(menu).queryByRole("menuitem", { name: /Pending invitations/ })).toBeNull();});it("offers workspace creation unless the instance disables it", async () => {@@ -260,34 +258,4 @@ describe("RailWorkspaces", () => {expect(within(menu).queryByRole("button", { name: "Open in new window" })).toBeNull();});});-});--describe("pending invitation self-heal", () => {- beforeEach(() => {- state.accept.mockReset().mockRejectedValue(new Error("invitation is not pending"));- state.decline.mockReset().mockRejectedValue(new Error("invitation is not pending"));- state.invalidateQueries.mockClear();- });-- // "Invitation is not pending": it was concluded on another surface. Both- // mutations must refetch the list on failure so the stale tile drops.- it("invalidates the pending list when accept or decline fails", async () => {- renderWithI18n(<RailWorkspaces />);- expect(state.mutations).toHaveLength(2);-- for (const options of state.mutations as Array<{- mutationFn: (id: string) => Promise<unknown>;- onError?: (...args: unknown[]) => unknown;- onSettled?: (...args: unknown[]) => unknown;- }>) {- const settle = options.onError ?? options.onSettled;- expect(settle).toBeTypeOf("function");- state.invalidateQueries.mockClear();- await expect(options.mutationFn("inv-1")).rejects.toThrow("invitation is not pending");- await settle!(new Error("invitation is not pending"), "inv-1", undefined, undefined);- expect(state.invalidateQueries).toHaveBeenCalledWith({ queryKey: ["invitations"] });- }- expect(state.accept).toHaveBeenCalledTimes(1);- expect(state.decline).toHaveBeenCalledTimes(1);- });-});+});\ No newline at end of filediff --git a/packages/views/layout/rail-workspaces.tsx b/packages/views/layout/rail-workspaces.tsxindex bccd3a4598..8f0c01819c 100644--- a/packages/views/layout/rail-workspaces.tsx+++ b/packages/views/layout/rail-workspaces.tsx@@ -1,9 +1,9 @@"use client";import { useMemo, useState, type MouseEvent } from "react";-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";-import { AppWindow, ArrowBigUp, Check, Pin, Plus } from "@multica/ui/icons";-import { api } from "@multica/core/api";+import { useQuery } from "@tanstack/react-query";+import { AppWindow, ArrowBigUp, Check, Mail, Pin, Plus } from "@multica/ui/icons";+import type { api } from "@multica/core/api";import { useConfigStore } from "@multica/core/config";import {inboxUnreadSummaryEnabled,@@ -14,7 +14,6 @@ import { paths, useCurrentWorkspace } from "@multica/core/paths";import type { Invitation, Workspace } from "@multica/core/types";import {myInvitationListOptions,- workspaceKeys,workspaceListOptions,} from "@multica/core/workspace/queries";import { useSetWorkspacePinned } from "@multica/core/workspace/mutations";@@ -26,9 +25,6 @@ import {DropdownMenuItem,DropdownMenuLabel,DropdownMenuSeparator,- DropdownMenuSub,- DropdownMenuSubContent,- DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@multica/ui/components/ui/dropdown-menu";import { Kbd, KbdGroup } from "@multica/ui/components/ui/kbd";@@ -123,80 +119,11 @@ function OtherWindowMarker() {);}-function useInvitationActions(invitations: Invitation[]) {- const queryClient = useQueryClient();- const { push } = useNavigation();- const accept = useMutation({- mutationFn: (id: string) => api.acceptInvitation(id),- // Land inside the joined workspace; staying put and just adding a menu- // row reads as nothing happened (MUL-820).- onSuccess: async (_, invitationId) => {- const invitation = invitations.find((i) => i.id === invitationId);- queryClient.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- // staleTime: 0 forces a real fetch — the joined workspace has to be in- // the list before its slug can be resolved.- const list = await queryClient.fetchQuery({ ...workspaceListOptions(), staleTime: 0 });- const joined = invitation ? list.find((w) => w.id === invitation.workspace_id) : null;- if (joined) push(paths.workspace(joined.slug).issues());- },- // "Invitation is not pending": it was concluded on another surface while- // this row was on screen. Refetch so the stale row drops.- onError: () => {- queryClient.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- },- });- const decline = useMutation({- mutationFn: (id: string) => api.declineInvitation(id),- // Success drops the declined row; failure means it was concluded- // elsewhere. Either way the list is stale.- onSettled: () => {- queryClient.invalidateQueries({ queryKey: workspaceKeys.myInvitations() });- },- });- return { accept, decline };-}--function InvitationItem({- invitation,- actions,-}: {- invitation: Invitation;- actions: ReturnType<typeof useInvitationActions>;-}) {- const { t } = useT("layout");- const name = invitation.workspace_name ?? t(($) => $.sidebar.invitation_workspace_fallback);- const pending = actions.accept.isPending || actions.decline.isPending;- return (- <DropdownMenuSub>- <DropdownMenuSubTrigger>- <WorkspaceAvatar name={name} size="sm" />- <span className="min-w-0 flex-1 truncate">{name}</span>- <UnreadDot />- </DropdownMenuSubTrigger>- <DropdownMenuSubContent className="min-w-44">- {invitation.inviter_name && (- <DropdownMenuGroup>- <DropdownMenuLabel className="text-caption text-muted-foreground">- {t(($) => $.rail.invitation_from, { name: invitation.inviter_name })}- </DropdownMenuLabel>- </DropdownMenuGroup>- )}- <DropdownMenuItem disabled={pending} onClick={() => actions.accept.mutate(invitation.id)}>- {t(($) => $.sidebar.invitation_join)}- </DropdownMenuItem>- <DropdownMenuItem disabled={pending} onClick={() => actions.decline.mutate(invitation.id)}>- {t(($) => $.sidebar.invitation_decline)}- </DropdownMenuItem>- </DropdownMenuSubContent>- </DropdownMenuSub>- );-}-/*** The workspace switcher at the top of the rail: one tile for the current* workspace, whatever the workspace count, so the spaces below never move.- * Its menu lists every workspace, pending invitations, and workspace- * creation. The tile carries a dot while another workspace has unread inbox+ * Its menu lists every workspace, an entry to the invitations page while+ * any are pending, and workspace creation. The tile carries a dot while another workspace has unread inbox* items or an invitation waits; the current workspace's unread shows on the* Inbox space instead.*/@@ -214,7 +141,6 @@ export function RailWorkspaces() {enabled: inboxUnreadSummaryEnabled(wsId),});const unreadIds = useMemo(() => unreadWorkspaceIds(unreadSummary), [unreadSummary]);- const actions = useInvitationActions(invitations);const setPinned = useSetWorkspacePinned();const { openWorkspaceInNewWindow, workspacesInOtherWindows } = useNavigation();// Read when the menu opens: other windows switch workspaces independently.@@ -299,12 +225,16 @@ export function RailWorkspaces() {<><DropdownMenuSeparator /><DropdownMenuGroup>- <DropdownMenuLabel className="text-caption text-muted-foreground">- {t(($) => $.sidebar.pending_invitations_label)}- </DropdownMenuLabel>- {invitations.map((invitation) => (- <InvitationItem key={invitation.id} invitation={invitation} actions={actions} />- ))}+ <DropdownMenuItem render={<AppLink href={paths.invitations()} />}>+ <Mail />+ <span className="min-w-0 flex-1 truncate">+ {t(($) => $.sidebar.pending_invitations_label)}+ </span>+ <span className="text-caption text-muted-foreground tabular-nums">+ {invitations.length}+ </span>+ <UnreadDot />+ </DropdownMenuItem></DropdownMenuGroup></>)}diff --git a/packages/views/locales/en/invite.json b/packages/views/locales/en/invite.jsonindex 83b9859fd2..6784cf8499 100644--- a/packages/views/locales/en/invite.json+++ b/packages/views/locales/en/invite.json@@ -3,52 +3,33 @@"back": "Back","log_out": "Log out"},- "not_found": {- "title": "Invitation not found",- "description": "This invitation may have expired, been revoked, or doesn't belong to your account.",- "go_to_dashboard": "Go to dashboard"- },- "accepted": {- "title": "You joined {{workspace_name}}!",- "redirecting": "Redirecting to workspace..."+ "list": {+ "title": "You've been invited",+ "subtitle": "Joining opens that workspace. Other invitations stay pending.",+ "workspace_fallback": "Workspace",+ "inviter_fallback": "Someone",+ "invited_admin": "{{inviter}} invited you as an admin",+ "invited_member": "{{inviter}} invited you as a member",+ "accept": "Join",+ "joining": "Joining...",+ "decline": "Decline",+ "declining": "Declining...",+ "skip": "Skip and set up my own workspace"},- "declined": {- "title": "Invitation declined",- "description": "You won't be added to this workspace.",+ "empty": {+ "title": "No pending invitations",+ "hint": "Continue to set up your own workspace.",+ "continue": "Continue to setup","go_to_dashboard": "Go to dashboard"},- "main": {- "join_title": "Join {{workspace_name}}",- "fallback_workspace_name": "workspace",- "invited_role_admin": "invited you to join as an admin.",- "invited_role_member": "invited you to join as a member.",- "already_handled_accepted": "This invitation has already been accepted.",- "already_handled_declined": "This invitation has already been declined.",- "expired": "This invitation has expired.",- "decline": "Decline",- "declining": "Declining...",- "accept": "Accept & Join",- "joining": "Joining..."+ "linked": {+ "not_found": "This invitation may have expired, been revoked, or doesn't belong to your account.",+ "accepted": "This invitation has already been accepted.",+ "declined": "This invitation has already been declined.",+ "expired": "This invitation has expired."},"errors": {"accept_failed": "Failed to accept invitation","decline_failed": "Failed to decline invitation"- },- "batch": {- "log_out": "Log out",- "empty_title": "No pending invitations",- "empty_hint": "Continue to set up your own workspace.",- "empty_continue": "Continue to setup",- "title": "You've been invited",- "subtitle": "Pick the workspaces you want to join. You can always handle the rest later from the sidebar.",- "submit_skip": "Skip and set up my own workspace",- "submit_join_one": "Join 1 workspace",- "submit_join_other": "Join {{count}} workspaces",- "joining": "Joining...",- "error_generic": "Failed to process invitations. Please try again.",- "row_workspace_fallback": "Workspace",- "row_inviter_fallback": "Someone",- "row_invited_admin": "{{inviter}} invited you as an admin",- "row_invited_member": "{{inviter}} invited you as a member"}}diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.jsonindex 2924c69c4e..5667ad562d 100644--- a/packages/views/locales/en/layout.json+++ b/packages/views/locales/en/layout.json@@ -79,9 +79,6 @@"workspaces_label": "Workspaces","create_workspace": "Create workspace","pending_invitations_label": "Pending invitations",- "invitation_workspace_fallback": "Workspace",- "invitation_join": "Join",- "invitation_decline": "Decline","log_out": "Log out","new_issue": "New Issue","pinned_label": "Pinned",@@ -101,7 +98,6 @@"chat": "Chat","autopilots": "Auto","switch_workspace": "Switch workspace",- "invitation_from": "{{name}} invited you","pin_workspace": "Pin workspace","unpin_workspace": "Unpin workspace","open_in_new_window": "Open in new window",diff --git a/packages/views/locales/es/invite.json b/packages/views/locales/es/invite.jsonindex d739b44cd6..3bda1e77b8 100644--- a/packages/views/locales/es/invite.json+++ b/packages/views/locales/es/invite.json@@ -3,52 +3,33 @@"back": "Volver","log_out": "Cerrar sesión"},- "not_found": {- "title": "Invitación no encontrada",- "description": "Es posible que esta invitación haya caducado, se haya revocado o no pertenezca a tu cuenta.",- "go_to_dashboard": "Ir al panel"- },- "accepted": {- "title": "¡Te has unido a {{workspace_name}}!",- "redirecting": "Redirigiendo al espacio de trabajo..."+ "list": {+ "title": "Has sido invitado",+ "subtitle": "Al unirte, entrarás en ese espacio de trabajo. Las demás invitaciones seguirán pendientes.",+ "workspace_fallback": "Espacio de trabajo",+ "inviter_fallback": "Alguien",+ "invited_admin": "{{inviter}} te invitó como administrador",+ "invited_member": "{{inviter}} te invitó como miembro",+ "accept": "Unirse",+ "joining": "Uniéndose...",+ "decline": "Rechazar",+ "declining": "Rechazando...",+ "skip": "Omitir y configurar mi propio espacio de trabajo"},- "declined": {- "title": "Invitación rechazada",- "description": "No se te añadirá a este espacio de trabajo.",+ "empty": {+ "title": "Sin invitaciones pendientes",+ "hint": "Continúa para configurar tu propio espacio de trabajo.",+ "continue": "Continuar a la configuración","go_to_dashboard": "Ir al panel"},- "main": {- "join_title": "Únete a {{workspace_name}}",- "fallback_workspace_name": "espacio de trabajo",- "invited_role_admin": "te invitó a unirte como administrador.",- "invited_role_member": "te invitó a unirte como miembro.",- "already_handled_accepted": "Esta invitación ya se ha aceptado.",- "already_handled_declined": "Esta invitación ya se ha rechazado.",- "expired": "Esta invitación ha caducado.",- "decline": "Rechazar",- "declining": "Rechazando...",- "accept": "Aceptar y unirse",- "joining": "Uniéndose..."+ "linked": {+ "not_found": "Es posible que esta invitación haya caducado, se haya revocado o no pertenezca a tu cuenta.",+ "accepted": "Esta invitación ya se ha aceptado.",+ "declined": "Esta invitación ya se ha rechazado.",+ "expired": "Esta invitación ha caducado."},"errors": {"accept_failed": "No se ha podido aceptar la invitación","decline_failed": "No se ha podido rechazar la invitación"- },- "batch": {- "log_out": "Cerrar sesión",- "empty_title": "Sin invitaciones pendientes",- "empty_hint": "Continúa para configurar tu propio espacio de trabajo.",- "empty_continue": "Continuar a la configuración",- "title": "Has sido invitado",- "subtitle": "Elige los espacios de trabajo a los que quieres unirte. Siempre puedes gestionar el resto más tarde desde la barra lateral.",- "submit_skip": "Omitir y configurar mi propio espacio de trabajo",- "submit_join_one": "Unirse a 1 espacio de trabajo",- "submit_join_other": "Unirse a {{count}} espacios de trabajo",- "joining": "Uniéndose...",- "error_generic": "No se han podido procesar las invitaciones. Inténtalo de nuevo.",- "row_workspace_fallback": "Espacio de trabajo",- "row_inviter_fallback": "Alguien",- "row_invited_admin": "{{inviter}} te invitó como administrador",- "row_invited_member": "{{inviter}} te invitó como miembro"}}diff --git a/packages/views/locales/es/layout.json b/packages/views/locales/es/layout.jsonindex d784adb953..5bbbc0bb10 100644--- a/packages/views/locales/es/layout.json+++ b/packages/views/locales/es/layout.json@@ -48,9 +48,6 @@"workspaces_label": "Espacios de trabajo","create_workspace": "Crear espacio de trabajo","pending_invitations_label": "Invitaciones pendientes",- "invitation_workspace_fallback": "Espacio de trabajo",- "invitation_join": "Unirse",- "invitation_decline": "Rechazar","log_out": "Cerrar sesión","new_issue": "Nueva tarea","pinned_label": "Fijados",@@ -101,7 +98,6 @@"chat": "Chat","autopilots": "Auto","switch_workspace": "Cambiar de espacio de trabajo",- "invitation_from": "{{name}} te ha invitado","pin_workspace": "Fijar espacio de trabajo","unpin_workspace": "Desfijar espacio de trabajo","open_in_new_window": "Abrir en una ventana nueva",diff --git a/packages/views/locales/fr/invite.json b/packages/views/locales/fr/invite.jsonindex 564f3f07e4..ae2616bfe1 100644--- a/packages/views/locales/fr/invite.json+++ b/packages/views/locales/fr/invite.json@@ -3,52 +3,33 @@"back": "Retour","log_out": "Se déconnecter"},- "not_found": {- "title": "Invitation introuvable",- "description": "Cette invitation a peut-être expiré, été révoquée, ou n'appartient pas à votre compte.",- "go_to_dashboard": "Aller au tableau de bord"- },- "accepted": {- "title": "Vous avez rejoint {{workspace_name}} !",- "redirecting": "Redirection vers l'espace de travail..."+ "list": {+ "title": "Vous avez été invité",+ "subtitle": "En rejoignant un espace de travail, vous y serez redirigé. Les autres invitations restent en attente.",+ "workspace_fallback": "Espace de travail",+ "inviter_fallback": "Quelqu'un",+ "invited_admin": "{{inviter}} vous a invité en tant qu'administrateur",+ "invited_member": "{{inviter}} vous a invité en tant que membre",+ "accept": "Rejoindre",+ "joining": "Adhésion...",+ "decline": "Refuser",+ "declining": "Refus...",+ "skip": "Ignorer et configurer mon propre espace de travail"},- "declined": {- "title": "Invitation refusée",- "description": "Vous ne serez pas ajouté à cet espace de travail.",+ "empty": {+ "title": "Aucune invitation en attente",+ "hint": "Poursuivez pour configurer votre propre espace de travail.",+ "continue": "Passer à la configuration","go_to_dashboard": "Aller au tableau de bord"},- "main": {- "join_title": "Rejoindre {{workspace_name}}",- "fallback_workspace_name": "espace de travail",- "invited_role_admin": "vous a invité à le rejoindre en tant qu'administrateur.",- "invited_role_member": "vous a invité à le rejoindre en tant que membre.",- "already_handled_accepted": "Cette invitation a déjà été acceptée.",- "already_handled_declined": "Cette invitation a déjà été refusée.",- "expired": "Cette invitation a expiré.",- "decline": "Refuser",- "declining": "Refus...",- "accept": "Accepter et rejoindre",- "joining": "Adhésion..."+ "linked": {+ "not_found": "Cette invitation a peut-être expiré, été révoquée, ou n'appartient pas à votre compte.",+ "accepted": "Cette invitation a déjà été acceptée.",+ "declined": "Cette invitation a déjà été refusée.",+ "expired": "Cette invitation a expiré."},"errors": {"accept_failed": "Échec de l'acceptation de l'invitation","decline_failed": "Échec du refus de l'invitation"- },- "batch": {- "log_out": "Se déconnecter",- "empty_title": "Aucune invitation en attente",- "empty_hint": "Poursuivez pour configurer votre propre espace de travail.",- "empty_continue": "Passer à la configuration",- "title": "Vous avez été invité",- "subtitle": "Choisissez les espaces de travail que vous voulez rejoindre. Vous pourrez toujours traiter les autres plus tard depuis la barre latérale.",- "submit_skip": "Ignorer et configurer mon propre espace de travail",- "submit_join_one": "Rejoindre 1 espace de travail",- "submit_join_other": "Rejoindre {{count}} espaces de travail",- "joining": "Adhésion...",- "error_generic": "Échec du traitement des invitations. Veuillez réessayer.",- "row_workspace_fallback": "Espace de travail",- "row_inviter_fallback": "Quelqu'un",- "row_invited_admin": "{{inviter}} vous a invité en tant qu'administrateur",- "row_invited_member": "{{inviter}} vous a invité en tant que membre"}}diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.jsonindex badedd68d7..f3ce4f5f27 100644--- a/packages/views/locales/fr/layout.json+++ b/packages/views/locales/fr/layout.json@@ -79,9 +79,6 @@"workspaces_label": "Espaces de travail","create_workspace": "Créer un espace de travail","pending_invitations_label": "Invitations en attente",- "invitation_workspace_fallback": "Espace de travail",- "invitation_join": "Rejoindre",- "invitation_decline": "Refuser","log_out": "Se déconnecter","new_issue": "Nouvelle tâche","pinned_label": "Épinglés",@@ -101,7 +98,6 @@"chat": "Chat","autopilots": "Auto","switch_workspace": "Changer d'espace de travail",- "invitation_from": "{{name}} vous a invité","pin_workspace": "Épingler l’espace de travail","unpin_workspace": "Désépingler l’espace de travail","open_in_new_window": "Ouvrir dans une nouvelle fenêtre",diff --git a/packages/views/locales/ja/invite.json b/packages/views/locales/ja/invite.jsonindex ed104c7592..4573e04ad1 100644--- a/packages/views/locales/ja/invite.json+++ b/packages/views/locales/ja/invite.json@@ -3,51 +3,33 @@"back": "戻る","log_out": "ログアウト"},- "not_found": {- "title": "招待が見つかりません",- "description": "この招待は期限切れか取り消されたか、お使いのアカウントに属していない可能性があります。",- "go_to_dashboard": "ダッシュボードへ移動"- },- "accepted": {- "title": "{{workspace_name}}に参加しました!",- "redirecting": "ワークスペースへ移動中..."+ "list": {+ "title": "招待を受け取りました",+ "subtitle": "参加するとそのワークスペースに移動します。ほかの招待はそのまま残ります。",+ "workspace_fallback": "ワークスペース",+ "inviter_fallback": "誰か",+ "invited_admin": "{{inviter}}さんがあなたをadminとして招待しました",+ "invited_member": "{{inviter}}さんがあなたをmemberとして招待しました",+ "accept": "参加",+ "joining": "参加中...",+ "decline": "辞退",+ "declining": "辞退中...",+ "skip": "スキップして自分のワークスペースを設定"},- "declined": {- "title": "招待を辞退しました",- "description": "このワークスペースには追加されません。",+ "empty": {+ "title": "保留中の招待はありません",+ "hint": "続けて自分のワークスペースを設定しましょう。",+ "continue": "セットアップを続ける","go_to_dashboard": "ダッシュボードへ移動"},- "main": {- "join_title": "{{workspace_name}}に参加",- "fallback_workspace_name": "ワークスペース",- "invited_role_admin": "さんがあなたをadminとして招待しました。",- "invited_role_member": "さんがあなたをmemberとして招待しました。",- "already_handled_accepted": "この招待はすでに承認されています。",- "already_handled_declined": "この招待はすでに辞退されています。",- "expired": "この招待は期限切れです。",- "decline": "辞退",- "declining": "辞退中...",- "accept": "承認して参加",- "joining": "参加中..."+ "linked": {+ "not_found": "この招待は期限切れか取り消されたか、お使いのアカウントに属していない可能性があります。",+ "accepted": "この招待はすでに承認されています。",+ "declined": "この招待はすでに辞退されています。",+ "expired": "この招待は期限切れです。"},"errors": {"accept_failed": "招待を承認できませんでした","decline_failed": "招待を辞退できませんでした"- },- "batch": {- "log_out": "ログアウト",- "empty_title": "保留中の招待はありません",- "empty_hint": "続けて自分のワークスペースを設定しましょう。",- "empty_continue": "セットアップを続ける",- "title": "招待を受け取りました",- "subtitle": "参加するワークスペースを選択してください。残りはいつでもサイドバーから処理できます。",- "submit_skip": "スキップして自分のワークスペースを設定",- "submit_join_other": "{{count}} 件のワークスペースに参加",- "joining": "参加中...",- "error_generic": "招待を処理できませんでした。もう一度お試しください。",- "row_workspace_fallback": "ワークスペース",- "row_inviter_fallback": "誰か",- "row_invited_admin": "{{inviter}}さんがあなたをadminとして招待しました",- "row_invited_member": "{{inviter}}さんがあなたをmemberとして招待しました"}}diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.jsonindex 95041a54fe..4af51e7762 100644--- a/packages/views/locales/ja/layout.json+++ b/packages/views/locales/ja/layout.json@@ -78,9 +78,6 @@"workspaces_label": "ワークスペース","create_workspace": "ワークスペースを作成","pending_invitations_label": "保留中の招待",- "invitation_workspace_fallback": "ワークスペース",- "invitation_join": "参加",- "invitation_decline": "辞退","log_out": "ログアウト","new_issue": "新規タスク","pinned_label": "ピン留め済み",@@ -100,7 +97,6 @@"chat": "チャット","autopilots": "自動化","switch_workspace": "ワークスペースを切り替え",- "invitation_from": "{{name}} さんから招待されています","pin_workspace": "ワークスペースをピン留め","unpin_workspace": "ピン留めを解除","open_in_new_window": "新しいウィンドウで開く",diff --git a/packages/views/locales/ko/invite.json b/packages/views/locales/ko/invite.jsonindex 1852d320b2..4c5641c5e3 100644--- a/packages/views/locales/ko/invite.json+++ b/packages/views/locales/ko/invite.json@@ -3,51 +3,33 @@"back": "뒤로","log_out": "로그아웃"},- "not_found": {- "title": "초대를 찾을 수 없습니다",- "description": "초대가 만료되었거나 취소되었거나, 현재 계정에 해당하지 않을 수 있습니다.",- "go_to_dashboard": "대시보드로 이동"- },- "accepted": {- "title": "{{workspace_name}}에 참가했습니다!",- "redirecting": "워크스페이스로 이동 중..."+ "list": {+ "title": "초대를 받았습니다",+ "subtitle": "참가하면 해당 워크스페이스로 이동합니다. 나머지 초대는 그대로 유지됩니다.",+ "workspace_fallback": "워크스페이스",+ "inviter_fallback": "누군가",+ "invited_admin": "{{inviter}}님이 관리자로 초대했습니다",+ "invited_member": "{{inviter}}님이 멤버로 초대했습니다",+ "accept": "참가",+ "joining": "참가하는 중...",+ "decline": "거절",+ "declining": "거절하는 중...",+ "skip": "건너뛰고 내 워크스페이스 설정"},- "declined": {- "title": "초대를 거절했습니다",- "description": "이 워크스페이스에 추가되지 않습니다.",+ "empty": {+ "title": "대기 중인 초대가 없습니다",+ "hint": "내 워크스페이스 설정을 계속하세요.",+ "continue": "설정 계속하기","go_to_dashboard": "대시보드로 이동"},- "main": {- "join_title": "{{workspace_name}} 참가",- "fallback_workspace_name": "워크스페이스",- "invited_role_admin": "관리자로 참가하도록 초대했습니다.",- "invited_role_member": "멤버로 참가하도록 초대했습니다.",- "already_handled_accepted": "이미 수락한 초대입니다.",- "already_handled_declined": "이미 거절한 초대입니다.",- "expired": "만료된 초대입니다.",- "decline": "거절",- "declining": "거절하는 중...",- "accept": "수락하고 참가",- "joining": "참가하는 중..."+ "linked": {+ "not_found": "초대가 만료되었거나 취소되었거나, 현재 계정에 해당하지 않을 수 있습니다.",+ "accepted": "이미 수락한 초대입니다.",+ "declined": "이미 거절한 초대입니다.",+ "expired": "만료된 초대입니다."},"errors": {"accept_failed": "초대를 수락하지 못했습니다","decline_failed": "초대를 거절하지 못했습니다"- },- "batch": {- "log_out": "로그아웃",- "empty_title": "대기 중인 초대가 없습니다",- "empty_hint": "내 워크스페이스 설정을 계속하세요.",- "empty_continue": "설정 계속하기",- "title": "초대를 받았습니다",- "subtitle": "참가할 워크스페이스를 선택하세요. 나머지는 나중에 사이드바에서 처리할 수 있습니다.",- "submit_skip": "건너뛰고 내 워크스페이스 설정",- "submit_join_other": "워크스페이스 {{count}}개 참가",- "joining": "참가하는 중...",- "error_generic": "초대를 처리하지 못했습니다. 다시 시도하세요.",- "row_workspace_fallback": "워크스페이스",- "row_inviter_fallback": "누군가",- "row_invited_admin": "{{inviter}}님이 관리자로 초대했습니다",- "row_invited_member": "{{inviter}}님이 멤버로 초대했습니다"}}diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.jsonindex 47da16cdbf..2a8dbda452 100644--- a/packages/views/locales/ko/layout.json+++ b/packages/views/locales/ko/layout.json@@ -78,9 +78,6 @@"workspaces_label": "워크스페이스","create_workspace": "워크스페이스 만들기","pending_invitations_label": "대기 중인 초대",- "invitation_workspace_fallback": "워크스페이스",- "invitation_join": "참가",- "invitation_decline": "거절","log_out": "로그아웃","new_issue": "새 태스크","pinned_label": "고정됨",@@ -100,7 +97,6 @@"chat": "채팅","autopilots": "자동화","switch_workspace": "워크스페이스 전환",- "invitation_from": "{{name}} 님이 초대했습니다","pin_workspace": "작업 공간 고정","unpin_workspace": "고정 해제","open_in_new_window": "새 창에서 열기",diff --git a/packages/views/locales/ru/invite.json b/packages/views/locales/ru/invite.jsonindex fc5475569d..ac58e7c513 100644--- a/packages/views/locales/ru/invite.json+++ b/packages/views/locales/ru/invite.json@@ -3,54 +3,33 @@"back": "Назад","log_out": "Выйти"},- "not_found": {- "title": "Приглашение не найдено",- "description": "Это приглашение могло истечь, быть отозванным или не относится к вашей учётной записи.",- "go_to_dashboard": "Перейти в дашборд"- },- "accepted": {- "title": "Вы присоединились к {{workspace_name}}!",- "redirecting": "Перенаправление в рабочее пространство..."+ "list": {+ "title": "Вас пригласили",+ "subtitle": "После присоединения вы перейдёте в это рабочее пространство. Остальные приглашения сохранятся.",+ "workspace_fallback": "Рабочее пространство",+ "inviter_fallback": "Кто-то",+ "invited_admin": "{{inviter}} пригласил(а) вас как администратора",+ "invited_member": "{{inviter}} пригласил(а) вас как участника",+ "accept": "Присоединиться",+ "joining": "Присоединение...",+ "decline": "Отклонить",+ "declining": "Отклонение...",+ "skip": "Пропустить и настроить своё рабочее пространство"},- "declined": {- "title": "Приглашение отклонено",- "description": "Вы не будете добавлены в это рабочее пространство.",+ "empty": {+ "title": "Нет ожидающих приглашений",+ "hint": "Продолжите, чтобы настроить своё рабочее пространство.",+ "continue": "Перейти к настройке","go_to_dashboard": "Перейти в дашборд"},- "main": {- "join_title": "Присоединиться к {{workspace_name}}",- "fallback_workspace_name": "рабочее пространство",- "invited_role_admin": "пригласил(а) вас присоединиться в роли администратора.",- "invited_role_member": "пригласил(а) вас присоединиться в роли участника.",- "already_handled_accepted": "Это приглашение уже было принято.",- "already_handled_declined": "Это приглашение уже было отклонено.",- "expired": "Срок действия этого приглашения истёк.",- "decline": "Отклонить",- "declining": "Отклонение...",- "accept": "Принять и присоединиться",- "joining": "Присоединение..."+ "linked": {+ "not_found": "Это приглашение могло истечь, быть отозванным или не относится к вашей учётной записи.",+ "accepted": "Это приглашение уже было принято.",+ "declined": "Это приглашение уже было отклонено.",+ "expired": "Срок действия этого приглашения истёк."},"errors": {"accept_failed": "Не удалось принять приглашение","decline_failed": "Не удалось отклонить приглашение"- },- "batch": {- "log_out": "Выйти",- "empty_title": "Нет ожидающих приглашений",- "empty_hint": "Продолжите, чтобы настроить своё рабочее пространство.",- "empty_continue": "Перейти к настройке",- "title": "Вас пригласили",- "subtitle": "Выберите рабочие пространства, к которым хотите присоединиться. С остальными можно разобраться позже в боковой панели.",- "submit_skip": "Пропустить и настроить своё рабочее пространство",- "submit_join_one": "Присоединиться к {{count}} рабочему пространству",- "submit_join_other": "Присоединиться к {{count}} рабочим пространствам",- "joining": "Присоединение...",- "error_generic": "Не удалось обработать приглашения. Попробуйте ещё раз.",- "row_workspace_fallback": "Рабочее пространство",- "row_inviter_fallback": "Кто-то",- "row_invited_admin": "{{inviter}} пригласил(а) вас как администратора",- "row_invited_member": "{{inviter}} пригласил(а) вас как участника",- "submit_join_few": "Присоединиться к {{count}} рабочим пространствам",- "submit_join_many": "Присоединиться к {{count}} рабочим пространствам"}}diff --git a/packages/views/locales/ru/layout.json b/packages/views/locales/ru/layout.jsonindex 35749b9df8..a6f5aca38a 100644--- a/packages/views/locales/ru/layout.json+++ b/packages/views/locales/ru/layout.json@@ -55,9 +55,6 @@"workspaces_label": "Рабочие пространства","create_workspace": "Создать рабочее пространство","pending_invitations_label": "Ожидающие приглашения",- "invitation_workspace_fallback": "Рабочее пространство",- "invitation_join": "Присоединиться",- "invitation_decline": "Отклонить","log_out": "Выйти","new_issue": "Новая задача","pinned_label": "Закреплённые",@@ -77,7 +74,6 @@"chat": "Чат","autopilots": "Авто","switch_workspace": "Сменить рабочее пространство",- "invitation_from": "Вас приглашает {{name}}","open_in_new_window": "Открыть в новом окне","open_in_new_window_click": "Нажмите","open_in_other_window": "Уже открыто в другом окне",diff --git a/packages/views/locales/russian-plurals.test.ts b/packages/views/locales/russian-plurals.test.tsindex b99f9c3722..3e7402550a 100644--- a/packages/views/locales/russian-plurals.test.ts+++ b/packages/views/locales/russian-plurals.test.ts@@ -7,7 +7,6 @@ const i18n = createI18n("ru", RESOURCES);const countedMessages = [["schedule interval", (count: number) => i18n.t(($) => $.plugins.schedule.frequency_minutes, { ns: "settings", count })],- ["workspace invitations", (count: number) => i18n.t(($) => $.batch.submit_join, { ns: "invite", count })],["automation deletion", (count: number) => i18n.t(($) => $.actions.delete_dialog.description, { ns: "autopilots", count, name: "Example" })],["skill deletion", (count: number) => i18n.t(($) => $.actions.delete_dialog_desc, { ns: "skills", count })],["issue deletion", (count: number) => i18n.t(($) => $.batch.delete_dialog_desc, { ns: "issues", count })],diff --git a/packages/views/locales/zh-Hans/invite.json b/packages/views/locales/zh-Hans/invite.jsonindex 79564d072e..6e176b7db5 100644--- a/packages/views/locales/zh-Hans/invite.json+++ b/packages/views/locales/zh-Hans/invite.json@@ -3,51 +3,33 @@"back": "返回","log_out": "退出登录"},- "not_found": {- "title": "未找到邀请",- "description": "此邀请可能已过期、已被撤销,或不属于你的账号。",- "go_to_dashboard": "前往主页"- },- "accepted": {- "title": "你已加入 {{workspace_name}}!",- "redirecting": "正在跳转到工作区..."+ "list": {+ "title": "你被邀请加入工作区",+ "subtitle": "加入后直接进入该工作区,其余邀请会保留。",+ "workspace_fallback": "工作区",+ "inviter_fallback": "某人",+ "invited_admin": "{{inviter}} 邀请你以管理员身份加入",+ "invited_member": "{{inviter}} 邀请你以成员身份加入",+ "accept": "加入",+ "joining": "加入中...",+ "decline": "拒绝",+ "declining": "拒绝中...",+ "skip": "跳过,创建我自己的工作区"},- "declined": {- "title": "已拒绝邀请",- "description": "你将不会加入此工作区。",+ "empty": {+ "title": "没有待处理的邀请",+ "hint": "继续创建你自己的工作区。",+ "continue": "继续创建","go_to_dashboard": "前往主页"},- "main": {- "join_title": "加入 {{workspace_name}}",- "fallback_workspace_name": "工作区",- "invited_role_admin": "邀请你以管理员身份加入。",- "invited_role_member": "邀请你以成员身份加入。",- "already_handled_accepted": "此邀请已被接受。",- "already_handled_declined": "此邀请已被拒绝。",- "expired": "此邀请已过期。",- "decline": "拒绝",- "declining": "拒绝中...",- "accept": "接受并加入",- "joining": "加入中..."+ "linked": {+ "not_found": "此邀请可能已过期、已被撤销,或不属于你的账号。",+ "accepted": "此邀请已被接受。",+ "declined": "此邀请已被拒绝。",+ "expired": "此邀请已过期。"},"errors": {"accept_failed": "接受邀请失败","decline_failed": "拒绝邀请失败"- },- "batch": {- "log_out": "退出登录",- "empty_title": "没有待处理的邀请",- "empty_hint": "继续创建你自己的工作区。",- "empty_continue": "继续创建",- "title": "你被邀请加入工作区",- "subtitle": "选择你想加入的工作区。其余的可以之后在侧边栏处理。",- "submit_skip": "跳过,创建我自己的工作区",- "submit_join_other": "加入 {{count}} 个工作区",- "joining": "加入中...",- "error_generic": "处理邀请失败,请重试。",- "row_workspace_fallback": "工作区",- "row_inviter_fallback": "某人",- "row_invited_admin": "{{inviter}} 邀请你以管理员身份加入",- "row_invited_member": "{{inviter}} 邀请你以成员身份加入"}}diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.jsonindex 64d0445ece..528e15511b 100644--- a/packages/views/locales/zh-Hans/layout.json+++ b/packages/views/locales/zh-Hans/layout.json@@ -78,9 +78,6 @@"workspaces_label": "工作区","create_workspace": "创建工作区","pending_invitations_label": "待处理的邀请",- "invitation_workspace_fallback": "工作区",- "invitation_join": "加入",- "invitation_decline": "拒绝","log_out": "退出登录","new_issue": "新建任务","pinned_label": "固定",@@ -100,7 +97,6 @@"chat": "聊天","autopilots": "自动化","switch_workspace": "切换工作区",- "invitation_from": "{{name}} 邀请你加入","pin_workspace": "置顶工作区","unpin_workspace": "取消置顶","open_in_new_window": "在新窗口打开",diff --git a/packages/views/locales/zh-Hant/invite.json b/packages/views/locales/zh-Hant/invite.jsonindex 34bdde1799..eb0e6bf469 100644--- a/packages/views/locales/zh-Hant/invite.json+++ b/packages/views/locales/zh-Hant/invite.json@@ -3,51 +3,33 @@"back": "返回","log_out": "退出登入"},- "not_found": {- "title": "未找到邀請",- "description": "此邀請可能已過期、已被撤銷,或不屬於你的帳號。",- "go_to_dashboard": "前往主頁"- },- "accepted": {- "title": "你已加入 {{workspace_name}}!",- "redirecting": "正在跳轉到工作區..."+ "list": {+ "title": "你被邀請加入工作區",+ "subtitle": "加入後直接進入該工作區,其餘邀請會保留。",+ "workspace_fallback": "工作區",+ "inviter_fallback": "某人",+ "invited_admin": "{{inviter}} 邀請你以管理員身份加入",+ "invited_member": "{{inviter}} 邀請你以成員身份加入",+ "accept": "加入",+ "joining": "加入中...",+ "decline": "拒絕",+ "declining": "拒絕中...",+ "skip": "跳過,建立我自己的工作區"},- "declined": {- "title": "已拒絕邀請",- "description": "你將不會加入此工作區。",+ "empty": {+ "title": "沒有待處理的邀請",+ "hint": "繼續建立你自己的工作區。",+ "continue": "繼續建立","go_to_dashboard": "前往主頁"},- "main": {- "join_title": "加入 {{workspace_name}}",- "fallback_workspace_name": "工作區",- "invited_role_admin": "邀請你以管理員身份加入。",- "invited_role_member": "邀請你以成員身份加入。",- "already_handled_accepted": "此邀請已被接受。",- "already_handled_declined": "此邀請已被拒絕。",- "expired": "此邀請已過期。",- "decline": "拒絕",- "declining": "拒絕中...",- "accept": "接受並加入",- "joining": "加入中..."+ "linked": {+ "not_found": "此邀請可能已過期、已被撤銷,或不屬於你的帳號。",+ "accepted": "此邀請已被接受。",+ "declined": "此邀請已被拒絕。",+ "expired": "此邀請已過期。"},"errors": {"accept_failed": "接受邀請失敗","decline_failed": "拒絕邀請失敗"- },- "batch": {- "log_out": "退出登入",- "empty_title": "沒有待處理的邀請",- "empty_hint": "繼續建立你自己的工作區。",- "empty_continue": "繼續建立",- "title": "你被邀請加入工作區",- "subtitle": "選擇你想加入的工作區。其餘的可以之後在側邊欄處理。",- "submit_skip": "跳過,建立我自己的工作區",- "submit_join_other": "加入 {{count}} 個工作區",- "joining": "加入中...",- "error_generic": "處理邀請失敗,請重試。",- "row_workspace_fallback": "工作區",- "row_inviter_fallback": "某人",- "row_invited_admin": "{{inviter}} 邀請你以管理員身份加入",- "row_invited_member": "{{inviter}} 邀請你以成員身份加入"}}diff --git a/packages/views/locales/zh-Hant/layout.json b/packages/views/locales/zh-Hant/layout.jsonindex cabde46d08..9dc4d0b83e 100644--- a/packages/views/locales/zh-Hant/layout.json+++ b/packages/views/locales/zh-Hant/layout.json@@ -78,9 +78,6 @@"workspaces_label": "工作區","create_workspace": "建立工作區","pending_invitations_label": "待處理的邀請",- "invitation_workspace_fallback": "工作區",- "invitation_join": "加入",- "invitation_decline": "拒絕","log_out": "退出登入","new_issue": "新建任務","pinned_label": "固定",@@ -100,7 +97,6 @@"chat": "聊天","autopilots": "自動化","switch_workspace": "切換工作區",- "invitation_from": "{{name}} 邀請你加入","pin_workspace": "置頂工作區","unpin_workspace": "取消置頂","open_in_new_window": "在新視窗開啟",diff --git a/packages/views/package.json b/packages/views/package.jsonindex b15dd7cf74..653863d68d 100644--- a/packages/views/package.json+++ b/packages/views/package.json@@ -66,7 +66,6 @@"./dingtalk": "./dingtalk/index.ts","./wecom": "./wecom/index.ts","./telegram": "./telegram/index.ts",- "./invite": "./invite/index.ts","./invitations": "./invitations/index.ts","./onboarding": "./onboarding/index.ts","./star-prompt": "./star-prompt/index.ts",