feat!: release v2 (#6545)
Co-authored-by: Artur <145776561+arturict@users.noreply.github.com> Co-authored-by: arturict <arturict@users.noreply.github.com> Co-authored-by: Thomas <thomas@ajnart.fr> Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com> Co-authored-by: Danura30082 <danura30082+github@gmail.com> Co-authored-by: Kushie <122986913+kushiemoon-dev@users.noreply.github.com> Co-authored-by: ajnart <thomas@ajnart.fr> Co-authored-by: ajnart <thomas@ajnart.dev> Co-authored-by: chenjun <chenjun@foxmail.com> Co-authored-by: Wikibear <wikibear@users.noreply.github.com> Co-authored-by: Bergasha <bergasha@gmail.com> Co-authored-by: leafyelin <43306196+leafyelin@users.noreply.github.com> Co-authored-by: Lucas Araujo <lucas.lra@gmail.com> Co-authored-by: GreenMonito <86085570+GreenMonito@users.noreply.github.com> Co-authored-by: Nerdy-Technician <roffo@nerdy-technician.social> Co-authored-by: Jun <34545896+jcstrong@users.noreply.github.com> Co-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com> Co-authored-by: thrawnx <tight.bulb9384@fastmail.com> Co-authored-by: Chris <58918656+nordada@users.noreply.github.com> Co-authored-by: yi111 <153097222+Yi-111-a@users.noreply.github.com> Co-authored-by: Yanis <naamaneyanis@gmail.com> Co-authored-by: Wikibear <me@sej.de> Co-authored-by: alessiottavo <93441886+alessiottavo@users.noreply.github.com>
This commit is contained in:
3286 files changed
+284386
-139176
No files matched your search
@@ -1,20 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { Center, Stack, Text, UnstyledButton } from "@mantine/core";
|
||||
import { Badge, Center, Group, Stack, Text, UnstyledButton } from "@mantine/core";
|
||||
import { IconBinaryTree } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useIntegrationsWithInteractAccess } from "@homarr/auth/client";
|
||||
import { showErrorNotification } from "@homarr/notifications";
|
||||
import { useRegisterSpotlightContextActions } from "@homarr/spotlight";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
import { isSmartHomeTiny } from "../layout";
|
||||
import { getEntityStateLabel } from "./state";
|
||||
|
||||
export default function SmartHomeEntityStateWidget({
|
||||
options,
|
||||
integrationIds,
|
||||
isEditMode,
|
||||
width,
|
||||
height,
|
||||
displayMode,
|
||||
}: WidgetComponentProps<"smartHome-entityState">) {
|
||||
const t = useI18n("widget.smartHome-entityState");
|
||||
const tWidgetCommon = useI18n("widget.common");
|
||||
const tCommon = useI18n("common");
|
||||
const locale = useCurrentIntlLocale();
|
||||
// It will always have at least one integration as otherwise the NoIntegrationSelectedError would be thrown in item-content.tsx
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const integrationId = integrationIds[0]!;
|
||||
@@ -23,21 +34,38 @@ export default function SmartHomeEntityStateWidget({
|
||||
entityId: options.entityId,
|
||||
integrationId,
|
||||
};
|
||||
const { data: entityState } = clientApi.widget.smartHome.entityState.useQuery(input);
|
||||
const {
|
||||
data: entity,
|
||||
isPending: isEntityPending,
|
||||
error: entityError,
|
||||
} = clientApi.widget.smartHome.entityDetails.useQuery(input);
|
||||
const canInteract = useIntegrationsWithInteractAccess().some(({ id }) => id === integrationId);
|
||||
|
||||
const utils = clientApi.useUtils();
|
||||
const { mutate } = clientApi.widget.smartHome.switchEntity.useMutation({
|
||||
onSettled: () => void utils.widget.smartHome.entityState.invalidate(input),
|
||||
const { mutate, isPending } = clientApi.widget.smartHome.switchEntity.useMutation({
|
||||
onSettled: () => void utils.widget.smartHome.entityDetails.invalidate(input),
|
||||
onError: () =>
|
||||
showErrorNotification({
|
||||
title: tCommon("error"),
|
||||
message: t("error.toggleFailed"),
|
||||
}),
|
||||
});
|
||||
|
||||
const attribute = options.entityUnit.length > 0 ? " " + options.entityUnit : "";
|
||||
const apiUnit = entity?.attributes.unit_of_measurement;
|
||||
const unit = options.entityUnit || (typeof apiUnit === "string" ? apiUnit : "");
|
||||
const attribute = unit.length > 0 ? ` ${unit}` : "";
|
||||
const isActionable =
|
||||
!isEditMode &&
|
||||
options.clickable &&
|
||||
canInteract &&
|
||||
entity !== undefined &&
|
||||
!entityError &&
|
||||
!isEntityPending &&
|
||||
!isPending;
|
||||
const queryErrorLabel = entityError ? t("error.loadFailed") : undefined;
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (isEditMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!options.clickable) {
|
||||
if (!isActionable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +73,7 @@ export default function SmartHomeEntityStateWidget({
|
||||
entityId: options.entityId,
|
||||
integrationId,
|
||||
});
|
||||
}, [integrationId, isEditMode, mutate, options.clickable, options.entityId]);
|
||||
}, [integrationId, isActionable, mutate, options.entityId]);
|
||||
|
||||
useRegisterSpotlightContextActions(
|
||||
`smartHome-entityState-${options.entityId}`,
|
||||
@@ -62,35 +90,101 @@ export default function SmartHomeEntityStateWidget({
|
||||
},
|
||||
};
|
||||
},
|
||||
disabled: !options.clickable,
|
||||
disabled: !isActionable,
|
||||
},
|
||||
],
|
||||
[handleClick, options.clickable, options.displayName, options.entityId],
|
||||
[handleClick, isActionable, options.displayName, options.entityId],
|
||||
);
|
||||
const isTiny = width < 128;
|
||||
|
||||
if (entityError && entity === undefined) throw entityError;
|
||||
|
||||
const isAdvanced = displayMode === "advanced";
|
||||
const isTiny = isAdvanced ? isSmartHomeTiny(width, height) : width < 128;
|
||||
const advancedAttributes = [
|
||||
{ key: "unit" as const, value: entity?.attributes.unit_of_measurement },
|
||||
{ key: "deviceClass" as const, value: entity?.attributes.device_class },
|
||||
{ key: "icon" as const, value: entity?.attributes.icon },
|
||||
].filter(({ value }) => typeof value === "string" && value.length > 0);
|
||||
const displayName =
|
||||
isAdvanced && typeof entity?.attributes.friendly_name === "string"
|
||||
? entity.attributes.friendly_name
|
||||
: options.displayName;
|
||||
const knownStates = {
|
||||
on: t("state.on"),
|
||||
off: t("state.off"),
|
||||
unavailable: t("state.unavailable"),
|
||||
unknown: t("state.unknown"),
|
||||
};
|
||||
const state = getEntityStateLabel(entity?.state, knownStates);
|
||||
|
||||
return (
|
||||
<UnstyledButton
|
||||
mod={{ "entity-state": entityState, "entity-id": options.entityId }}
|
||||
mod={{ "entity-state": entity?.state, "entity-id": options.entityId }}
|
||||
onClick={handleClick}
|
||||
disabled={!isActionable}
|
||||
aria-label={`${displayName}: ${state}${attribute}`}
|
||||
aria-description={queryErrorLabel}
|
||||
w="100%"
|
||||
h="100%"
|
||||
styles={{
|
||||
root: {
|
||||
cursor: options.clickable && !isEditMode ? "pointer" : "initial",
|
||||
cursor: isActionable ? "pointer" : "initial",
|
||||
pointerEvents: isEditMode ? "none" : undefined,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Center h="100%" w="100%">
|
||||
<Stack align="center" gap="md">
|
||||
<Text ta="center" fw="bold" size={isTiny ? "sm" : "lg"}>
|
||||
{options.displayName}
|
||||
</Text>
|
||||
<Text ta="center" size={isTiny ? "xs" : "lg"}>
|
||||
{entityState}
|
||||
{attribute}
|
||||
</Text>
|
||||
<Stack align="center" gap={isAdvanced && isTiny ? 4 : "md"} p={isAdvanced ? "xs" : undefined} maw="100%">
|
||||
{isAdvanced ? (
|
||||
<>
|
||||
<Text ta="center" fw={700} size={isTiny ? "lg" : "2xl"} lh={1.1} lineClamp={1} maw="100%">
|
||||
{state}
|
||||
{attribute}
|
||||
</Text>
|
||||
<Text ta="center" c="dimmed" fw={500} size={isTiny ? "xs" : "sm"} lineClamp={2} maw="100%">
|
||||
{displayName}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Text ta="center" fw="bold" size={isTiny ? "sm" : "lg"} lineClamp={2} maw="100%">
|
||||
{displayName}
|
||||
</Text>
|
||||
<Text ta="center" size={isTiny ? "xs" : "lg"} lineClamp={1} maw="100%">
|
||||
{state}
|
||||
{attribute}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
{queryErrorLabel && (
|
||||
<Text size="xs" c="orange" ta="center" lineClamp={1} maw="100%" aria-live="polite">
|
||||
{queryErrorLabel}
|
||||
</Text>
|
||||
)}
|
||||
{isAdvanced && entity && (
|
||||
<>
|
||||
<Group justify="center" gap={4}>
|
||||
{advancedAttributes.map(({ key, value }) => (
|
||||
<Badge key={key} size="xs" variant="light" tt="none">
|
||||
{t(`advanced.attribute.${key}`)}: {String(value)}
|
||||
</Badge>
|
||||
))}
|
||||
</Group>
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("advanced.entityId", { id: entity.entity_id })}
|
||||
</Text>
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("advanced.lastChanged", {
|
||||
date: new Date(entity.last_changed).toLocaleString(locale),
|
||||
})}
|
||||
</Text>
|
||||
<Text size="xs" c="dimmed">
|
||||
{tWidgetCommon("updatedAt", {
|
||||
date: new Date(entity.last_updated).toLocaleString(locale),
|
||||
})}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
</Center>
|
||||
</UnstyledButton>
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { IconBinaryTree } from "@tabler/icons-react";
|
||||
import { IconBinaryTree, IconServerOff } from "@tabler/icons-react";
|
||||
|
||||
import { getIntegrationKindsByCategory } from "@homarr/definitions";
|
||||
import { getWidgetIntegrationConfig } from "@homarr/definitions";
|
||||
|
||||
import { createWidgetDefinition } from "../../definition";
|
||||
import { optionsBuilder } from "../../options";
|
||||
|
||||
export const { definition, componentLoader } = createWidgetDefinition("smartHome-entityState", {
|
||||
icon: IconBinaryTree,
|
||||
supportsAdvancedFocus: true,
|
||||
queryKey: [["widget", "smartHome"]],
|
||||
...getWidgetIntegrationConfig("smartHome-entityState"),
|
||||
createOptions() {
|
||||
return optionsBuilder.from((factory) => ({
|
||||
entityId: factory.text({
|
||||
@@ -20,5 +22,10 @@ export const { definition, componentLoader } = createWidgetDefinition("smartHome
|
||||
clickable: factory.switch(),
|
||||
}));
|
||||
},
|
||||
supportedIntegrations: getIntegrationKindsByCategory("smartHomeServer"),
|
||||
errors: {
|
||||
INTERNAL_SERVER_ERROR: {
|
||||
icon: IconServerOff,
|
||||
message: (t) => t("widget.smartHome-entityState.error.loadFailed"),
|
||||
},
|
||||
},
|
||||
}).withDynamicImport(() => import("./component"));
|
||||
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { getEntityStateLabel } from "./state";
|
||||
|
||||
const labels = { on: "On", off: "Off", unavailable: "Unavailable", unknown: "Unknown" };
|
||||
|
||||
describe("getEntityStateLabel", () => {
|
||||
test("localizes known states and preserves custom states", () => {
|
||||
expect(getEntityStateLabel("on", labels)).toBe("On");
|
||||
expect(getEntityStateLabel("heating", labels)).toBe("heating");
|
||||
});
|
||||
|
||||
test.each(["__proto__", "constructor", "toString"])("preserves prototype-like state %s", (state) => {
|
||||
expect(getEntityStateLabel(state, labels)).toBe(state);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface LocalizedEntityStates {
|
||||
on: string;
|
||||
off: string;
|
||||
unavailable: string;
|
||||
unknown: string;
|
||||
}
|
||||
|
||||
export const getEntityStateLabel = (state: string | undefined, labels: LocalizedEntityStates) => {
|
||||
if (!state) return "—";
|
||||
return Object.hasOwn(labels, state) ? labels[state as keyof LocalizedEntityStates] : state;
|
||||
};
|
||||
@@ -1,50 +1,76 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Center, LoadingOverlay, Overlay, Stack, Text, ThemeIcon, UnstyledButton } from "@mantine/core";
|
||||
import {
|
||||
Box,
|
||||
Center,
|
||||
LoadingOverlay,
|
||||
Overlay,
|
||||
Stack,
|
||||
Text,
|
||||
ThemeIcon,
|
||||
UnstyledButton,
|
||||
VisuallyHidden,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure, useTimeout } from "@mantine/hooks";
|
||||
import { IconAutomation, IconCheck } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useIntegrationsWithInteractAccess } from "@homarr/auth/client";
|
||||
import { useRegisterSpotlightContextActions } from "@homarr/spotlight";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
import { isSmartHomeTiny } from "../layout";
|
||||
|
||||
export default function SmartHomeTriggerAutomationWidget({
|
||||
options,
|
||||
integrationIds,
|
||||
isEditMode,
|
||||
width,
|
||||
height,
|
||||
displayMode,
|
||||
}: WidgetComponentProps<"smartHome-executeAutomation">) {
|
||||
const integrationId = integrationIds[0];
|
||||
const canInteract = useIntegrationsWithInteractAccess().some(({ id }) => id === integrationId);
|
||||
const [lastExecutedAt, setLastExecutedAt] = React.useState<Date | null>(null);
|
||||
const [isShowSuccess, { open: showSuccess, close: closeSuccess }] = useDisclosure();
|
||||
const utils = clientApi.useUtils();
|
||||
const { start } = useTimeout(() => {
|
||||
closeSuccess();
|
||||
}, 1000);
|
||||
|
||||
const { mutateAsync, isPending } = clientApi.widget.smartHome.executeAutomation.useMutation({
|
||||
const { mutateAsync, isPending, error } = clientApi.widget.smartHome.executeAutomation.useMutation({
|
||||
onSuccess: () => {
|
||||
void utils.widget.smartHome.entityDetails.invalidate();
|
||||
setLastExecutedAt(new Date());
|
||||
showSuccess();
|
||||
start();
|
||||
},
|
||||
});
|
||||
const handleClick = React.useCallback(async () => {
|
||||
if (isEditMode) {
|
||||
if (isEditMode || isPending || !integrationId || !canInteract) {
|
||||
return;
|
||||
}
|
||||
await mutateAsync({
|
||||
automationId: options.automationId,
|
||||
integrationId: integrationIds[0] ?? "",
|
||||
});
|
||||
}, [integrationIds, isEditMode, mutateAsync, options.automationId]);
|
||||
try {
|
||||
await mutateAsync({
|
||||
automationId: options.automationId,
|
||||
integrationId,
|
||||
});
|
||||
} catch {
|
||||
// The mutation exposes the error below and remains retryable.
|
||||
}
|
||||
}, [canInteract, integrationId, isEditMode, isPending, mutateAsync, options.automationId]);
|
||||
|
||||
const t = useI18n();
|
||||
const t = useI18n("widget.smartHome-executeAutomation");
|
||||
const locale = useCurrentIntlLocale();
|
||||
useRegisterSpotlightContextActions(
|
||||
`smartHome-automation-${options.automationId}`,
|
||||
[
|
||||
{
|
||||
id: options.automationId,
|
||||
name: t("widget.smartHome-executeAutomation.spotlightAction.run", { name: options.displayName }),
|
||||
name: t("spotlightAction.run", { name: options.displayName }),
|
||||
icon: IconAutomation,
|
||||
interaction() {
|
||||
return {
|
||||
@@ -55,38 +81,84 @@ export default function SmartHomeTriggerAutomationWidget({
|
||||
},
|
||||
};
|
||||
},
|
||||
disabled: !integrationId || !canInteract || isPending,
|
||||
},
|
||||
],
|
||||
[handleClick, options.automationId, options.displayName],
|
||||
[canInteract, handleClick, integrationId, isPending, options.automationId, options.displayName],
|
||||
);
|
||||
|
||||
const isTiny = width < 128;
|
||||
const isTiny = isSmartHomeTiny(width, height);
|
||||
|
||||
return (
|
||||
<UnstyledButton
|
||||
onClick={handleClick}
|
||||
style={{ cursor: !isEditMode ? "pointer" : "initial", pointerEvents: isEditMode ? "none" : undefined }}
|
||||
w="100%"
|
||||
h="100%"
|
||||
>
|
||||
{isShowSuccess && (
|
||||
<Overlay>
|
||||
<Center w="100%" h="100%">
|
||||
<ThemeIcon variant="filled" color="green" size="xl" radius="xl">
|
||||
<IconCheck style={{ width: "70%", height: "70%" }} stroke={1.5} />
|
||||
<Box pos="relative" w="100%" h="100%">
|
||||
<VisuallyHidden component="output">
|
||||
{isPending ? t("status.running") : isShowSuccess ? t("status.success") : ""}
|
||||
</VisuallyHidden>
|
||||
{error && <VisuallyHidden role="alert">{t("error.executeFailed")}</VisuallyHidden>}
|
||||
<UnstyledButton
|
||||
onClick={handleClick}
|
||||
disabled={!integrationId || !canInteract || isPending}
|
||||
aria-label={t("spotlightAction.run", { name: options.displayName })}
|
||||
style={{
|
||||
cursor: !isEditMode && integrationId && canInteract ? "pointer" : "initial",
|
||||
pointerEvents: isEditMode ? "none" : undefined,
|
||||
}}
|
||||
aria-description={error ? t("error.executeFailed") : undefined}
|
||||
w="100%"
|
||||
h="100%"
|
||||
>
|
||||
{isShowSuccess && (
|
||||
<Overlay>
|
||||
<Center w="100%" h="100%">
|
||||
<ThemeIcon variant="filled" color="green" size="xl" radius="xl">
|
||||
<IconCheck style={{ width: "70%", height: "70%" }} stroke={1.5} />
|
||||
</ThemeIcon>
|
||||
</Center>
|
||||
</Overlay>
|
||||
)}
|
||||
<LoadingOverlay visible={isPending} />
|
||||
{error && displayMode !== "advanced" && (
|
||||
<Overlay>
|
||||
<Center w="100%" h="100%" p="xs">
|
||||
<Text size="xs" c="red" ta="center" lineClamp={3}>
|
||||
{t("error.executeFailed")}
|
||||
</Text>
|
||||
</Center>
|
||||
</Overlay>
|
||||
)}
|
||||
<Center w="100%" h="100%">
|
||||
<Stack align="center" gap={isTiny ? 6 : "md"} p="xs" maw="100%">
|
||||
<ThemeIcon variant="light" size={isTiny ? "md" : "xl"} radius="xl">
|
||||
<IconAutomation style={zoomCompensatedSize(isTiny ? 14 : 24)} />
|
||||
</ThemeIcon>
|
||||
</Center>
|
||||
</Overlay>
|
||||
)}
|
||||
<LoadingOverlay visible={isPending} />
|
||||
<Center w="100%" h="100%">
|
||||
<Stack align="center" gap="md">
|
||||
<IconAutomation size={isTiny ? 16 : undefined} />
|
||||
<Text ta="center" fw="bold" fz={isTiny ? "xs" : undefined}>
|
||||
{options.displayName}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
</UnstyledButton>
|
||||
<Text ta="center" fw={600} fz={isTiny ? "xs" : "sm"} lineClamp={2} maw="100%">
|
||||
{options.displayName}
|
||||
</Text>
|
||||
{displayMode === "advanced" && (
|
||||
<Stack gap={2} align="center">
|
||||
<Text ta="center" size="xs" c="dimmed">
|
||||
{t("advanced.automationId", { id: options.automationId })}
|
||||
</Text>
|
||||
<Text ta="center" size="xs" c={canInteract ? "dimmed" : "orange"}>
|
||||
{t(canInteract ? "advanced.ready" : "advanced.noPermission")}
|
||||
</Text>
|
||||
{lastExecutedAt && (
|
||||
<Text ta="center" size="xs" c="dimmed">
|
||||
{t("advanced.lastExecuted", {
|
||||
time: lastExecutedAt.toLocaleTimeString(locale),
|
||||
})}
|
||||
</Text>
|
||||
)}
|
||||
{error && (
|
||||
<Text ta="center" size="xs" c="red">
|
||||
{t("error.executeFailed")}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
)}
|
||||
</Stack>
|
||||
</Center>
|
||||
</UnstyledButton>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
import { IconBinaryTree } from "@tabler/icons-react";
|
||||
|
||||
import { getIntegrationKindsByCategory } from "@homarr/definitions";
|
||||
import { getWidgetIntegrationConfig } from "@homarr/definitions";
|
||||
|
||||
import { createWidgetDefinition } from "../../definition";
|
||||
import { optionsBuilder } from "../../options";
|
||||
|
||||
export const { definition, componentLoader } = createWidgetDefinition("smartHome-executeAutomation", {
|
||||
icon: IconBinaryTree,
|
||||
supportsAdvancedFocus: true,
|
||||
...getWidgetIntegrationConfig("smartHome-executeAutomation"),
|
||||
createOptions() {
|
||||
return optionsBuilder.from((factory) => ({
|
||||
displayName: factory.text(),
|
||||
automationId: factory.text(),
|
||||
}));
|
||||
},
|
||||
supportedIntegrations: getIntegrationKindsByCategory("smartHomeServer"),
|
||||
}).withDynamicImport(() => import("./component"));
|
||||
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { isSmartHomeTiny } from "./layout";
|
||||
|
||||
describe("smart home layout", () => {
|
||||
test.each([
|
||||
{ width: 127, height: 96, expected: true },
|
||||
{ width: 128, height: 95, expected: true },
|
||||
{ width: 128, height: 96, expected: false },
|
||||
{ width: 256, height: 192, expected: false },
|
||||
])("classifies $width x $height", ({ width, height, expected }) => {
|
||||
expect(isSmartHomeTiny(width, height)).toBe(expected);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export const isSmartHomeTiny = (width: number, height: number) => width < 128 || height < 96;
|
||||
Reference in new issue
Block a user