Skip to content

Commit

Permalink
feat: add missing context menu icon for selected space (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeaury authored Nov 21, 2024
1 parent 9842913 commit 018d2c3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Settings,
MessageSquare,
Share2,
Check,
} from "lucide-react";
import Link from "next/link";
import { classNames } from "@cap/utils";
Expand All @@ -22,6 +23,7 @@ import {
} from "@cap/ui";
import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";
import { useState } from "react";

import {
Dialog,
DialogContent,
Expand Down Expand Up @@ -143,8 +145,10 @@ export const AdminNavItems = () => {
<CommandInput placeholder="Search spaces..." />
<CommandEmpty>No spaces found.</CommandEmpty>
<CommandGroup>
{spaceData !== null &&
spaceData?.map((space) => (
{spaceData?.map((space) => {
const isSelected = activeSpace?.space.id === space.space.id;

return (
<CommandItem
key={space.space.name + "-space"}
onSelect={async () => {
Expand All @@ -153,8 +157,16 @@ export const AdminNavItems = () => {
}}
>
{space.space.name}
<Check
size={18}
className={classNames(
"ml-auto",
isSelected ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
);
})}
<DialogTrigger className="w-full">
<CommandItem className=" bg-filler aria-selected:bg-gray-200 rounded-lg">
<Plus className="w-4 h-auto mr-1" />
Expand Down

1 comment on commit 018d2c3

@vercel
Copy link

@vercel vercel bot commented on 018d2c3 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.