feat(sidebar): move Contribute (Voiceover) out of account popover into sidebar above Minigames
This commit is contained in:
parent
cfbdcb6a22
commit
88f060cead
3 changed files with 55 additions and 11 deletions
|
|
@ -37,6 +37,7 @@ import { CSS } from "@dnd-kit/utilities";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
import { NavContribute } from "@/components/frontend/blocks/NavContribute";
|
||||||
import { NavCore } from "@/components/frontend/blocks/NavCore";
|
import { NavCore } from "@/components/frontend/blocks/NavCore";
|
||||||
import { NavMinigames } from "@/components/frontend/blocks/NavMinigames";
|
import { NavMinigames } from "@/components/frontend/blocks/NavMinigames";
|
||||||
import { NavUser } from "@/components/frontend/blocks/NavUser";
|
import { NavUser } from "@/components/frontend/blocks/NavUser";
|
||||||
|
|
@ -385,6 +386,7 @@ export function AppSidebar({
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
)}
|
)}
|
||||||
|
<NavContribute />
|
||||||
<div className="pb-1"><NavMinigames games={minigameNav} /></div>
|
<div className="pb-1"><NavMinigames games={minigameNav} /></div>
|
||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
|
|
|
||||||
53
src/components/frontend/blocks/NavContribute.tsx
Normal file
53
src/components/frontend/blocks/NavContribute.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ChevronRight, Mic } from "lucide-react";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "@/components/ui/dropdown-menu";
|
||||||
|
import {
|
||||||
|
SidebarMenuButton,
|
||||||
|
SidebarMenuItem,
|
||||||
|
useSidebar,
|
||||||
|
} from "@/components/ui/sidebar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contribute sidebar dropdown. Previously a group inside the account popover
|
||||||
|
* (NavUser): a "Contribute" header with a single Voiceover entry. Kept as its
|
||||||
|
* own dropdown so it stays visually consistent with the adjacent Minigames
|
||||||
|
* entry and can grow to more contribution channels without a code change.
|
||||||
|
*/
|
||||||
|
export function NavContribute() {
|
||||||
|
const { isMobile } = useSidebar();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SidebarMenuItem>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<SidebarMenuButton size="sm">
|
||||||
|
<Mic />
|
||||||
|
<span>Contribute</span>
|
||||||
|
<ChevronRight className="ml-auto size-4 text-sidebar-foreground/50" />
|
||||||
|
</SidebarMenuButton>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent
|
||||||
|
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
||||||
|
side={isMobile ? "bottom" : "right"}
|
||||||
|
align="end"
|
||||||
|
sideOffset={4}
|
||||||
|
>
|
||||||
|
<DropdownMenuItem asChild>
|
||||||
|
<Link href="/voiceover">
|
||||||
|
<Mic />
|
||||||
|
Voiceover
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</SidebarMenuItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import {
|
||||||
ChevronsUpDown,
|
ChevronsUpDown,
|
||||||
FileTextIcon,
|
FileTextIcon,
|
||||||
LogOut,
|
LogOut,
|
||||||
Mic,
|
|
||||||
Users2,
|
Users2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
@ -131,16 +130,6 @@ export function NavUser({
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuGroup>
|
</DropdownMenuGroup>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuGroup>
|
|
||||||
<DropdownMenuLabel>Contribute</DropdownMenuLabel>
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/voiceover">
|
|
||||||
<Mic />
|
|
||||||
Voiceover
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuGroup>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuGroup>
|
<DropdownMenuGroup>
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href="/account">
|
<Link href="/account">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue