0.0.8.0
This commit is contained in:
+13
-10
@@ -18,6 +18,7 @@ import { useState, useRef, useEffect, useCallback } from "react"
|
||||
import { useRouter, usePathname, useSearchParams } from "next/navigation"
|
||||
import { useSession, signOut } from "next-auth/react"
|
||||
import { useDialog } from "@/components/ui/alert-dialog-custom"
|
||||
import { permissions } from "@/lib/permissions"
|
||||
|
||||
interface FamilyTree {
|
||||
id: string
|
||||
@@ -262,11 +263,11 @@ export function SiteHeader() {
|
||||
{currentTree?.id === tree.id && (
|
||||
<span className="text-primary">✓</span>
|
||||
)}
|
||||
{tree.ownerId === session?.user?.id && (
|
||||
{permissions.canDeleteTree(tree.currentUserRole) && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-destructive hover:text-destructive-foreground"
|
||||
size="icon"
|
||||
className="h-6 w-6 ml-auto"
|
||||
onClick={(e) => handleDeleteTree(tree, e)}
|
||||
disabled={deletingTreeId === tree.id}
|
||||
>
|
||||
@@ -277,13 +278,15 @@ export function SiteHeader() {
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => router.push('/trees/new')}
|
||||
className="cursor-pointer text-primary"
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
创建新家族树
|
||||
</DropdownMenuItem>
|
||||
{session && (
|
||||
<DropdownMenuItem
|
||||
onClick={() => router.push('/trees/new')}
|
||||
className="gap-2"
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
创建新家族树
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user