mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
chore: linting
This commit is contained in:
parent
2b1d33db19
commit
2789dd9629
4 changed files with 64 additions and 38 deletions
|
|
@ -207,7 +207,15 @@ export default function TeamManagementPage() {
|
|||
);
|
||||
|
||||
const handleUpdateRole = useCallback(
|
||||
async (roleId: number, data: { name?: string; description?: string | null; permissions?: string[]; is_default?: boolean }): Promise<Role> => {
|
||||
async (
|
||||
roleId: number,
|
||||
data: {
|
||||
name?: string;
|
||||
description?: string | null;
|
||||
permissions?: string[];
|
||||
is_default?: boolean;
|
||||
}
|
||||
): Promise<Role> => {
|
||||
const request: UpdateRoleRequest = {
|
||||
search_space_id: searchSpaceId,
|
||||
role_id: roleId,
|
||||
|
|
@ -961,7 +969,15 @@ function RolesTab({
|
|||
roles: Role[];
|
||||
groupedPermissions: Record<string, PermissionWithDescription[]>;
|
||||
loading: boolean;
|
||||
onUpdateRole: (roleId: number, data: { name?: string; description?: string | null; permissions?: string[]; is_default?: boolean }) => Promise<Role>;
|
||||
onUpdateRole: (
|
||||
roleId: number,
|
||||
data: {
|
||||
name?: string;
|
||||
description?: string | null;
|
||||
permissions?: string[];
|
||||
is_default?: boolean;
|
||||
}
|
||||
) => Promise<Role>;
|
||||
onDeleteRole: (roleId: number) => Promise<boolean>;
|
||||
onCreateRole: (data: CreateRoleRequest["data"]) => Promise<Role>;
|
||||
canUpdate: boolean;
|
||||
|
|
@ -1006,18 +1022,19 @@ function RolesTab({
|
|||
)}
|
||||
|
||||
{/* Edit Role Form */}
|
||||
{editingRoleId !== null && (() => {
|
||||
const roleToEdit = roles.find((r) => r.id === editingRoleId);
|
||||
if (!roleToEdit) return null;
|
||||
return (
|
||||
<EditRoleSection
|
||||
role={roleToEdit}
|
||||
groupedPermissions={groupedPermissions}
|
||||
onUpdateRole={onUpdateRole}
|
||||
onCancel={() => setEditingRoleId(null)}
|
||||
/>
|
||||
);
|
||||
})()}
|
||||
{editingRoleId !== null &&
|
||||
(() => {
|
||||
const roleToEdit = roles.find((r) => r.id === editingRoleId);
|
||||
if (!roleToEdit) return null;
|
||||
return (
|
||||
<EditRoleSection
|
||||
role={roleToEdit}
|
||||
groupedPermissions={groupedPermissions}
|
||||
onUpdateRole={onUpdateRole}
|
||||
onCancel={() => setEditingRoleId(null)}
|
||||
/>
|
||||
);
|
||||
})()}
|
||||
|
||||
{/* Roles Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
|
|
@ -1077,14 +1094,9 @@ function RolesTab({
|
|||
<MoreHorizontal className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
onCloseAutoFocus={(e) => e.preventDefault()}
|
||||
>
|
||||
<DropdownMenuContent align="end" onCloseAutoFocus={(e) => e.preventDefault()}>
|
||||
{canUpdate && (
|
||||
<DropdownMenuItem
|
||||
onClick={() => setEditingRoleId(role.id)}
|
||||
>
|
||||
<DropdownMenuItem onClick={() => setEditingRoleId(role.id)}>
|
||||
<Edit2 className="h-4 w-4 mr-2" />
|
||||
Edit Role
|
||||
</DropdownMenuItem>
|
||||
|
|
@ -2058,7 +2070,15 @@ function EditRoleSection({
|
|||
}: {
|
||||
role: Role;
|
||||
groupedPermissions: Record<string, PermissionWithDescription[]>;
|
||||
onUpdateRole: (roleId: number, data: { name?: string; description?: string | null; permissions?: string[]; is_default?: boolean }) => Promise<Role>;
|
||||
onUpdateRole: (
|
||||
roleId: number,
|
||||
data: {
|
||||
name?: string;
|
||||
description?: string | null;
|
||||
permissions?: string[];
|
||||
is_default?: boolean;
|
||||
}
|
||||
) => Promise<Role>;
|
||||
onCancel: () => void;
|
||||
}) {
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import { useAtomValue, useSetAtom } from "jotai";
|
|||
import { Globe, User, Users } from "lucide-react";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { createPublicChatSnapshotMutationAtom } from "@/atoms/public-chat-snapshots/public-chat-snapshots-mutation.atoms";
|
||||
import { currentThreadAtom, setThreadVisibilityAtom } from "@/atoms/chat/current-thread.atom";
|
||||
import { myAccessAtom } from "@/atoms/members/members-query.atoms";
|
||||
import { createPublicChatSnapshotMutationAtom } from "@/atoms/public-chat-snapshots/public-chat-snapshots-mutation.atoms";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue