diff --git a/apps/nextjs/src/app/[locale]/boards/(content)/_edit-actions.tsx b/apps/nextjs/src/app/[locale]/boards/(content)/_edit-actions.tsx
index b74e7f9de..0c9404897 100644
--- a/apps/nextjs/src/app/[locale]/boards/(content)/_edit-actions.tsx
+++ b/apps/nextjs/src/app/[locale]/boards/(content)/_edit-actions.tsx
@@ -1,5 +1,7 @@
"use client";
+import { useEffect, useRef } from "react";
+import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { Group, Menu } from "@mantine/core";
import { IconBox, IconChevronDown, IconLayoutGridAdd, IconPlug, IconPlus, IconResize } from "@tabler/icons-react";
@@ -28,6 +30,21 @@ const AddMenu = () => {
const { addContainer } = useContainerActions();
const { createItem } = useItemActions();
const t = useI18n();
+ const pathname = usePathname();
+ const router = useRouter();
+ const searchParams = useSearchParams();
+ const handledInitialAdd = useRef(false);
+
+ useEffect(() => {
+ if (handledInitialAdd.current || searchParams.get("add") !== "true") return;
+ handledInitialAdd.current = true;
+ openItemSelectModal({ boardId: board.id });
+
+ const nextSearchParams = new URLSearchParams(searchParams.toString());
+ nextSearchParams.delete("add");
+ const query = nextSearchParams.toString();
+ router.replace(query ? `${pathname}?${query}` : pathname, { scroll: false });
+ }, [board.id, openItemSelectModal, pathname, router, searchParams]);
const handleSelectItem = () => {
openItemSelectModal({ boardId: board.id });
@@ -54,7 +71,7 @@ const AddMenu = () => {
};
const handleAddIntegration = () => {
- openIntegrationSelectModal({});
+ openIntegrationSelectModal({ completionBoardId: board.id });
};
return (
diff --git a/apps/nextjs/src/components/board/audio/board-sounds.ts b/apps/nextjs/src/components/board/audio/board-sounds.ts
index 895b2a0ef..3d8c4bce8 100644
--- a/apps/nextjs/src/components/board/audio/board-sounds.ts
+++ b/apps/nextjs/src/components/board/audio/board-sounds.ts
@@ -7,17 +7,18 @@ let audioContext: AudioContext | null = null;
const getAudioContext = (): AudioContext | null => {
if (typeof window === "undefined") return null;
- if (!audioContext) {
- const AudioContextClass =
- window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext;
- if (AudioContextClass) {
- audioContext = new AudioContextClass();
+
+ try {
+ if (!audioContext) {
+ const AudioContextClass =
+ window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext;
+ if (AudioContextClass) audioContext = new AudioContextClass();
}
+ if (audioContext?.state === "suspended") void audioContext.resume().catch(() => undefined);
+ return audioContext;
+ } catch {
+ return null;
}
- if (audioContext && audioContext.state === "suspended") {
- void audioContext.resume();
- }
- return audioContext;
};
/**
@@ -41,50 +42,54 @@ export const playTrashSound = (volume = 0.35) => {
const ctx = getAudioContext();
if (!ctx) return;
- const now = ctx.currentTime;
-
- // Master Gain
- const masterGain = ctx.createGain();
- masterGain.gain.setValueAtTime(volume, now);
- masterGain.connect(ctx.destination);
-
- // 1. Downward sweep sub-oscillator (physical thud)
- const osc = ctx.createOscillator();
- const oscGain = ctx.createGain();
- osc.type = "triangle";
- osc.frequency.setValueAtTime(260, now);
- osc.frequency.exponentialRampToValueAtTime(35, now + 0.18);
- oscGain.gain.setValueAtTime(0.7, now);
- oscGain.gain.exponentialRampToValueAtTime(0.001, now + 0.18);
- osc.connect(oscGain);
- oscGain.connect(masterGain);
- osc.start(now);
- osc.stop(now + 0.2);
-
- // 2. High-crunch noise burst (crush / crumple texture)
try {
- const noiseBuffer = createNoiseBuffer(ctx, 0.22);
- const noiseSource = ctx.createBufferSource();
- noiseSource.buffer = noiseBuffer;
+ const now = ctx.currentTime;
- const noiseFilter = ctx.createBiquadFilter();
- noiseFilter.type = "bandpass";
- noiseFilter.frequency.setValueAtTime(1400, now);
- noiseFilter.frequency.exponentialRampToValueAtTime(320, now + 0.2);
- noiseFilter.Q.setValueAtTime(2.2, now);
+ // Master Gain
+ const masterGain = ctx.createGain();
+ masterGain.gain.setValueAtTime(volume, now);
+ masterGain.connect(ctx.destination);
- const noiseGain = ctx.createGain();
- noiseGain.gain.setValueAtTime(0.9, now);
- noiseGain.gain.exponentialRampToValueAtTime(0.001, now + 0.2);
+ // 1. Downward sweep sub-oscillator (physical thud)
+ const osc = ctx.createOscillator();
+ const oscGain = ctx.createGain();
+ osc.type = "triangle";
+ osc.frequency.setValueAtTime(260, now);
+ osc.frequency.exponentialRampToValueAtTime(35, now + 0.18);
+ oscGain.gain.setValueAtTime(0.7, now);
+ oscGain.gain.exponentialRampToValueAtTime(0.001, now + 0.18);
+ osc.connect(oscGain);
+ oscGain.connect(masterGain);
+ osc.start(now);
+ osc.stop(now + 0.2);
- noiseSource.connect(noiseFilter);
- noiseFilter.connect(noiseGain);
- noiseGain.connect(masterGain);
+ // 2. High-crunch noise burst (crush / crumple texture)
+ try {
+ const noiseBuffer = createNoiseBuffer(ctx, 0.22);
+ const noiseSource = ctx.createBufferSource();
+ noiseSource.buffer = noiseBuffer;
- noiseSource.start(now);
- noiseSource.stop(now + 0.22);
+ const noiseFilter = ctx.createBiquadFilter();
+ noiseFilter.type = "bandpass";
+ noiseFilter.frequency.setValueAtTime(1400, now);
+ noiseFilter.frequency.exponentialRampToValueAtTime(320, now + 0.2);
+ noiseFilter.Q.setValueAtTime(2.2, now);
+
+ const noiseGain = ctx.createGain();
+ noiseGain.gain.setValueAtTime(0.9, now);
+ noiseGain.gain.exponentialRampToValueAtTime(0.001, now + 0.2);
+
+ noiseSource.connect(noiseFilter);
+ noiseFilter.connect(noiseGain);
+ noiseGain.connect(masterGain);
+
+ noiseSource.start(now);
+ noiseSource.stop(now + 0.22);
+ } catch {
+ // The noise layer is optional; retain the oscillator when buffers are constrained.
+ }
} catch {
- // Ignore if audio buffer creation is constrained
+ // Sound feedback must never interrupt deleting board items.
}
};
@@ -95,20 +100,24 @@ export const playPopSound = (volume = 0.25) => {
const ctx = getAudioContext();
if (!ctx) return;
- const now = ctx.currentTime;
- const osc = ctx.createOscillator();
- const gain = ctx.createGain();
+ try {
+ const now = ctx.currentTime;
+ const osc = ctx.createOscillator();
+ const gain = ctx.createGain();
- osc.type = "sine";
- osc.frequency.setValueAtTime(460, now);
- osc.frequency.exponentialRampToValueAtTime(780, now + 0.05);
+ osc.type = "sine";
+ osc.frequency.setValueAtTime(460, now);
+ osc.frequency.exponentialRampToValueAtTime(780, now + 0.05);
- gain.gain.setValueAtTime(volume, now);
- gain.gain.exponentialRampToValueAtTime(0.001, now + 0.06);
+ gain.gain.setValueAtTime(volume, now);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.06);
- osc.connect(gain);
- gain.connect(ctx.destination);
+ osc.connect(gain);
+ gain.connect(ctx.destination);
- osc.start(now);
- osc.stop(now + 0.07);
+ osc.start(now);
+ osc.stop(now + 0.07);
+ } catch {
+ // Sound feedback must never interrupt selecting board items.
+ }
};
diff --git a/apps/nextjs/src/components/board/items/item-select-modal.spec.tsx b/apps/nextjs/src/components/board/items/item-select-modal.spec.tsx
index 9b429bcaf..1449ebd6c 100644
--- a/apps/nextjs/src/components/board/items/item-select-modal.spec.tsx
+++ b/apps/nextjs/src/components/board/items/item-select-modal.spec.tsx
@@ -96,7 +96,7 @@ describe("Advanced Add App - Modal Subcomponents", () => {
),
);
- expect(host.textContent?.trim()).toBe("");
+ expect(host.querySelector("[class*='Badge-root']")).toBeNull();
});
});
@@ -180,7 +180,7 @@ describe("Advanced Add App - Modal Subcomponents", () => {
expect(onSelect).toHaveBeenCalledOnce();
});
- it("marks card as selected when isSelected is true", async () => {
+ it("does not mark widget cards as selected", async () => {
const item = {
kind: "clock" as WidgetKind,
name: "Clock",
@@ -204,7 +204,7 @@ describe("Advanced Add App - Modal Subcomponents", () => {
);
const button = host.querySelector("button");
- expect(button?.getAttribute("data-selected")).toBe("true");
+ expect(button?.hasAttribute("data-selected")).toBe(false);
});
});
});
diff --git a/apps/nextjs/src/components/board/items/item-select-modal.tsx b/apps/nextjs/src/components/board/items/item-select-modal.tsx
index 7917103de..1b53094a9 100644
--- a/apps/nextjs/src/components/board/items/item-select-modal.tsx
+++ b/apps/nextjs/src/components/board/items/item-select-modal.tsx
@@ -484,7 +484,7 @@ const ItemSelectModalContent = ({
description={def.description ?? ""}
footerLeft={
- Custom Widget
+ {t("item.create.customWidget")}
}
/>
@@ -569,10 +569,12 @@ export const ConnectionStatusBadge = ({ status }: { status: WidgetConnectionStat
};
export const SupportedIntegrations = ({ integrations }: { integrations: IntegrationKind[] }) => {
+ const t = useI18n();
+
if (integrations.length === 0) {
return (
- Standalone
+ {t("item.create.standalone")}
);
}
diff --git a/apps/nextjs/src/components/board/selection/board-selection-context.tsx b/apps/nextjs/src/components/board/selection/board-selection-context.tsx
index 475ac0f83..a9395241f 100644
--- a/apps/nextjs/src/components/board/selection/board-selection-context.tsx
+++ b/apps/nextjs/src/components/board/selection/board-selection-context.tsx
@@ -7,10 +7,10 @@ import { notifications } from "@mantine/notifications";
import { useCurrentLayout, useRequiredBoard } from "@homarr/boards/context";
import { useEditMode } from "@homarr/boards/edit-mode";
-import { useUpdateBoard } from "@homarr/boards/updater";
+import { usePersistBoard } from "@homarr/boards/updater";
import { getBoardLaneColumnCount, getRootSectionLane } from "@homarr/definitions";
-import { showSuccessNotification } from "@homarr/notifications";
-import { useI18n } from "@homarr/translation/client";
+import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
+import { useI18n, useScopedI18n } from "@homarr/translation/client";
import type { ContainerSection, ItemLayout } from "~/app/[locale]/boards/_types";
import { getFirstEmptyPosition } from "~/components/board/items/actions/empty-position";
@@ -32,8 +32,23 @@ export const BoardSelectionProvider = ({ children }: PropsWithChildren) => {
const [isEditMode] = useEditMode();
const board = useRequiredBoard();
const currentLayoutId = useCurrentLayout();
- const { updateBoard } = useUpdateBoard();
+ const { updateAndPersistBoard } = usePersistBoard(board);
const t = useI18n();
+ const tSelection = useScopedI18n("item.selection");
+
+ const persistBoard = useCallback(
+ (updater: (previous: typeof board) => typeof board) => {
+ updateAndPersistBoard(updater, {
+ onError: () => {
+ showErrorNotification({
+ title: tSelection("saveErrorTitle"),
+ message: tSelection("saveErrorMessage"),
+ });
+ },
+ });
+ },
+ [tSelection, updateAndPersistBoard],
+ );
// Clear selection if leaving edit mode
useEffect(() => {
@@ -85,7 +100,7 @@ export const BoardSelectionProvider = ({ children }: PropsWithChildren) => {
playTrashSound();
clearSelection();
- updateBoard((previous) => ({
+ persistBoard((previous) => ({
...previous,
items: previous.items.filter((item) => !idsToRemove.includes(item.id)),
}));
@@ -96,12 +111,12 @@ export const BoardSelectionProvider = ({ children }: PropsWithChildren) => {
title: t("common.success"),
message: (
- {count === 1 ? "1 item removed" : `${count} items removed`}
+ {tSelection("removed", { count })}
- Move selected to section
+ {tSelection("moveTo")}
{placementOptions.map((opt) => (
moveSelectedItemsToSection(opt.value)}>
{opt.label}
@@ -224,11 +230,17 @@ export const BoardSelectionToolbar = () => {
leftSection={}
onClick={removeSelectedItems}
>
- Delete
+ {tSelection("delete")}
-
-
+
+
diff --git a/apps/nextjs/src/components/create/setup-analytics.ts b/apps/nextjs/src/components/create/setup-analytics.ts
index caacb89d7..59250ac03 100644
--- a/apps/nextjs/src/components/create/setup-analytics.ts
+++ b/apps/nextjs/src/components/create/setup-analytics.ts
@@ -37,7 +37,7 @@ export const useSetupAnalytics = () => {
onError() {
showErrorNotification({
title: t("common.error"),
- message: t("common.error"),
+ message: t("common.analyticsError"),
});
},
});
diff --git a/packages/modals-collection/src/apps/app-select-modal.spec.tsx b/packages/modals-collection/src/apps/app-select-modal.spec.tsx
index f5cf0bd12..ef9dfafd4 100644
--- a/packages/modals-collection/src/apps/app-select-modal.spec.tsx
+++ b/packages/modals-collection/src/apps/app-select-modal.spec.tsx
@@ -93,6 +93,14 @@ beforeEach(() => {
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
}));
+ vi.stubGlobal(
+ "ResizeObserver",
+ class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ },
+ );
host = document.createElement("div");
document.body.append(host);
root = createRoot(host);
diff --git a/packages/modals-collection/src/apps/app-select-modal.tsx b/packages/modals-collection/src/apps/app-select-modal.tsx
index 47e8f4616..c5f6a50cf 100644
--- a/packages/modals-collection/src/apps/app-select-modal.tsx
+++ b/packages/modals-collection/src/apps/app-select-modal.tsx
@@ -108,11 +108,11 @@ export const AppSelectModal = createModal(({ actions, inner
{multiSelect && (
- Tip: Hold Shift or Ctrl / ⌘ to select multiple apps at once
+ {t("app.action.select.multiSelectTip")}
{selectedAppIds.size > 0 && (
- {selectedAppIds.size} selected
+ {t("app.action.select.selectedCount", { count: selectedAppIds.size })}
)}
@@ -136,7 +136,7 @@ export const AppSelectModal = createModal(({ actions, inner
description={t("app.action.create.description")}
footerLeft={
- Custom Application
+ {t("app.action.select.customApplication")}
}
/>
@@ -166,7 +166,7 @@ export const AppSelectModal = createModal(({ actions, inner
- {selectedApps.length} app{selectedApps.length > 1 ? "s" : ""} selected
+ {t("app.action.select.appsSelected", { count: selectedApps.length })}