diff --git a/apps/web/src/components/pure/workspace-list-modal/index.tsx b/apps/web/src/components/pure/workspace-list-modal/index.tsx index fd720c49c1..edf0a977b8 100644 --- a/apps/web/src/components/pure/workspace-list-modal/index.tsx +++ b/apps/web/src/components/pure/workspace-list-modal/index.tsx @@ -29,6 +29,7 @@ import { } from './styles'; interface WorkspaceModalProps { + disabled?: boolean; user: AccessTokenMessage | null; workspaces: AllWorkspace[]; currentWorkspaceId: AllWorkspace['id'] | null; @@ -43,6 +44,7 @@ interface WorkspaceModalProps { } export const WorkspaceListModal = ({ + disabled, open, onClose, workspaces, @@ -96,6 +98,7 @@ export const WorkspaceListModal = ({ { const oldIndex = workspaces.findIndex(w => w.id === activeId); const newIndex = workspaces.findIndex(w => w.id === overId); - setWorkspaces(workspaces => - arrayMove(workspaces, oldIndex, newIndex) + transition(() => + setWorkspaces(workspaces => + arrayMove(workspaces, oldIndex, newIndex) + ) ); }, [setWorkspaces, workspaces] diff --git a/packages/component/src/components/workspace-list/index.tsx b/packages/component/src/components/workspace-list/index.tsx index 6fe966160a..9cbb704e2f 100644 --- a/packages/component/src/components/workspace-list/index.tsx +++ b/packages/component/src/components/workspace-list/index.tsx @@ -12,6 +12,7 @@ import type { FC } from 'react'; import { WorkspaceCard } from '../workspace-card'; export type WorkspaceListProps = { + disabled?: boolean; currentWorkspaceId: string | null; items: (AffineWorkspace | LocalWorkspace)[]; onClick: (workspace: AffineWorkspace | LocalWorkspace) => void; @@ -27,11 +28,13 @@ const SortableWorkspaceItem: FC< const { setNodeRef, attributes, listeners, transform } = useSortable({ id: props.item.id, }); - const style = transform - ? { - transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`, - } - : undefined; + const style: React.CSSProperties = { + transform: transform + ? `translate3d(${transform.x}px, ${transform.y}px, 0)` + : undefined, + pointerEvents: props.disabled ? 'none' : undefined, + opacity: props.disabled ? 0.6 : undefined, + }; return (