Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(web): move members page back to workspace sidebar with new table design

Andrej565b898c14eb
diff --git a/apps/web/src/components/nav-main.tsx b/apps/web/src/components/nav-main.tsx
index df9dbe55e..6ca846590 100644
--- a/apps/web/src/components/nav-main.tsx
+++ b/apps/web/src/components/nav-main.tsx
@@ -35,6 +35,14 @@ export function NavMain() {
window.location.pathname === `/dashboard/workspace/${workspace.id}`,
badge: null,
},
+ {
+ title: t("navigation:sidebar.members"),
+ url: `/dashboard/workspace/${workspace.id}/members`,
+ isActive:
+ window.location.pathname ===
+ `/dashboard/workspace/${workspace.id}/members`,
+ badge: null,
+ },
{
title: t("navigation:sidebar.invitations"),
url: "/dashboard/invitations",
diff --git a/apps/web/src/components/team/members-table.tsx b/apps/web/src/components/team/members-table.tsx
index 6aafd513d..5b9dcf4ce 100644
--- a/apps/web/src/components/team/members-table.tsx
+++ b/apps/web/src/components/team/members-table.tsx
@@ -1,4 +1,5 @@
-import { Mail, MoreHorizontal, Trash2, UserPlus } from "lucide-react";
+import { DEFAULT_ROLE_NAMES } from "@kaneo/permissions";
+import { EllipsisIcon, MailIcon, ShieldIcon, TrashIcon } from "lucide-react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import useCancelInvitation from "@/hooks/mutations/workspace-user/use-cancel-invitation";
@@ -6,6 +7,7 @@ import useDeleteWorkspaceUser from "@/hooks/mutations/workspace-user/use-delete-
import useUpdateWorkspaceUserRole from "@/hooks/mutations/workspace-user/use-update-workspace-user-role";
import useWorkspaceRoles from "@/hooks/queries/workspace/use-workspace-roles";
import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
+import { cn } from "@/lib/cn";
import { formatDateMedium } from "@/lib/format";
import { toast } from "@/lib/toast";
import type {
@@ -25,19 +27,7 @@ import {
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
import { Badge } from "../ui/badge";
import { Button } from "../ui/button";
-import {
- Empty,
- EmptyDescription,
- EmptyHeader,
- EmptyMedia,
- EmptyTitle,
-} from "../ui/empty";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "../ui/menu";
+import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
import {
Select,
SelectContent,
@@ -45,14 +35,48 @@ import {
SelectTrigger,
SelectValue,
} from "../ui/select";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "../ui/table";
type Props = {
workspaceId: string;
invitations: WorkspaceUserInvitation[];
users: WorkspaceUser[];
- onInvite: () => void;
};
+// Stable per-user pastel for the avatar fallback. Picks one of a curated set
+// of Tailwind tone pairs from a cheap string hash so the same user keeps the
+// same color across re-renders without server-side state.
+const AVATAR_TONES = [
+ "bg-rose-500/15 text-rose-600 dark:text-rose-300",
+ "bg-amber-500/15 text-amber-600 dark:text-amber-300",
+ "bg-sky-500/15 text-sky-600 dark:text-sky-300",
+ "bg-emerald-500/15 text-emerald-600 dark:text-emerald-300",
+ "bg-violet-500/15 text-violet-600 dark:text-violet-300",
+ "bg-indigo-500/15 text-indigo-600 dark:text-indigo-300",
+] as const;
+
+// Names that are NOT "truly custom" — viewer/member/admin are seeded as
+// editable workspace_role rows on every workspace creation, and owner is a
+// static built-in. The Select already lists them as built-ins, so we filter
+// them out of the custom-roles tail to avoid duplicate options.
+const RESERVED_ROLE_NAMES = new Set<string>([...DEFAULT_ROLE_NAMES, "owner"]);
+
+function toneFor(value: string): string {
+ let hash = 0;
+ for (let i = 0; i < value.length; i += 1) {
+ hash = (hash << 5) - hash + value.charCodeAt(i);
+ hash |= 0;
+ }
+ return AVATAR_TONES[Math.abs(hash) % AVATAR_TONES.length];
+}
+
function initials(value: string | null | undefined): string {
if (!value) return "?";
return value
@@ -63,26 +87,45 @@ function initials(value: string | null | undefined): string {
.join("");
}
-function MembersTable({ workspaceId, invitations, users, onInvite }: Props) {
+function capitalize(value: string): string {
+ if (!value) return value;
+ return value.charAt(0).toUpperCase() + value.slice(1);
+}
+
+function MembersTable({ workspaceId, invitations, users }: Props) {
+ const { t } = useTranslation();
const [memberToDelete, setMemberToDelete] = useState<WorkspaceUser | null>(
null,
);
const [invitationToCancel, setInvitationToCancel] =
useState<WorkspaceUserInvitation | null>(null);
- const { t } = useTranslation();
+
const { user: currentUser } = useAuth();
- const { mutateAsync: deleteWorkspaceUser, isPending } =
+ const { mutateAsync: deleteWorkspaceUser, isPending: isDeleting } =
useDeleteWorkspaceUser();
const { mutateAsync: cancelInvitation, isPending: isCancelling } =
useCancelInvitation();
const { mutateAsync: updateMemberRole } = useUpdateWorkspaceUserRole();
- const { data: customRoles = [] } = useWorkspaceRoles(workspaceId);
- const { isOwner, canManageTeam, canRemoveMembers, canInviteUsers } =
+ const { data: allWorkspaceRoles = [] } = useWorkspaceRoles(workspaceId);
+ const { canManageTeam, canRemoveMembers, canInviteUsers } =
useWorkspacePermission();
const canChangeRoles = Boolean(canManageTeam());
const canRemove = Boolean(canRemoveMembers());
const canInvite = Boolean(canInviteUsers());
+ const customRoles = allWorkspaceRoles.filter(
+ (role) => !RESERVED_ROLE_NAMES.has(role.role),
+ );
+
+ // Owner first, then everyone else (stable on ties so the original
+ // listMembers order is preserved within each group).
+ const sortedUsers = [...users].sort((a, b) => {
+ if (a.role === b.role) return 0;
+ if (a.role === "owner") return -1;
+ if (b.role === "owner") return 1;
+ return 0;
+ });
+
const pendingInvitations = invitations.filter(
(inv) => inv.status !== "accepted" && inv.status !== "canceled",
);
@@ -141,208 +184,218 @@ function MembersTable({ workspaceId, invitations, users, onInvite }: Props) {
return (
<>
- <div className="space-y-6">
- <div className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <h2 className="text-md font-medium">
- {t("team:members.sectionTitle", { defaultValue: "Members" })}
- </h2>
- <p className="text-xs text-muted-foreground">
- {users.length === 0
- ? t("team:members.emptyDescription", {
- defaultValue: "No members yet.",
- })
- : t("team:members.countDescription", {
- defaultValue:
- "{{count}} {{label}} with access to this workspace.",
- count: users.length,
- label: users.length === 1 ? "person" : "people",
- })}
- </p>
- </div>
- {canInvite && (
- <Button size="sm" onClick={onInvite} className="gap-1.5">
- <UserPlus className="w-3.5 h-3.5" />
- {t("team:members.inviteMember")}
- </Button>
- )}
- </div>
-
- <div className="border border-border rounded-md bg-sidebar overflow-hidden">
- {users.length === 0 ? (
- <Empty>
- <EmptyHeader>
- <EmptyMedia variant="icon">
- <UserPlus />
- </EmptyMedia>
- <EmptyTitle>{t("team:membersTable.emptyTitle")}</EmptyTitle>
- <EmptyDescription>
- {t("team:membersTable.emptyDescription")}
- </EmptyDescription>
- </EmptyHeader>
- </Empty>
- ) : (
- <ul className="divide-y divide-border">
- {users.map((member) => {
- const isSelf = currentUser?.id === member.userId;
- const showRoleSelect = canChangeRoles && !isSelf;
- return (
- <li
- key={member.user.email}
- className="flex items-center gap-4 px-4 py-3"
- >
- <Avatar className="h-9 w-9">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="ps-6 text-foreground font-medium">
+ {t("team:membersTable.columns.name", {
+ defaultValue: "Member",
+ })}
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ {t("team:membersTable.columns.role", { defaultValue: "Role" })}
+ </TableHead>
+ <TableHead className="text-foreground font-medium">
+ {t("team:membersTable.columns.joined", {
+ defaultValue: "Joined",
+ })}
+ </TableHead>
+ <TableHead className="w-px pe-6" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {sortedUsers.map((member) => {
+ const isSelf = currentUser?.id === member.userId;
+ const showRoleSelect =
+ canChangeRoles && !isSelf && member.role !== "owner";
+ const tone = toneFor(member.user.email);
+ return (
+ <TableRow key={member.user.email}>
+ <TableCell className="ps-6 py-3">
+ <div className="flex items-center gap-3">
+ <Avatar className={cn("size-8", tone)}>
<AvatarImage
src={member.user.image ?? ""}
- alt={member.user.name || ""}
+ alt={member.user.name ?? ""}
/>
- <AvatarFallback className="bg-muted text-muted-foreground text-xs">
+ <AvatarFallback className="bg-transparent text-[11px] font-medium">
{initials(member.user.name)}
</AvatarFallback>
</Avatar>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium truncate">
- {member.user.name}
- {isSelf && (
- <span className="ml-2 text-xs font-normal text-muted-foreground">
+ <div className="min-w-0">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium">
+ {member.user.name}
+ </span>
+ {isSelf ? (
+ <span className="text-xs text-muted-foreground">
({t("team:members.you", { defaultValue: "You" })})
</span>
- )}
- </p>
- <p className="text-xs text-muted-foreground truncate">
+ ) : null}
+ </div>
+ <div className="truncate text-xs text-muted-foreground">
{member.user.email}
- </p>
+ </div>
</div>
- {showRoleSelect ? (
- <Select
- value={member.role}
- onValueChange={(value) => {
- if (typeof value === "string" && value) {
- handleChangeRole(member, value);
- }
- }}
+ </div>
+ </TableCell>
+ <TableCell className="py-3">
+ {member.role === "owner" ? (
+ <Badge variant="outline" className="gap-1">
+ <ShieldIcon className="size-3" />
+ {t("team:roles.owner", { defaultValue: "Owner" })}
+ </Badge>
+ ) : showRoleSelect ? (
+ <Select
+ value={member.role}
+ onValueChange={(value) => {
+ if (typeof value === "string" && value) {
+ handleChangeRole(member, value);
+ }
+ }}
+ >
+ <SelectTrigger size="sm" className="h-8 w-32">
+ <SelectValue>
+ {t(`team:roles.${member.role}`, {
+ defaultValue: capitalize(member.role),
+ })}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="viewer">
+ {t("team:roles.viewer", { defaultValue: "Viewer" })}
+ </SelectItem>
+ <SelectItem value="member">
+ {t("team:roles.member", { defaultValue: "Member" })}
+ </SelectItem>
+ <SelectItem value="admin">
+ {t("team:roles.admin", { defaultValue: "Admin" })}
+ </SelectItem>
+ {/* Owner is intentionally NOT offered here: the better-auth
+ organization plugin requires an explicit ownership
+ transfer flow (a workspace must have exactly one owner).
+ That UI lives in workspace settings — TODO. */}
+ {customRoles.map((r) => (
+ <SelectItem key={r.id} value={r.role}>
+ {capitalize(r.role)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ ) : (
+ <Badge variant="secondary" className="capitalize">
+ {t(`team:roles.${member.role}`, {
+ defaultValue: capitalize(member.role),
+ })}
+ </Badge>
+ )}
+ </TableCell>
+ <TableCell className="py-3 text-sm text-muted-foreground tabular-nums">
+ {member.createdAt ? formatDateMedium(member.createdAt) : "—"}
+ </TableCell>
+ <TableCell className="pe-6 py-3 text-right">
+ {!isSelf && canRemove ? (
+ <Menu>
+ <MenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8 text-muted-foreground"
+ aria-label={t("team:membersTable.ariaRemoveMember")}
+ />
+ }
>
- <SelectTrigger size="sm" className="w-32">
- <SelectValue className="capitalize">
- {member.role}
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="viewer">Viewer</SelectItem>
- <SelectItem value="member">Member</SelectItem>
- <SelectItem value="admin">Admin</SelectItem>
- {isOwner && (
- <SelectItem value="owner">Owner</SelectItem>
- )}
- {customRoles.map((r) => (
- <SelectItem key={r.id} value={r.role}>
- {r.role.charAt(0).toUpperCase() + r.role.slice(1)}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- ) : (
- <Badge variant="secondary" className="capitalize">
- {member.role}
- </Badge>
- )}
- {!isSelf && canRemove && (
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- variant="ghost"
- size="icon"
- className="h-8 w-8 text-muted-foreground"
- aria-label={t(
- "team:membersTable.ariaRemoveMember",
- )}
- />
- }
- >
- <MoreHorizontal className="w-4 h-4" />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-44">
- <DropdownMenuItem
- className="text-destructive"
- onClick={() => setMemberToDelete(member)}
- >
- <Trash2 className="w-4 h-4" />
- {t("team:membersTable.removeMember")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )}
- </li>
- );
- })}
- </ul>
- )}
- </div>
- </div>
+ <EllipsisIcon className="size-4" />
+ </MenuTrigger>
+ <MenuPopup align="end">
+ <MenuItem onClick={() => setMemberToDelete(member)}>
+ <TrashIcon className="size-4" />
+ {t("team:membersTable.removeMember")}
+ </MenuItem>
+ </MenuPopup>
+ </Menu>
+ ) : null}
+ </TableCell>
+ </TableRow>
+ );
+ })}
- {pendingInvitations.length > 0 && (
- <div className="space-y-6">
- <div className="space-y-1">
- <h2 className="text-md font-medium">
- {t("team:invitations.sectionTitle", {
- defaultValue: "Pending invitations",
- })}
- </h2>
- <p className="text-xs text-muted-foreground">
- {t("team:invitations.countDescription", {
- defaultValue: "{{count}} {{label}} awaiting acceptance.",
- count: pendingInvitations.length,
- label:
- pendingInvitations.length === 1
- ? "invitation"
- : "invitations",
- })}
- </p>
- </div>
- <div className="border border-border rounded-md bg-sidebar overflow-hidden">
- <ul className="divide-y divide-border">
- {pendingInvitations.map((invitation) => (
- <li
- key={invitation.email}
- className="flex items-center gap-4 px-4 py-3"
- >
- <div className="flex h-9 w-9 items-center justify-center rounded-full bg-muted text-muted-foreground">
- <Mail className="w-4 h-4" />
+ {pendingInvitations.map((invitation) => (
+ <TableRow key={`invite-${invitation.id}`}>
+ <TableCell className="ps-6 py-3">
+ <div className="flex items-center gap-3">
+ <div className="flex size-8 items-center justify-center rounded-full bg-muted text-muted-foreground">
+ <MailIcon className="size-4" />
</div>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium truncate">
- {invitation.email}
- </p>
- <p className="text-xs text-muted-foreground">
- {t("team:invitations.expires", {
- defaultValue: "Expires {{date}}",
- date: invitation.expiresAt
- ? formatDateMedium(invitation.expiresAt)
- : "—",
- })}
- </p>
+ <div className="min-w-0">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium">
+ {invitation.email}
+ </span>
+ <Badge
+ variant="outline"
+ size="sm"
+ className="font-mono text-[9px] uppercase tracking-wider"
+ >
+ {t("team:invitations.pendingBadge", {
+ defaultValue: "pending",
+ })}
+ </Badge>
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {invitation.expiresAt
+ ? t("team:invitations.expires", {
+ defaultValue: "Expires {{date}}",
+ date: formatDateMedium(invitation.expiresAt),
+ })
+ : "—"}
+ </div>
</div>
- <Badge variant="outline" className="capitalize">
- {invitation.role}
- </Badge>
- {canInvite && (
- <Button
- variant="ghost"
- size="icon"
- onClick={() => setInvitationToCancel(invitation)}
- className="h-8 w-8 text-muted-foreground hover:text-destructive"
- aria-label={t("team:membersTable.ariaCancelInvitation")}
- >
- <Trash2 className="w-4 h-4" />
- </Button>
- )}
- </li>
- ))}
- </ul>
- </div>
- </div>
- )}
+ </div>
+ </TableCell>
+ <TableCell className="py-3">
+ <Badge variant="outline" className="capitalize">
+ {t(`team:roles.${invitation.role}`, {
+ defaultValue: capitalize(invitation.role),
+ })}
+ </Badge>
+ </TableCell>
+ <TableCell className="py-3 text-sm text-muted-foreground">
+ —
+ </TableCell>
+ <TableCell className="pe-6 py-3 text-right">
+ {canInvite ? (
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={() => setInvitationToCancel(invitation)}
+ className="h-8 w-8 text-muted-foreground hover:text-destructive"
+ aria-label={t("team:membersTable.ariaCancelInvitation")}
+ >
+ <TrashIcon className="size-4" />
+ </Button>
+ ) : null}
+ </TableCell>
+ </TableRow>
+ ))}
+
+ {users.length === 0 && pendingInvitations.length === 0 ? (
+ <TableRow>
+ <TableCell colSpan={4} className="py-16 text-center">
+ <div className="flex flex-col items-center gap-2 text-muted-foreground">
+ <p className="text-sm font-medium text-foreground">
+ {t("team:membersTable.emptyTitle")}
+ </p>
+ <p className="text-xs">
+ {t("team:membersTable.emptyDescription")}
+ </p>
+ </div>
+ </TableCell>
+ </TableRow>
+ ) : null}
+ </TableBody>
+ </Table>
<AlertDialog
open={!!memberToDelete}
@@ -361,14 +414,17 @@ function MembersTable({ workspaceId, invitations, users, onInvite }: Props) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose disabled={isPending}>
- <Button variant="outline" size="sm" disabled={isPending}>
+ <AlertDialogClose disabled={isDeleting}>
+ <Button variant="outline" size="sm" disabled={isDeleting}>
{t("common:actions.cancel")}
</Button>
</AlertDialogClose>
- <AlertDialogClose onClick={handleDeleteMember} disabled={isPending}>
- <Button variant="destructive" size="sm" disabled={isPending}>
- <Trash2 className="w-4 h-4 mr-2" />
+ <AlertDialogClose
+ onClick={handleDeleteMember}
+ disabled={isDeleting}
+ >
+ <Button variant="destructive" size="sm" disabled={isDeleting}>
+ <TrashIcon className="mr-2 size-4" />
{t("team:membersTable.removeMember")}
</Button>
</AlertDialogClose>
@@ -402,7 +458,7 @@ function MembersTable({ workspaceId, invitations, users, onInvite }: Props) {
disabled={isCancelling}
>
<Button variant="destructive" size="sm" disabled={isCancelling}>
- <Trash2 className="w-4 h-4 mr-2" />
+ <TrashIcon className="mr-2 size-4" />
{t("team:membersTable.cancelInvitation")}
</Button>
</AlertDialogClose>
diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts
index 63b6c0224..deb14e611 100644
--- a/apps/web/src/routeTree.gen.ts
+++ b/apps/web/src/routeTree.gen.ts
@@ -37,8 +37,8 @@ import { Route as LayoutAuthenticatedDashboardSettingsProjectsRouteImport } from
import { Route as LayoutAuthenticatedDashboardSettingsAccountRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account'
import { Route as LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRouteImport } from './routes/_layout/_authenticated/dashboard/workspace/$workspaceId/index'
import { Route as LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRouteImport } from './routes/_layout/_authenticated/dashboard/workspace/$workspaceId/search'
+import { Route as LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRouteImport } from './routes/_layout/_authenticated/dashboard/workspace/$workspaceId/members'
import { Route as LayoutAuthenticatedDashboardSettingsWorkspaceRolesRouteImport } from './routes/_layout/_authenticated/dashboard/settings/workspace/roles'
-import { Route as LayoutAuthenticatedDashboardSettingsWorkspaceMembersRouteImport } from './routes/_layout/_authenticated/dashboard/settings/workspace/members'
import { Route as LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRouteImport } from './routes/_layout/_authenticated/dashboard/settings/workspace/general'
import { Route as LayoutAuthenticatedDashboardSettingsAccountPreferencesRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/preferences'
import { Route as LayoutAuthenticatedDashboardSettingsAccountNotificationsRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/notifications'
@@ -207,18 +207,18 @@ const LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute =
path: '/search',
getParentRoute: () => LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRoute,
} as any)
+const LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute =
+ LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRouteImport.update({
+ id: '/members',
+ path: '/members',
+ getParentRoute: () => LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRoute,
+ } as any)
const LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute =
LayoutAuthenticatedDashboardSettingsWorkspaceRolesRouteImport.update({
id: '/roles',
path: '/roles',
getParentRoute: () => LayoutAuthenticatedDashboardSettingsWorkspaceRoute,
} as any)
-const LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute =
- LayoutAuthenticatedDashboardSettingsWorkspaceMembersRouteImport.update({
- id: '/members',
- path: '/members',
- getParentRoute: () => LayoutAuthenticatedDashboardSettingsWorkspaceRoute,
- } as any)
const LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute =
LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRouteImport.update({
id: '/general',
@@ -357,8 +357,8 @@ export interface FileRoutesByFullPath {
'/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
- '/dashboard/settings/workspace/members': typeof LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute
'/dashboard/settings/workspace/roles': typeof LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute
+ '/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
'/dashboard/workspace/$workspaceId/search': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute
'/dashboard/workspace/$workspaceId/': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute
'/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
@@ -398,8 +398,8 @@ export interface FileRoutesByTo {
'/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
- '/dashboard/settings/workspace/members': typeof LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute
'/dashboard/settings/workspace/roles': typeof LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute
+ '/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
'/dashboard/workspace/$workspaceId/search': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute
'/dashboard/workspace/$workspaceId': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute
'/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
@@ -445,8 +445,8 @@ export interface FileRoutesById {
'/_layout/_authenticated/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/_layout/_authenticated/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/_layout/_authenticated/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
- '/_layout/_authenticated/dashboard/settings/workspace/members': typeof LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute
'/_layout/_authenticated/dashboard/settings/workspace/roles': typeof LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute
+ '/_layout/_authenticated/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/search': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute
'/_layout/_authenticated/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
@@ -491,8 +491,8 @@ export interface FileRouteTypes {
| '/dashboard/settings/account/notifications'
| '/dashboard/settings/account/preferences'
| '/dashboard/settings/workspace/general'
- | '/dashboard/settings/workspace/members'
| '/dashboard/settings/workspace/roles'
+ | '/dashboard/workspace/$workspaceId/members'
| '/dashboard/workspace/$workspaceId/search'
| '/dashboard/workspace/$workspaceId/'
| '/dashboard/settings/projects/$projectId/general'
@@ -532,8 +532,8 @@ export interface FileRouteTypes {
| '/dashboard/settings/account/notifications'
| '/dashboard/settings/account/preferences'
| '/dashboard/settings/workspace/general'
- | '/dashboard/settings/workspace/members'
| '/dashboard/settings/workspace/roles'
+ | '/dashboard/workspace/$workspaceId/members'
| '/dashboard/workspace/$workspaceId/search'
| '/dashboard/workspace/$workspaceId'
| '/dashboard/settings/projects/$projectId/general'
@@ -578,8 +578,8 @@ export interface FileRouteTypes {
| '/_layout/_authenticated/dashboard/settings/account/notifications'
| '/_layout/_authenticated/dashboard/settings/account/preferences'
| '/_layout/_authenticated/dashboard/settings/workspace/general'
- | '/_layout/_authenticated/dashboard/settings/workspace/members'
| '/_layout/_authenticated/dashboard/settings/workspace/roles'
+ | '/_layout/_authenticated/dashboard/workspace/$workspaceId/members'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/search'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/'
| '/_layout/_authenticated/dashboard/settings/projects/$projectId/general'
@@ -801,6 +801,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRouteImport
parentRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRoute
}
+ '/_layout/_authenticated/dashboard/workspace/$workspaceId/members': {
+ id: '/_layout/_authenticated/dashboard/workspace/$workspaceId/members'
+ path: '/members'
+ fullPath: '/dashboard/workspace/$workspaceId/members'
+ preLoaderRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRouteImport
+ parentRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRoute
+ }
'/_layout/_authenticated/dashboard/settings/workspace/roles': {
id: '/_layout/_authenticated/dashboard/settings/workspace/roles'
path: '/roles'
@@ -808,13 +815,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceRolesRouteImport
parentRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceRoute
}
- '/_layout/_authenticated/dashboard/settings/workspace/members': {
- id: '/_layout/_authenticated/dashboard/settings/workspace/members'
- path: '/members'
- fullPath: '/dashboard/settings/workspace/members'
- preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceMembersRouteImport
- parentRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceRoute
- }
'/_layout/_authenticated/dashboard/settings/workspace/general': {
id: '/_layout/_authenticated/dashboard/settings/workspace/general'
path: '/general'
@@ -966,7 +966,6 @@ const LayoutAuthenticatedDashboardSettingsProjectsRouteWithChildren =
interface LayoutAuthenticatedDashboardSettingsWorkspaceRouteChildren {
LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
- LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute
LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute: typeof LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute
}
@@ -974,8 +973,6 @@ const LayoutAuthenticatedDashboardSettingsWorkspaceRouteChildren: LayoutAuthenti
{
LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute:
LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute,
- LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute:
- LayoutAuthenticatedDashboardSettingsWorkspaceMembersRoute,
LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute:
LayoutAuthenticatedDashboardSettingsWorkspaceRolesRoute,
}
@@ -1007,6 +1004,7 @@ const LayoutAuthenticatedDashboardSettingsRouteWithChildren =
)
interface LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRouteChildren {
+ LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute: typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
@@ -1018,6 +1016,8 @@ interface LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRouteChildren {
const LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRouteChildren: LayoutAuthenticatedDashboardWorkspaceWorkspaceIdRouteChildren =
{
+ LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute:
+ LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute,
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute:
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRoute,
LayoutAuthenticatedDashboardWorkspaceWorkspaceIdIndexRoute:
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx
index c96ae4604..951940936 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx
@@ -5,7 +5,7 @@ import {
redirect,
useLocation,
} from "@tanstack/react-router";
-import { Settings, Shield, Users } from "lucide-react";
+import { Settings, Shield } from "lucide-react";
import { useTranslation } from "react-i18next";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
@@ -56,11 +56,6 @@ function RouteComponent() {
url: "/dashboard/settings/workspace/general",
icon: Settings,
},
- {
- title: t("settings:workspaceMembers.title", { defaultValue: "Members" }),
- url: "/dashboard/settings/workspace/members",
- icon: Users,
- },
{
title: t("settings:workspaceRoles.title", { defaultValue: "Roles" }),
url: "/dashboard/settings/workspace/roles",
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/members.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/members.tsx
deleted file mode 100644
index abf659472..000000000
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/members.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { createFileRoute } from "@tanstack/react-router";
-import { Loader2 } from "lucide-react";
-import { useState } from "react";
-import { useTranslation } from "react-i18next";
-import PageTitle from "@/components/page-title";
-import InviteTeamMemberModal from "@/components/team/invite-team-member-modal";
-import MembersTable from "@/components/team/members-table";
-import useGetFullWorkspace from "@/hooks/queries/workspace/use-get-full-workspace";
-import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
-
-export const Route = createFileRoute(
- "/_layout/_authenticated/dashboard/settings/workspace/members",
-)({
- component: RouteComponent,
-});
-
-function RouteComponent() {
- const { t } = useTranslation();
- const { workspace } = useWorkspacePermission();
- const workspaceId = workspace?.id;
- const {
- data: fullWorkspace,
- isLoading,
- isError,
- error,
- } = useGetFullWorkspace({ workspaceId });
- const [isInviteOpen, setIsInviteOpen] = useState(false);
-
- return (
- <>
- <PageTitle
- title={t("settings:workspaceMembers.pageTitle", {
- defaultValue: "Members",
- })}
- />
- <div className="max-w-4xl mx-auto space-y-8">
- <div className="space-y-2">
- <h1 className="text-2xl font-semibold">
- {t("settings:workspaceMembers.title", { defaultValue: "Members" })}
- </h1>
- <p className="text-muted-foreground">
- {t("settings:workspaceMembers.subtitle", {
- defaultValue:
- "People with access to {{workspace}} and pending invitations.",
- workspace: workspace?.name ?? "this workspace",
- })}
- </p>
- </div>
-
- {!workspaceId || isLoading ? (
- <div className="flex items-center justify-center py-12 text-muted-foreground">
- <Loader2 className="w-4 h-4 animate-spin mr-2" />
- <span className="text-sm">
- {t("common:status.loading", { defaultValue: "Loading…" })}
- </span>
- </div>
- ) : isError ? (
- <div className="rounded-md border border-destructive/40 bg-destructive/5 p-4 text-sm text-destructive">
- {error instanceof Error
- ? error.message
- : t("settings:workspaceMembers.loadError", {
- defaultValue: "Failed to load members.",
- })}
- </div>
- ) : (
- <MembersTable
- workspaceId={workspaceId}
- users={fullWorkspace?.members ?? []}
- invitations={fullWorkspace?.invitations ?? []}
- onInvite={() => setIsInviteOpen(true)}
- />
- )}
-
- <InviteTeamMemberModal
- open={isInviteOpen}
- onClose={() => setIsInviteOpen(false)}
- />
- </div>
- </>
- );
-}
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/members.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/members.tsx
new file mode 100644
index 000000000..46e30589c
--- /dev/null
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/members.tsx
@@ -0,0 +1,59 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { UserPlus } from "lucide-react";
+import { useState } from "react";
+import { useTranslation } from "react-i18next";
+import WorkspaceLayout from "@/components/common/workspace-layout";
+import PageTitle from "@/components/page-title";
+import InviteTeamMemberModal from "@/components/team/invite-team-member-modal";
+import MembersTable from "@/components/team/members-table";
+import { Button } from "@/components/ui/button";
+import useGetFullWorkspace from "@/hooks/queries/workspace/use-get-full-workspace";
+import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
+
+export const Route = createFileRoute(
+ "/_layout/_authenticated/dashboard/workspace/$workspaceId/members",
+)({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const { t } = useTranslation();
+ const { workspaceId } = Route.useParams();
+ const { data: workspace } = useGetFullWorkspace({ workspaceId });
+ const { canInviteUsers } = useWorkspacePermission();
+ const canInvite = Boolean(canInviteUsers());
+ const [isInviteOpen, setIsInviteOpen] = useState(false);
+
+ return (
+ <>
+ <PageTitle title={t("team:members.pageTitle")} />
+ <WorkspaceLayout
+ title={t("team:members.pageTitle")}
+ headerActions={
+ canInvite ? (
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() => setIsInviteOpen(true)}
+ className="gap-1"
+ >
+ <UserPlus className="w-3 h-3" />
+ {t("team:members.inviteMember")}
+ </Button>
+ ) : null
+ }
+ >
+ <MembersTable
+ workspaceId={workspaceId}
+ users={workspace?.members ?? []}
+ invitations={workspace?.invitations ?? []}
+ />
+
+ <InviteTeamMemberModal
+ open={isInviteOpen}
+ onClose={() => setIsInviteOpen(false)}
+ />
+ </WorkspaceLayout>
+ </>
+ );
+}
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 128558e44..e06a8468a 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -1727,7 +1727,8 @@
"roles": {
"owner": "Owner",
"admin": "Admin",
- "member": "Member"
+ "member": "Member",
+ "viewer": "Viewer"
},
"members": {
"pageTitle": "Members",
@@ -1762,7 +1763,9 @@
"removeSuccess": "Team member removed successfully",
"removeError": "Failed to remove team member",
"cancelInviteSuccess": "Invitation cancelled successfully",
- "cancelInviteError": "Failed to cancel invitation"
+ "cancelInviteError": "Failed to cancel invitation",
+ "roleUpdateSuccess": "Role updated",
+ "roleUpdateError": "Failed to update role"
}
},
"publicProject": {