fix(ci): add css module types and resolve typecheck/lint warnings in UI and modals

This commit is contained in:
Thomas Camlong committed 2026-08-21 00:48:39 +02:00
1 parent 7a7d4449c1
commit 858af3a48a
7 files changed
+130 -118

No files matched your search

@@ -161,7 +161,7 @@ describe("Advanced Add App - Modal Subcomponents", () => {
await act(async () => await act(async () =>
root.render( root.render(
<MantineProvider> <MantineProvider>
<WidgetItem item={item} isSelected={false} connectionStatus="ready" onSelect={onSelect} /> <WidgetItem item={item} disabled={false} loading={false} connectionStatus="ready" onSelect={onSelect} />
</MantineProvider>, </MantineProvider>,
), ),
); );
@@ -192,7 +192,13 @@ describe("Advanced Add App - Modal Subcomponents", () => {
await act(async () => await act(async () =>
root.render( root.render(
<MantineProvider> <MantineProvider>
<WidgetItem item={item} isSelected={true} connectionStatus="noConnectionRequired" onSelect={vi.fn()} /> <WidgetItem
item={item}
disabled={false}
loading={false}
connectionStatus="noConnectionRequired"
onSelect={vi.fn()}
/>
</MantineProvider>, </MantineProvider>,
), ),
); );
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useRef, useState } from "react"; import { useMemo, useRef, useState } from "react";
import { import {
Avatar, Avatar,
Badge, Badge,
@@ -66,7 +66,7 @@ interface ItemSelectModalContentProps {
initialSearch?: string; initialSearch?: string;
} }
interface WidgetItemData { export interface WidgetItemData {
kind: WidgetKind; kind: WidgetKind;
supportedIntegrations: IntegrationKind[]; supportedIntegrations: IntegrationKind[];
icon: TablerIcon; icon: TablerIcon;
@@ -556,7 +556,7 @@ export const WidgetItem = ({
); );
}; };
const ConnectionStatusBadge = ({ status }: { status: WidgetConnectionStatus }) => { export const ConnectionStatusBadge = ({ status }: { status: WidgetConnectionStatus }) => {
if (status === "noConnectionRequired") return null; if (status === "noConnectionRequired") return null;
const t = useI18n(); const t = useI18n();
const color = status === "ready" ? "green" : status === "needsSetup" ? "yellow" : "gray"; const color = status === "ready" ? "green" : status === "needsSetup" ? "yellow" : "gray";
@@ -568,7 +568,7 @@ const ConnectionStatusBadge = ({ status }: { status: WidgetConnectionStatus }) =
); );
}; };
const SupportedIntegrations = ({ integrations }: { integrations: IntegrationKind[] }) => { export const SupportedIntegrations = ({ integrations }: { integrations: IntegrationKind[] }) => {
if (integrations.length === 0) { if (integrations.length === 0) {
return ( return (
<Text size="xs" c="dimmed" fs="italic"> <Text size="xs" c="dimmed" fs="italic">
@@ -0,0 +1,7 @@
declare const classes: {
readonly root: string;
readonly header: string;
readonly body: string;
readonly footer: string;
};
export default classes;
@@ -3,7 +3,7 @@
import { act, createRef } from "react"; import { act, createRef } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import type { Root } from "react-dom/client"; import type { Root } from "react-dom/client";
import { Badge, MantineProvider, Text } from "@mantine/core"; import { Badge, MantineProvider } from "@mantine/core";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { SelectableCard } from "./selectable-card"; import { SelectableCard } from "./selectable-card";
@@ -7,7 +7,6 @@ import {
factory, factory,
Group, Group,
LoadingOverlay, LoadingOverlay,
Stack,
Text, Text,
Tooltip, Tooltip,
useProps, useProps,
@@ -54,124 +53,126 @@ const varsResolver = createVarsResolver<SelectableCardFactory>((_theme, { radius
}, },
})); }));
export const SelectableCard = factory<SelectableCardFactory>((_props, ref) => { export const SelectableCard = factory<SelectableCardFactory>(
const props = useProps("SelectableCard", defaultProps, _props); (_props: SelectableCardProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
const { const props = useProps("SelectableCard", defaultProps, _props);
classNames, const {
className, classNames,
style, className,
styles, style,
unstyled, styles,
vars, unstyled,
attributes, vars,
icon, attributes,
title, icon,
topRight, title,
description, topRight,
footerLeft, description,
footerRight, footerLeft,
selected, footerRight,
loading = false, selected,
disabled = false, loading = false,
children, disabled = false,
type = "button", children,
...others type = "button",
} = props; ...others
} = props;
const getStyles = useStyles<SelectableCardFactory>({ const getStyles = useStyles<SelectableCardFactory>({
name: "SelectableCard", name: "SelectableCard",
classes, classes,
props, props,
className, className,
style, style,
classNames, classNames,
styles, styles,
unstyled, unstyled,
vars, vars,
attributes, attributes,
varsResolver, varsResolver,
}); });
return ( return (
<Box <Box
component="button" component="button"
type={type} type={type}
ref={ref} ref={ref}
disabled={disabled || loading} disabled={disabled || loading}
data-selected={selected || undefined} data-selected={selected || undefined}
aria-pressed={selected !== undefined ? selected : undefined} aria-pressed={selected !== undefined ? selected : undefined}
{...getStyles("root")} {...getStyles("root")}
{...others} {...others}
> >
<LoadingOverlay visible={loading} loaderProps={{ size: "sm" }} /> <LoadingOverlay visible={loading} loaderProps={{ size: "sm" }} />
{/* Header Section: Inset background with Title that never elides before the category */} {/* Header Section: Inset background with Title that never elides before the category */}
{(icon || title || topRight) && ( {(icon || title || topRight) && (
<Box {...getStyles("header")}> <Box {...getStyles("header")}>
<Group <Group
justify="space-between" justify="space-between"
align="center" align="center"
wrap="nowrap" wrap="nowrap"
gap="xs" gap="xs"
style={{ width: "100%", overflow: "hidden" }} style={{ width: "100%", overflow: "hidden" }}
> >
<Group gap="xs" wrap="nowrap" style={{ flex: "1 1 auto", minWidth: 0, overflow: "hidden" }}> <Group gap="xs" wrap="nowrap" style={{ flex: "1 1 auto", minWidth: 0, overflow: "hidden" }}>
{icon} {icon}
{typeof title === "string" ? ( {typeof title === "string" ? (
<Text <Text
fw={700} fw={700}
size="md" size="md"
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{title}
</Text>
) : (
title
)}
</Group>
{topRight && (
<Box
style={{ style={{
overflow: "hidden", minWidth: 0,
textOverflow: "ellipsis", flexShrink: 0,
whiteSpace: "nowrap",
}} }}
> >
{title} {topRight}
</Text> </Box>
) : (
title
)} )}
</Group> </Group>
{topRight && ( </Box>
<Box )}
style={{
minWidth: 0,
flexShrink: 0,
}}
>
{topRight}
</Box>
)}
</Group>
</Box>
)}
{/* Body: Custom Children or Default Description */} {/* Body: Custom Children or Default Description */}
{children ? ( {children ? (
<Box {...getStyles("body")}>{children}</Box> <Box {...getStyles("body")}>{children}</Box>
) : description !== undefined ? ( ) : description !== undefined ? (
<Box {...getStyles("body")}> <Box {...getStyles("body")}>
<Tooltip label={description} multiline w={260} disabled={!description}> <Tooltip label={description} multiline w={260} disabled={!description}>
<Text size="sm" c="dimmed" lineClamp={2} lh={1.35}> <Text size="sm" c="dimmed" lineClamp={2} lh={1.35}>
{description || "No description provided"} {description || "No description provided"}
</Text> </Text>
</Tooltip> </Tooltip>
</Box> </Box>
) : null} ) : null}
{/* Footer Section: Inset Dashed Bottom Meta */} {/* Footer Section: Inset Dashed Bottom Meta */}
{(footerLeft || footerRight) && ( {(footerLeft || footerRight) && (
<Box {...getStyles("footer")}> <Box {...getStyles("footer")}>
<Group justify="space-between" align="center" wrap="nowrap" gap="xs" style={{ width: "100%" }}> <Group justify="space-between" align="center" wrap="nowrap" gap="xs" style={{ width: "100%" }}>
<Box style={{ minWidth: 0, flexShrink: 1 }}>{footerLeft}</Box> <Box style={{ minWidth: 0, flexShrink: 1 }}>{footerLeft}</Box>
<Box style={{ minWidth: 0, flexShrink: 0 }}>{footerRight}</Box> <Box style={{ minWidth: 0, flexShrink: 0 }}>{footerRight}</Box>
</Group> </Group>
</Box> </Box>
)} )}
</Box> </Box>
); );
}); },
);
SelectableCard.displayName = "@homarr/ui/SelectableCard"; SelectableCard.displayName = "@homarr/ui/SelectableCard";
SelectableCard.classes = classes; SelectableCard.classes = classes;
@@ -13,7 +13,6 @@ import {
IconBuildingBank, IconBuildingBank,
IconBusStop, IconBusStop,
IconCalendar, IconCalendar,
IconCalendarWeek,
IconChartBar, IconChartBar,
IconClock, IconClock,
IconClockPlay, IconClockPlay,
-1
View File
@@ -15,7 +15,6 @@ import {
IconBuildingBank, IconBuildingBank,
IconBusStop, IconBusStop,
IconCalendar, IconCalendar,
IconCalendarWeek,
IconChartAreaLine, IconChartAreaLine,
IconChartBar, IconChartBar,
IconClock, IconClock,