Skip to content

Commit

Permalink
Add workspace picker
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Nov 15, 2024
1 parent bb20d57 commit e1f2695
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion extension/app/src/pages/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
Avatar,
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
LogoHorizontalColorLogo,
LogoutIcon,
} from "@dust-tt/sparkle";
import { useAuth } from "@extension/components/auth/AuthProvider";
import type { ProtectedRouteChildrenProps } from "@extension/components/auth/ProtectedRoute";
import { ConversationContainer } from "@extension/components/conversation/ConversationContainer";
import { ConversationsListButton } from "@extension/components/conversation/ConversationsListButton";
Expand All @@ -18,13 +20,40 @@ export const MainPage = ({
workspace,
handleLogout,
}: ProtectedRouteChildrenProps) => {
const { handleSelectWorkspace } = useAuth();

return (
<>
<div className="flex items-start justify-between">
<div className="flex items-center gap-2 pb-6">
<div className="flex flex-col gap-2 pb-6">
<Link to="https://dust.tt" target="_blank">
<LogoHorizontalColorLogo className="h-4 w-16" />
</Link>
{user.workspaces.length > 1 && (
<div className="flex flex-row items-center gap-2">
<p className="text-sm text-slate-500">Workspace:</p>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
label={workspace ? workspace.name : "Select workspace"}
variant="ghost"
isSelect
/>
</DropdownMenuTrigger>
<DropdownMenuContent>
{user.workspaces.map((w) => {
return (
<DropdownMenuItem
key={w.sId}
onClick={() => void handleSelectWorkspace(w.sId)}
label={w.name}
/>
);
})}
</DropdownMenuContent>
</DropdownMenu>
</div>
)}
</div>
<div className="flex items-center gap-2">
<ConversationsListButton size="md" />
Expand Down

0 comments on commit e1f2695

Please sign in to comment.