diff --git a/src-tauri/gen/schemas/macOS-schema.json b/src-tauri/gen/schemas/macOS-schema.json index 1a966ca7..e4e98e92 100644 --- a/src-tauri/gen/schemas/macOS-schema.json +++ b/src-tauri/gen/schemas/macOS-schema.json @@ -7376,40 +7376,6 @@ "store:deny-values" ] }, - { - "type": "string", - "enum": [ - "theme:default" - ] - }, - { - "description": "theme:allow-get-theme -> Enables the get_theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "theme:allow-get-theme" - ] - }, - { - "description": "theme:allow-set-theme -> Enables the set_theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "theme:allow-set-theme" - ] - }, - { - "description": "theme:deny-get-theme -> Denies the get_theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "theme:deny-get-theme" - ] - }, - { - "description": "theme:deny-set-theme -> Denies the set_theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "theme:deny-set-theme" - ] - }, { "description": "updater:default -> This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n", "type": "string", diff --git a/src/components/note/user.tsx b/src/components/note/user.tsx index 02044147..a238b701 100644 --- a/src/components/note/user.tsx +++ b/src/components/note/user.tsx @@ -1,47 +1,15 @@ import { cn } from "@/commons"; -import { LumeWindow } from "@/system"; -import { Menu, MenuItem } from "@tauri-apps/api/menu"; -import { writeText } from "@tauri-apps/plugin-clipboard-manager"; -import { useCallback } from "react"; import { User } from "../user"; import { useNoteContext } from "./provider"; export function NoteUser({ className }: { className?: string }) { const event = useNoteContext(); - const showContextMenu = useCallback(async (e: React.MouseEvent) => { - e.preventDefault(); - - const menuItems = await Promise.all([ - MenuItem.new({ - text: "View Profile", - action: () => LumeWindow.openProfile(event.pubkey), - }), - MenuItem.new({ - text: "Copy Public Key", - action: async () => { - const pubkey = await event.pubkeyAsBech32(); - await writeText(pubkey); - }, - }), - ]); - - const menu = await Menu.new({ - items: menuItems, - }); - - await menu.popup().catch((e) => console.error(e)); - }, []); - return (
-
diff --git a/src/components/user/avatar.tsx b/src/components/user/avatar.tsx index 7e526658..fd845d1d 100644 --- a/src/components/user/avatar.tsx +++ b/src/components/user/avatar.tsx @@ -1,8 +1,11 @@ import { appSettings, cn } from "@/commons"; +import { LumeWindow } from "@/system"; import * as Avatar from "@radix-ui/react-avatar"; import { useStore } from "@tanstack/react-store"; +import { Menu, MenuItem } from "@tauri-apps/api/menu"; +import { writeText } from "@tauri-apps/plugin-clipboard-manager"; import { minidenticon } from "minidenticons"; -import { useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { useUserContext } from "./provider"; export function UserAvatar({ className }: { className?: string }) { @@ -30,8 +33,32 @@ export function UserAvatar({ className }: { className?: string }) { [user.pubkey], ); + const showContextMenu = useCallback(async (e: React.MouseEvent) => { + e.preventDefault(); + + const menuItems = await Promise.all([ + MenuItem.new({ + text: "View Profile", + action: () => LumeWindow.openProfile(user.pubkey), + }), + MenuItem.new({ + text: "Copy Public Key", + action: async () => { + await writeText(user.pubkey); + }, + }), + ]); + + const menu = await Menu.new({ + items: menuItems, + }); + + await menu.popup().catch((e) => console.error(e)); + }, []); + return ( showContextMenu(e)} className={cn( "shrink-0 block overflow-hidden bg-neutral-200 dark:bg-neutral-800", className,