feat(board): add multi-item selection actions

This commit is contained in:
Thomas Camlong committed 2026-08-21 02:15:57 +02:00
1 parent f7acf18b58
commit 3a7cad9e2f
13 files changed
+753 -290

No files matched your search

@@ -11,6 +11,19 @@
border-color: var(--border-color) !important;
}
.settingsButton {
opacity: 0;
pointer-events: none;
transition: opacity 120ms ease;
}
:global([data-type="item"]:hover) .settingsButton,
:global([data-type="item"]:focus-within) .settingsButton,
.settingsButton[data-menu-open="true"] {
opacity: 1;
pointer-events: auto;
}
.editModeInertContent {
display: contents;
}
@@ -39,3 +52,9 @@
opacity: 1;
pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
.settingsButton {
transition: none;
}
}
@@ -25,7 +25,6 @@ import type { WidgetComponentProps, WidgetDefinition, WidgetRuntimeRef } from "@
import { loadWidgetResources, reduceWidgetOptionsWithDefinition } from "@homarr/widgets/manifest";
import type { SectionItem } from "~/app/[locale]/boards/_types";
import { useBoardSelection } from "../selection/board-selection-context";
import advancedFocusClasses from "../advanced-focus/advanced-focus.module.css";
import { useAdvancedFocus } from "../advanced-focus/context";
import { startAdvancedFocusEntrance } from "../advanced-focus/entrance";
@@ -60,18 +59,6 @@ type BoardItemCardProps = CardProps & {
const BoardItemCard = ({ item, innerRef, children, ...cardProps }: BoardItemCardProps) => {
const board = useRequiredBoard();
const [isEditMode] = useEditMode();
const { isSelected, toggleSelectItem, selectedItemIds } = useBoardSelection();
const selected = isSelected(item.id);
const handleClickCapture = (event: React.MouseEvent) => {
if (!isEditMode) return;
if (event.metaKey || event.ctrlKey || (selectedItemIds.size > 0 && !event.shiftKey)) {
event.preventDefault();
event.stopPropagation();
toggleSelectItem(item.id);
}
};
return (
<Card
@@ -80,8 +67,6 @@ const BoardItemCard = ({ item, innerRef, children, ...cardProps }: BoardItemCard
w="100%"
h="100%"
data-grid-item-content
data-board-item-selected={selected ? "true" : undefined}
onClickCapture={handleClickCapture}
className={combineClasses(
classes.itemCard,
`${item.kind}-wrapper`,
@@ -93,22 +78,12 @@ const BoardItemCard = ({ item, innerRef, children, ...cardProps }: BoardItemCard
root: {
"--opacity": board.opacity / 100,
containerType: "size",
outline: selected ? "3px solid var(--mantine-primary-color-filled)" : undefined,
outlineOffset: selected ? "2px" : undefined,
transition: "outline 150ms ease, box-shadow 150ms ease",
...getOverflowFromKind(item.kind, item.advancedOptions.customCssClasses.length > 0),
"--border-color": item.advancedOptions.borderColor !== "" ? item.advancedOptions.borderColor : undefined,
},
}}
p={0}
>
{selected && (
<Box pos="absolute" top={6} left={6} style={{ zIndex: 10, pointerEvents: "none" }}>
<Badge size="xs" variant="filled" color="primaryColor" radius="xl">
✓
</Badge>
</Box>
)}
{children}
</Card>
);
@@ -14,6 +14,7 @@ import { BoardRemoveConfirmationMenuItem } from "../remove-confirmation-menu-ite
import { useSectionContext } from "../sections/section-context";
import { useItemActions } from "./item-actions";
import { useOpenItemMoveModal } from "./item-move-modal";
import itemContentClasses from "./item-content.module.css";
import { LazyWidgetEditModal, preloadWidgetEditModal } from "./lazy-widget-edit-modal";
interface BoardItemMenuProps {
@@ -105,9 +106,11 @@ const BoardItemMenuInner = ({ item, definition, resetErrorBoundary }: BoardItemM
size={24}
radius="sm"
pos="absolute"
top={12}
right={8}
top={4}
right={4}
style={{ zIndex: 30 }}
className={itemContentClasses.settingsButton}
data-menu-open={isMenuOpen || undefined}
data-board-widget-settings
aria-label={tItem("menu.label.settingsFor", { name: label })}
>
@@ -118,7 +118,7 @@ describe("Advanced Add App - Modal Subcomponents", () => {
});
it("renders overflow indicator when 6 or more integrations are supported", async () => {
const integrations: IntegrationKind[] = ["sonarr", "radarr", "plex", "jellyfin", "emby", "kavita"];
const integrations: IntegrationKind[] = ["sonarr", "radarr", "plex", "jellyfin", "emby", "deluge"];
await act(async () =>
root.render(