From b9b938c6584007a12b578d8a8373584cc2200ffc Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Sun, 2 Aug 2026 08:05:25 +0200 Subject: [PATCH] fix: address board grid CI and review --- .../board/items/item-move-modal.tsx | 45 +++++--- packages/api/src/router/board.ts | 100 +++++++++++++----- packages/api/src/router/test/board.spec.ts | 21 ++++ packages/old-import/src/widgets/options.ts | 2 + 4 files changed, 128 insertions(+), 40 deletions(-) diff --git a/apps/nextjs/src/components/board/items/item-move-modal.tsx b/apps/nextjs/src/components/board/items/item-move-modal.tsx index 1fad1cd96..6d71bb47d 100644 --- a/apps/nextjs/src/components/board/items/item-move-modal.tsx +++ b/apps/nextjs/src/components/board/items/item-move-modal.tsx @@ -6,7 +6,7 @@ import { useCurrentLayout, useRequiredBoard } from "@homarr/boards/context"; import { getRootSectionLane } from "@homarr/definitions"; import { useZodForm } from "@homarr/form"; import { createModal, ModalFormFooter, modalSizeForm, useModalAction } from "@homarr/modals"; -import { useI18n } from "@homarr/translation/client"; +import { useScopedI18n } from "@homarr/translation/client"; import type { Board, ContainerSectionItem, SectionItem } from "~/app/[locale]/boards/_types"; import { getLayoutRowCount } from "../layout"; @@ -53,7 +53,9 @@ type MoveTargetCandidate = Omit & { }; export const ItemMoveModal = createModal(({ actions, innerProps }) => { - const t = useI18n(); + const tLandmark = useScopedI18n("board.landmark"); + const tContainer = useScopedI18n("section.container"); + const tMoveResize = useScopedI18n("item.moveResize"); const { board, commitSectionGrids, currentLayoutId, entry, sourceSectionId } = innerProps; const minimumSize = useMemo( () => getEntryMinimumSize(board, currentLayoutId, entry), @@ -62,19 +64,19 @@ export const ItemMoveModal = createModal(({ actions, innerProps }) = const targets = useMemo( () => getMoveTargets(board, currentLayoutId, entry, { - canvas: t("board.landmark.canvas"), - container: t("section.container.action.create"), - leftRail: t("board.landmark.leftRail"), - rightRail: t("board.landmark.rightRail"), - numbered: (name, index) => t("item.moveResize.target.numbered", { name, index: String(index) }), + canvas: tLandmark("canvas"), + container: tContainer("action.create"), + leftRail: tLandmark("leftRail"), + rightRail: tLandmark("rightRail"), + numbered: (name, index) => tMoveResize("target.numbered", { name, index: String(index) }), located: (name, location, index) => - t("item.moveResize.target.located", { + tMoveResize("target.located", { name, location, index: String(index), }), }), - [board, currentLayoutId, entry, t], + [board, currentLayoutId, entry, tContainer, tLandmark, tMoveResize], ); const targetById = useMemo(() => new Map(targets.map((target) => [target.id, target])), [targets]); const initialTarget = targetById.get(sourceSectionId) ?? targets[0]; @@ -127,7 +129,7 @@ export const ItemMoveModal = createModal(({ actions, innerProps }) = target.columnCount, ); if (target.maxRowCount !== null && getLayoutRowCount(resolvedTarget) > target.maxRowCount) { - form.setFieldError("height", t("item.moveResize.keyboard.boundary")); + form.setFieldError("height", tMoveResize("keyboard.boundary")); return; } @@ -149,7 +151,18 @@ export const ItemMoveModal = createModal(({ actions, innerProps }) = actions.closeModal(); focusMovedEntry(entry.id, target.id); }, - [actions, board, commitSectionGrids, currentLayoutId, entry, form, minimumSize, sourceSectionId, t, targetById], + [ + actions, + board, + commitSectionGrids, + currentLayoutId, + entry, + form, + minimumSize, + sourceSectionId, + targetById, + tMoveResize, + ], ); return ( @@ -157,7 +170,7 @@ export const ItemMoveModal = createModal(({ actions, innerProps }) =