+
diff --git a/apps/nextjs/src/components/board/sections/category/category-actions.ts b/apps/nextjs/src/components/board/sections/category/category-actions.ts
index 1bd715439..f78144536 100644
--- a/apps/nextjs/src/components/board/sections/category/category-actions.ts
+++ b/apps/nextjs/src/components/board/sections/category/category-actions.ts
@@ -2,11 +2,7 @@ import { useCallback } from "react";
import { createId } from "@homarr/db/client";
-import type {
- CategorySection,
- EmptySection,
- Section,
-} from "~/app/[locale]/boards/_types";
+import type { CategorySection, EmptySection, Section } from "~/app/[locale]/boards/_types";
import { useUpdateBoard } from "~/app/[locale]/boards/(content)/_client";
interface AddCategory {
@@ -41,9 +37,7 @@ export const useCategoryActions = () => {
sections: [
// Place sections before the new category
...previous.sections.filter(
- (section) =>
- (section.kind === "category" || section.kind === "empty") &&
- section.position < position,
+ (section) => (section.kind === "category" || section.kind === "empty") && section.position < position,
),
{
id: createId(),
@@ -62,8 +56,7 @@ export const useCategoryActions = () => {
...previous.sections
.filter(
(section): section is CategorySection | EmptySection =>
- (section.kind === "category" || section.kind === "empty") &&
- section.position >= position,
+ (section.kind === "category" || section.kind === "empty") && section.position >= position,
)
.map((section) => ({
...section,
@@ -134,29 +127,19 @@ export const useCategoryActions = () => {
({ id, direction }: MoveCategory) => {
updateBoard((previous) => {
const currentCategory = previous.sections.find(
- (section): section is CategorySection =>
- section.kind === "category" && section.id === id,
+ (section): section is CategorySection => section.kind === "category" && section.id === id,
);
if (!currentCategory) return previous;
- if (currentCategory?.position === 1 && direction === "up")
- return previous;
- if (
- currentCategory?.position === previous.sections.length - 2 &&
- direction === "down"
- )
- return previous;
+ if (currentCategory?.position === 1 && direction === "up") return previous;
+ if (currentCategory?.position === previous.sections.length - 2 && direction === "down") return previous;
return {
...previous,
sections: previous.sections.map((section) => {
- if (section.kind !== "category" && section.kind !== "empty")
- return section;
+ if (section.kind !== "category" && section.kind !== "empty") return section;
const offset = direction === "up" ? -2 : 2;
// Move category and empty section
- if (
- section.position === currentCategory.position ||
- section.position - 1 === currentCategory.position
- ) {
+ if (section.position === currentCategory.position || section.position - 1 === currentCategory.position) {
return {
...section,
position: section.position + offset,
@@ -165,8 +148,7 @@ export const useCategoryActions = () => {
if (
direction === "up" &&
- (section.position === currentCategory.position - 2 ||
- section.position === currentCategory.position - 1)
+ (section.position === currentCategory.position - 2 || section.position === currentCategory.position - 1)
) {
return {
...section,
@@ -176,8 +158,7 @@ export const useCategoryActions = () => {
if (
direction === "down" &&
- (section.position === currentCategory.position + 2 ||
- section.position === currentCategory.position + 3)
+ (section.position === currentCategory.position + 2 || section.position === currentCategory.position + 3)
) {
return {
...section,
@@ -197,21 +178,18 @@ export const useCategoryActions = () => {
({ id: categoryId }: RemoveCategory) => {
updateBoard((previous) => {
const currentCategory = previous.sections.find(
- (section): section is CategorySection =>
- section.kind === "category" && section.id === categoryId,
+ (section): section is CategorySection => section.kind === "category" && section.id === categoryId,
);
if (!currentCategory) return previous;
const aboveWrapper = previous.sections.find(
(section): section is EmptySection =>
- section.kind === "empty" &&
- section.position === currentCategory.position - 1,
+ section.kind === "empty" && section.position === currentCategory.position - 1,
);
const removedWrapper = previous.sections.find(
(section): section is EmptySection =>
- section.kind === "empty" &&
- section.position === currentCategory.position + 1,
+ section.kind === "empty" && section.position === currentCategory.position + 1,
);
if (!aboveWrapper || !removedWrapper) return previous;
@@ -232,16 +210,10 @@ export const useCategoryActions = () => {
return {
...previous,
sections: [
- ...previous.sections.filter(
- (section) => section.position < currentCategory.position - 1,
- ),
+ ...previous.sections.filter((section) => section.position < currentCategory.position - 1),
{
...aboveWrapper,
- items: [
- ...aboveWrapper.items,
- ...previousCategoryItems,
- ...previousBelowWrapperItems,
- ],
+ items: [...aboveWrapper.items, ...previousCategoryItems, ...previousBelowWrapperItems],
},
...previous.sections
.filter(
diff --git a/apps/nextjs/src/components/board/sections/category/category-edit-modal.tsx b/apps/nextjs/src/components/board/sections/category/category-edit-modal.tsx
index ff01ac19a..16d25c4ce 100644
--- a/apps/nextjs/src/components/board/sections/category/category-edit-modal.tsx
+++ b/apps/nextjs/src/components/board/sections/category/category-edit-modal.tsx
@@ -16,41 +16,35 @@ interface InnerProps {
onSuccess: (category: Category) => void;
}
-export const CategoryEditModal = createModal
(
- ({ actions, innerProps }) => {
- const t = useI18n();
- const form = useZodForm(z.object({ name: z.string().min(1) }), {
- initialValues: {
- name: innerProps.category.name,
- },
- });
+export const CategoryEditModal = createModal(({ actions, innerProps }) => {
+ const t = useI18n();
+ const form = useZodForm(z.object({ name: z.string().min(1) }), {
+ initialValues: {
+ name: innerProps.category.name,
+ },
+ });
- return (
-
- );
- },
-).withOptions({});
+ return (
+
+ );
+}).withOptions({});
diff --git a/apps/nextjs/src/components/board/sections/category/category-menu-actions.tsx b/apps/nextjs/src/components/board/sections/category/category-menu-actions.tsx
index 8106334f7..fc7610deb 100644
--- a/apps/nextjs/src/components/board/sections/category/category-menu-actions.tsx
+++ b/apps/nextjs/src/components/board/sections/category/category-menu-actions.tsx
@@ -11,8 +11,7 @@ import { CategoryEditModal } from "./category-edit-modal";
export const useCategoryMenuActions = (category: CategorySection) => {
const { openModal } = useModalAction(CategoryEditModal);
const { openConfirmModal } = useConfirmModal();
- const { addCategory, moveCategory, removeCategory, renameCategory } =
- useCategoryActions();
+ const { addCategory, moveCategory, removeCategory, renameCategory } = useCategoryActions();
const t = useI18n();
const createCategoryAtPosition = useCallback(
diff --git a/apps/nextjs/src/components/board/sections/category/category-menu.tsx b/apps/nextjs/src/components/board/sections/category/category-menu.tsx
index e82326cda..be67285ff 100644
--- a/apps/nextjs/src/components/board/sections/category/category-menu.tsx
+++ b/apps/nextjs/src/components/board/sections/category/category-menu.tsx
@@ -67,14 +67,8 @@ const useActions = (category: CategorySection) => {
};
const useEditModeActions = (category: CategorySection) => {
- const {
- addCategoryAbove,
- addCategoryBelow,
- moveCategoryUp,
- moveCategoryDown,
- edit,
- remove,
- } = useCategoryMenuActions(category);
+ const { addCategoryAbove, addCategoryBelow, moveCategoryUp, moveCategoryDown, edit, remove } =
+ useCategoryMenuActions(category);
return [
{
diff --git a/apps/nextjs/src/components/board/sections/content.tsx b/apps/nextjs/src/components/board/sections/content.tsx
index 2d042f27b..85c9d35d8 100644
--- a/apps/nextjs/src/components/board/sections/content.tsx
+++ b/apps/nextjs/src/components/board/sections/content.tsx
@@ -5,12 +5,7 @@ import { useMemo } from "react";
import type { RefObject } from "react";
import { ActionIcon, Card, Menu } from "@mantine/core";
import { useElementSize } from "@mantine/hooks";
-import {
- IconDotsVertical,
- IconLayoutKanban,
- IconPencil,
- IconTrash,
-} from "@tabler/icons-react";
+import { IconDotsVertical, IconLayoutKanban, IconPencil, IconTrash } from "@tabler/icons-react";
import combineClasses from "clsx";
import { useAtomValue } from "jotai";
@@ -43,12 +38,7 @@ export const SectionContent = ({ items, refs }: Props) => {
return (
<>
{items.map((item) => (
-
+
))}
>
);
@@ -133,14 +123,9 @@ const ItemMenu = ({ offset, item }: { offset: number; item: Item }) => {
const { openModal } = useModalAction(WidgetEditModal);
const { openConfirmModal } = useConfirmModal();
const isEditMode = useAtomValue(editModeAtom);
- const { updateItemOptions, updateItemIntegrations, removeItem } =
- useItemActions();
- const { data: integrationData, isPending } =
- clientApi.integration.all.useQuery();
- const currentDefinition = useMemo(
- () => widgetImports[item.kind].definition,
- [item.kind],
- );
+ const { updateItemOptions, updateItemIntegrations, removeItem } = useItemActions();
+ const { data: integrationData, isPending } = clientApi.integration.all.useQuery();
+ const currentDefinition = useMemo(() => widgetImports[item.kind].definition, [item.kind]);
if (!isEditMode || isPending) return null;
@@ -164,9 +149,7 @@ const ItemMenu = ({ offset, item }: { offset: number; item: Item }) => {
integrationData: (integrationData ?? []).filter(
(integration) =>
"supportedIntegrations" in currentDefinition &&
- (currentDefinition.supportedIntegrations as string[]).some(
- (kind) => kind === integration.kind,
- ),
+ (currentDefinition.supportedIntegrations as string[]).some((kind) => kind === integration.kind),
),
integrationSupport: "supportedIntegrations" in currentDefinition,
});
@@ -185,34 +168,19 @@ const ItemMenu = ({ offset, item }: { offset: number; item: Item }) => {
return (