From f823d610d0d9ac65ecf582c9196cb0c8773cddd5 Mon Sep 17 00:00:00 2001 From: LynithDev <61880709+LynithDev@users.noreply.github.com> Date: Sat, 11 May 2024 21:18:25 +0200 Subject: [PATCH] fix: Context Menu positioning --- desktop/src/bridge/game.ts | 25 +++++++++++++++++++ desktop/src/bridge/notifications.ts | 1 + .../src/ui/components/overlay/ContextMenu.tsx | 7 ++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/desktop/src/bridge/game.ts b/desktop/src/bridge/game.ts index 745292d1..24b06a94 100644 --- a/desktop/src/bridge/game.ts +++ b/desktop/src/bridge/game.ts @@ -1,7 +1,31 @@ import { invoke } from '@tauri-apps/api/core'; import { listen } from '@tauri-apps/api/event'; +const _test_cluster = { + cluster: { + id: 'd09575a6-7c17-4399-a7a3-a117fffa5420', + name: 'Placeholder Name', + createdAt: 1715454720, + cover: null, + group: null, + client: { + type: 'Vanilla', + }, + }, + manifest: { + id: '1.0 cluster', + manifest: { + id: '1.8.9', + javaVersion: { + majorVersion: 8, + }, + }, + }, +} as Core.ClusterWithManifest; + export async function getCluster(uuid: string): Promise { + return _test_cluster; + return await invoke( 'plugin:onelauncher|get_cluster', { uuid }, @@ -29,6 +53,7 @@ export async function getClustersGrouped(): Promise { + return [_test_cluster]; return await invoke('plugin:onelauncher|get_clusters'); } diff --git a/desktop/src/bridge/notifications.ts b/desktop/src/bridge/notifications.ts index 4f2e0229..431d9b2a 100644 --- a/desktop/src/bridge/notifications.ts +++ b/desktop/src/bridge/notifications.ts @@ -30,6 +30,7 @@ export async function clearNotifications(): Promise { } export async function getNotifications(): Promise { + return []; return await invoke('plugin:onelauncher|notifications_get'); } diff --git a/desktop/src/ui/components/overlay/ContextMenu.tsx b/desktop/src/ui/components/overlay/ContextMenu.tsx index 913789c1..d341df48 100644 --- a/desktop/src/ui/components/overlay/ContextMenu.tsx +++ b/desktop/src/ui/components/overlay/ContextMenu.tsx @@ -29,7 +29,10 @@ function ContextMenu(props: ContextMenuProps) { return ( { + el.style.left = `${pos().x}px`; + el.style.top = `${pos().y}px`; + }} visible={props.visible} setVisible={props.setVisible} > @@ -56,7 +59,7 @@ ContextMenu.Row = function (props: ContextMenuRowProps) { return (
props.onClick?.(e)} - class="flex items-center gap-x-2 m-px px-1.5 py-0.5 rounded-mdlg hover:bg-gray-0.05 active:bg-gray-0.10 [&>svg]:w-[18px]" + class="flex items-center gap-x-2 m-px px-1.5 py-0.5 rounded-lg hover:bg-gray-0.05 active:bg-gray-0.10 [&>svg]:w-[18px]" > {props.icon} {props.text}