Skip to content

Commit b4c7ef4

Browse files
committed
add wip context menu to clusters
1 parent 1d2c1b0 commit b4c7ef4

File tree

1 file changed

+33
-3
lines changed
  • apps/onelauncher/frontend/src/routes/app

1 file changed

+33
-3
lines changed

apps/onelauncher/frontend/src/routes/app/index.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import { useRecentCluster } from '@/hooks/useCluster';
66
import { bindings } from '@/main';
77
import { formatAsDuration, upperFirst } from '@/utils';
88
import { useCommand, useCommandMut, useCommandSuspense } from '@onelauncher/common';
9-
import { Button, Show } from '@onelauncher/common/components';
9+
import { Button, ContextMenu, Show } from '@onelauncher/common/components';
1010
import { createFileRoute, Link } from '@tanstack/react-router';
1111
import { convertFileSrc } from '@tauri-apps/api/core';
1212
import { PlayIcon } from '@untitled-theme/icons-react';
1313
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
14+
import { useRef, useState } from 'react';
1415

1516
export const Route = createFileRoute('/app/')({
1617
component: RouteComponent,
@@ -167,6 +168,8 @@ function ClusterCard({
167168
icon_url,
168169
stage,
169170
}: ClusterModel) {
171+
const ref = useRef<HTMLDivElement>(null);
172+
const [isOpen, setOpen] = useState(false);
170173
const launch = useCommandMut(() => bindings.core.launchCluster(id, null));
171174

172175
const handleLaunch = () => {
@@ -186,7 +189,7 @@ function ClusterCard({
186189
};
187190

188191
return (
189-
<>
192+
<div ref={ref}>
190193
<Link
191194
disabled={stage === 'downloading'}
192195
search={{
@@ -227,6 +230,33 @@ function ClusterCard({
227230
</div>
228231
</div>
229232
</Link>
230-
</>
233+
234+
<ContextMenu
235+
isOpen={isOpen}
236+
setOpen={setOpen}
237+
triggerRef={ref}
238+
>
239+
<ContextMenu.Item className="">
240+
Launch
241+
</ContextMenu.Item>
242+
<ContextMenu.Separator />
243+
<ContextMenu.Item className="">
244+
Rename
245+
</ContextMenu.Item>
246+
<ContextMenu.Item className="">
247+
Change Icon
248+
</ContextMenu.Item>
249+
<ContextMenu.Separator />
250+
<ContextMenu.Item className="">
251+
Properties
252+
</ContextMenu.Item>
253+
<ContextMenu.Item className="text-red-500">
254+
Delete
255+
</ContextMenu.Item>
256+
{/* <ContextMenu.Item className="">
257+
Export
258+
</ContextMenu.Item> */}
259+
</ContextMenu>
260+
</div>
231261
);
232262
}

0 commit comments

Comments
 (0)