mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-26 20:50:30 +08:00
feat: enable right-click context menu on subscription cards
This commit is contained in:
parent
daa8e7ba7e
commit
d6e456302e
@ -60,6 +60,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
const [selecting, setSelecting] = useState(false)
|
||||
const [openInfoEditor, setOpenInfoEditor] = useState(false)
|
||||
const [openFileEditor, setOpenFileEditor] = useState(false)
|
||||
const [dropdownOpen, setDropdownOpen] = useState(false)
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
@ -143,6 +144,12 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleContextMenu = (e: React.MouseEvent) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setDropdownOpen(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isDragging) {
|
||||
setTimeout(() => {
|
||||
@ -155,6 +162,8 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
}
|
||||
}, [isDragging])
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div
|
||||
className="grid col-span-1"
|
||||
@ -173,6 +182,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
updateProfileItem={updateProfileItem}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Card
|
||||
as="div"
|
||||
fullWidth
|
||||
@ -184,6 +194,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
setSelecting(false)
|
||||
})
|
||||
}}
|
||||
onContextMenu={handleContextMenu}
|
||||
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
|
||||
>
|
||||
<div ref={setNodeRef} {...attributes} {...listeners} className="w-full h-full">
|
||||
@ -218,7 +229,10 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Dropdown>
|
||||
<Dropdown
|
||||
isOpen={dropdownOpen}
|
||||
onOpenChange={setDropdownOpen}
|
||||
>
|
||||
<DropdownTrigger>
|
||||
<Button isIconOnly size="sm" variant="light" color="default">
|
||||
<IoMdMore
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user