refactor(workspace): update terminology from search space to workspace

- Changed references from "search space" to "workspace" in various components for consistency.
- Updated the LayoutDataProvider to handle workspace data more effectively.
- Adjusted UI elements in IconRail and MobileSidebar to reflect the new terminology.
- Modified messages in the localization file to align with the updated terminology.
This commit is contained in:
Anish Sarkar 2026-07-06 10:09:30 +05:30
parent c379ab1155
commit ec617c1c6b
5 changed files with 24 additions and 13 deletions

View file

@ -214,7 +214,7 @@ export function DashboardClientLayout({
return (
<DocumentUploadDialogProvider>
<OnboardingTour />
<LayoutDataProvider workspaceId={workspaceId}>{children}</LayoutDataProvider>
<LayoutDataProvider searchSpaceId={workspaceId}>{children}</LayoutDataProvider>
</DocumentUploadDialogProvider>
);
}

View file

@ -111,8 +111,8 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
? Number(Array.isArray(params.chat_id) ? params.chat_id[0] : params.chat_id)
: currentThreadState.id;
// Fetch current search space (for caching purposes)
useQuery({
// Fetch current workspace as a fallback for the selector while the full list catches up.
const { data: currentWorkspace } = useQuery({
queryKey: cacheKeys.searchSpaces.detail(searchSpaceId),
queryFn: () => searchSpacesApiService.getSearchSpace({ id: Number(searchSpaceId) }),
enabled: !!searchSpaceId,
@ -267,11 +267,22 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
}));
}, [searchSpacesData]);
// Find active search space from list (has is_owner and member_count)
// Find active workspace from list, falling back to the route-scoped detail query.
const activeSearchSpace: SearchSpace | null = useMemo(() => {
if (!searchSpaceId || !searchSpaces.length) return null;
return searchSpaces.find((s) => s.id === Number(searchSpaceId)) ?? null;
}, [searchSpaceId, searchSpaces]);
if (!searchSpaceId) return null;
const searchSpaceIdNumber = Number(searchSpaceId);
const listedSpace = searchSpaces.find((s) => s.id === searchSpaceIdNumber);
if (listedSpace) return listedSpace;
if (!currentWorkspace || currentWorkspace.id !== searchSpaceIdNumber) return null;
return {
id: currentWorkspace.id,
name: currentWorkspace.name,
description: currentWorkspace.description,
isOwner: false,
memberCount: 0,
createdAt: currentWorkspace.created_at,
};
}, [currentWorkspace, searchSpaceId, searchSpaces]);
// Safety redirect: if the current search space is no longer in the user's list
// (e.g. deleted by background task, membership revoked), redirect to a valid space.
@ -280,7 +291,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
return;
if (searchSpaces.length > 0 && !activeSearchSpace) {
router.replace(`/dashboard/${searchSpaces[0].id}/new-chat`);
} else if (searchSpaces.length === 0 && searchSpacesLoaded) {
} else if (searchSpaces.length === 0 && searchSpacesLoaded && !activeSearchSpace) {
router.replace("/dashboard");
}
}, [

View file

@ -102,11 +102,11 @@ export function IconRail({
className="h-10 w-10 rounded-lg border-2 border-dashed border-muted-foreground/30 hover:border-muted-foreground/50"
>
<Plus className="h-5 w-5 text-muted-foreground" />
<span className="sr-only">Add search space</span>
<span className="sr-only">Add workspace</span>
</Button>
</TooltipTrigger>
<TooltipContent side="right" sideOffset={8}>
Add search space
Add workspace
</TooltipContent>
</Tooltip>

View file

@ -133,7 +133,7 @@ export function MobileSidebar({
className="h-10 w-10 shrink-0 rounded-lg border-2 border-dashed border-muted-foreground/30 hover:border-muted-foreground/50"
>
<Plus className="h-5 w-5 text-muted-foreground" />
<span className="sr-only">Add search space</span>
<span className="sr-only">Add workspace</span>
</Button>
</div>
</ScrollArea>

View file

@ -682,9 +682,9 @@
"no_archived_chats": "No archived chats",
"error_archiving_chat": "Failed to archive chat",
"new_chat": "New chat",
"select_search_space": "Select Search Space",
"select_search_space": "Select Workspace",
"manage_members": "Manage members",
"search_space_settings": "Search Space settings",
"search_space_settings": "Workspace settings",
"logs": "Logs",
"see_all_search_spaces": "See all search spaces",
"expand_sidebar": "Expand sidebar",