From 85bbf0347c63b797e249e162aa5207dd99a37fc8 Mon Sep 17 00:00:00 2001 From: Pauline Date: Mon, 19 Aug 2024 09:34:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20popups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pauline --- .../src/ui/components/overlay/ContextMenu.tsx | 4 ++-- .../src/ui/components/overlay/Popup.tsx | 19 ++++++++----------- .../overlay/account/AccountsPopup.tsx | 4 ++-- .../notifications/NotificationPopup.tsx | 4 ++-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/apps/frontend/src/ui/components/overlay/ContextMenu.tsx b/apps/frontend/src/ui/components/overlay/ContextMenu.tsx index c4dcd824..54e35a2c 100644 --- a/apps/frontend/src/ui/components/overlay/ContextMenu.tsx +++ b/apps/frontend/src/ui/components/overlay/ContextMenu.tsx @@ -1,9 +1,9 @@ import { type Accessor, type JSX, createEffect, createSignal } from 'solid-js'; -import Popup from './Popup'; +import Popup, { type PopupProps } from './Popup'; type ContextMenuProps = { pos: Accessor<{ x: number; y: number }>; -} & Popup.PopupProps; +} & PopupProps; function ContextMenu(props: ContextMenuProps) { const [pos, setPos] = createSignal({ x: 0, y: 0 }); diff --git a/apps/frontend/src/ui/components/overlay/Popup.tsx b/apps/frontend/src/ui/components/overlay/Popup.tsx index 59e28ccd..f52521c4 100644 --- a/apps/frontend/src/ui/components/overlay/Popup.tsx +++ b/apps/frontend/src/ui/components/overlay/Popup.tsx @@ -8,18 +8,15 @@ import type { } from 'solid-js'; import { Portal } from 'solid-js/web'; -// eslint-disable-next-line ts/no-namespace -- todo -declare namespace Popup { - type PopupProps = Omit[0], 'children'> & ParentProps & { - visible: Accessor; - setVisible: Setter; - class?: string; - style?: JSX.CSSProperties | string; - mount?: Node; - }; -} +export type PopupProps = Omit[0], 'children'> & ParentProps & { + visible: Accessor; + setVisible: Setter; + class?: string; + style?: JSX.CSSProperties | string; + mount?: Node; +}; -function Popup(props: Popup.PopupProps) { +function Popup(props: PopupProps) { let popupRef!: HTMLDivElement; function onMouseDown(e: MouseEvent) { diff --git a/apps/frontend/src/ui/components/overlay/account/AccountsPopup.tsx b/apps/frontend/src/ui/components/overlay/account/AccountsPopup.tsx index 4ee10237..b19f3ae9 100644 --- a/apps/frontend/src/ui/components/overlay/account/AccountsPopup.tsx +++ b/apps/frontend/src/ui/components/overlay/account/AccountsPopup.tsx @@ -3,7 +3,7 @@ import { PlusIcon, Settings01Icon } from '@untitled-theme/icons-solid'; import { useNavigate } from '@solidjs/router'; import Button from '../../base/Button'; import PlayerHead from '../../game/PlayerHead'; -import Popup from '../Popup'; +import Popup, { type PopupProps } from '../Popup'; import useAccountController from './AddAccountModal'; import type { MinecraftCredentials } from '~bindings'; @@ -51,7 +51,7 @@ function AccountComponent(props: AccountComponentProps) { ); } -function AccountPopup(props: Popup.PopupProps) { +function AccountPopup(props: PopupProps) { const controller = useAccountController(); const filteredAccounts = () => controller.accounts()?.filter(account => account.id !== controller.defaultAccount()?.id) ?? []; diff --git a/apps/frontend/src/ui/components/overlay/notifications/NotificationPopup.tsx b/apps/frontend/src/ui/components/overlay/notifications/NotificationPopup.tsx index b8479579..61326c17 100644 --- a/apps/frontend/src/ui/components/overlay/notifications/NotificationPopup.tsx +++ b/apps/frontend/src/ui/components/overlay/notifications/NotificationPopup.tsx @@ -1,12 +1,12 @@ import { For, Match, Switch } from 'solid-js'; import { Settings01Icon, Trash01Icon } from '@untitled-theme/icons-solid'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-solid'; -import Popup from '../Popup'; +import Popup, { type PopupProps } from '../Popup'; import Button from '../../base/Button'; import NotificationComponent from './NotificationComponent'; import useNotifications from '~ui/hooks/useNotifications'; -function NotificationPopup(props: Popup.PopupProps) { +function NotificationPopup(props: PopupProps) { const [notifications] = useNotifications(updateSize); let inner!: HTMLDivElement;