From 5fd480427a8c933aada012b31ad02c1999b07229 Mon Sep 17 00:00:00 2001 From: lurius Date: Tue, 22 Oct 2024 15:06:57 +0200 Subject: [PATCH] fix(weg): display preview position were at wrong position --- .../modules/item/infra/UserApplication.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/apps/seelenweg/modules/item/infra/UserApplication.tsx b/src/apps/seelenweg/modules/item/infra/UserApplication.tsx index c60ab2ea..b065247b 100644 --- a/src/apps/seelenweg/modules/item/infra/UserApplication.tsx +++ b/src/apps/seelenweg/modules/item/infra/UserApplication.tsx @@ -3,11 +3,13 @@ import { Popover } from 'antd'; import { memo, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; -import { SeelenCommand, useWindowFocusChange } from 'seelen-core'; +import { SeelenCommand, SeelenWegSide, useWindowFocusChange } from 'seelen-core'; import { BackgroundByLayersV2 } from '../../../components/BackgroundByLayers/infra'; import { updatePreviews } from '../../shared/utils/infra'; +import { Selectors } from '../../shared/store/app'; + import { ExtendedPinnedWegItem, ExtendedTemporalWegItem, @@ -30,8 +32,28 @@ export const UserApplication = memo(({ item }: Props) => { ); const [openPreview, setOpenPreview] = useState(false); + const settings = useSelector(Selectors.settings); const { t } = useTranslation(); + const calculatePlacement = (position: any) => { + switch (position) { + case SeelenWegSide.Bottom: { + return 'top'; + } + case SeelenWegSide.Top: { + return 'bottom'; + } + case SeelenWegSide.Left: { + return 'right'; + } + case SeelenWegSide.Right: { + return 'left'; + } + default: { + return 'bottom'; + } + } + }; useWindowFocusChange((focused) => { if (!focused) { @@ -57,7 +79,7 @@ export const UserApplication = memo(({ item }: Props) => { setOpenPreview(open && !!item.opens.length)} trigger="hover" arrow={false}