feat: Clock widget scalability (#644)
This commit is contained in:
@@ -3,7 +3,7 @@ import baseConfig from "@homarr/eslint-config/base";
|
|||||||
/** @type {import('typescript-eslint').Config} */
|
/** @type {import('typescript-eslint').Config} */
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
ignores: ["build/**"],
|
ignores: ["tasks.cjs"],
|
||||||
},
|
},
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import baseConfig from "@homarr/eslint-config/base";
|
import baseConfig from "@homarr/eslint-config/base";
|
||||||
|
|
||||||
/** @type {import('typescript-eslint').Config} */
|
/** @type {import('typescript-eslint').Config} */
|
||||||
export default [...baseConfig];
|
export default [
|
||||||
|
{
|
||||||
|
ignores: ["wssServer.cjs"],
|
||||||
|
},
|
||||||
|
...baseConfig,
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { Flex, Stack, Text } from "@mantine/core";
|
import { Stack, Text } from "@mantine/core";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import advancedFormat from "dayjs/plugin/advancedFormat";
|
import advancedFormat from "dayjs/plugin/advancedFormat";
|
||||||
import timezones from "dayjs/plugin/timezone";
|
import timezones from "dayjs/plugin/timezone";
|
||||||
@@ -20,21 +20,21 @@ export default function ClockWidget({ options }: WidgetComponentProps<"clock">)
|
|||||||
const timezone = options.useCustomTimezone ? options.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone;
|
const timezone = options.useCustomTimezone ? options.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
const time = useCurrentTime(options);
|
const time = useCurrentTime(options);
|
||||||
return (
|
return (
|
||||||
<Flex classNames={{ root: "clock-wrapper" }} align="center" justify="center" h="100%">
|
<Stack className="clock-text-stack" h="100%" align="center" justify="center" gap="10cqmin">
|
||||||
<Stack classNames={{ root: "clock-text-stack" }} align="center" gap="xs">
|
{options.customTitleToggle && (
|
||||||
{options.customTitleToggle && (
|
<Text className="clock-customTitle-text" size="12.5cqmin" ta="center">
|
||||||
<Text classNames={{ root: "clock-customTitle-text" }}>{options.customTitle}</Text>
|
{options.customTitle}
|
||||||
)}
|
|
||||||
<Text classNames={{ root: "clock-time-text" }} fw={700} size="2.125rem" lh="1">
|
|
||||||
{dayjs(time).tz(timezone).format(timeFormat)}
|
|
||||||
</Text>
|
</Text>
|
||||||
{options.showDate && (
|
)}
|
||||||
<Text classNames={{ root: "clock-date-text" }} lineClamp={1}>
|
<Text className="clock-time-text" fw={700} size="22.5cqmin" lh="1">
|
||||||
{dayjs(time).tz(timezone).format(dateFormat)}
|
{dayjs(time).tz(timezone).format(timeFormat)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
{options.showDate && (
|
||||||
</Stack>
|
<Text className="clock-date-text" size="12.5cqmin" lineClamp={1}>
|
||||||
</Flex>
|
{dayjs(time).tz(timezone).format(dateFormat)}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user