style: auto-fix lint and format
This commit is contained in:
1 parent
c9f003dadd
commit
2b4a18385d
10 files changed
+152
-164
No files matched your search
@@ -63,7 +63,9 @@ export function AudioStatsContent({
|
||||
const nowPlayingTracks =
|
||||
navidromeStats?.nowPlaying.slice(
|
||||
0,
|
||||
nowPlayingLimitByListVisibility[String(options.showNowPlayingList) as keyof typeof nowPlayingLimitByListVisibility],
|
||||
nowPlayingLimitByListVisibility[
|
||||
String(options.showNowPlayingList) as keyof typeof nowPlayingLimitByListVisibility
|
||||
],
|
||||
) ?? [];
|
||||
|
||||
const hasContent = visibleStats.length > 0 || showNowPlayingSection;
|
||||
@@ -76,10 +78,7 @@ export function AudioStatsContent({
|
||||
style={{ "--stat-cols": gridCols } as CSSProperties}
|
||||
>
|
||||
{visibleStats.map(({ optionKey, statKey, value, Icon }) => (
|
||||
<div
|
||||
key={optionKey}
|
||||
className={`${classes.statTile} ${statTileClassByCompact[compactKey]}`}
|
||||
>
|
||||
<div key={optionKey} className={`${classes.statTile} ${statTileClassByCompact[compactKey]}`}>
|
||||
<Icon className={classes.statIcon} size={iconSize} stroke={1.5} />
|
||||
<span className={classes.statValue}>{value}</span>
|
||||
<span className={classes.statLabel}>{t(statKey as never)}</span>
|
||||
@@ -95,10 +94,9 @@ export function AudioStatsContent({
|
||||
<span className={classes.nowPlayingTitle}>{t("nowPlaying" as never)}</span>
|
||||
{!options.showNowPlayingList && (
|
||||
<Badge className={classes.nowPlayingCount} variant="light" size="sm">
|
||||
{(t as unknown as (key: string, params?: { count: number }) => string)(
|
||||
"nowPlayingCount",
|
||||
{ count: navidromeStats.nowPlaying.length },
|
||||
)}
|
||||
{(t as unknown as (key: string, params?: { count: number }) => string)("nowPlayingCount", {
|
||||
count: navidromeStats.nowPlaying.length,
|
||||
})}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,11 @@ describe("getVisibleStats", () => {
|
||||
};
|
||||
|
||||
test("returns only enabled navidrome stats", () => {
|
||||
const result = getVisibleStats("navidrome", { showArtists: true, showAlbums: false, showSongs: true }, navidromeStats);
|
||||
const result = getVisibleStats(
|
||||
"navidrome",
|
||||
{ showArtists: true, showAlbums: false, showSongs: true },
|
||||
navidromeStats,
|
||||
);
|
||||
expect(result).toHaveLength(2);
|
||||
expect(result.map((s) => s.statKey)).toEqual(["artists", "songs"]);
|
||||
expect(result[0]?.value).toBe(100);
|
||||
@@ -64,7 +68,13 @@ describe("getVisibleStats", () => {
|
||||
test("returns only enabled audiobookshelf stats", () => {
|
||||
const result = getVisibleStats(
|
||||
"audiobookshelf",
|
||||
{ showLibraryCount: true, showAudiobooks: true, showPodcasts: false, showListeningTime: false, showActiveSessions: true },
|
||||
{
|
||||
showLibraryCount: true,
|
||||
showAudiobooks: true,
|
||||
showPodcasts: false,
|
||||
showListeningTime: false,
|
||||
showActiveSessions: true,
|
||||
},
|
||||
audiobookshelfStats,
|
||||
);
|
||||
expect(result).toHaveLength(3);
|
||||
@@ -77,11 +87,7 @@ describe("getVisibleStats", () => {
|
||||
});
|
||||
|
||||
test("formats listening time as duration string", () => {
|
||||
const result = getVisibleStats(
|
||||
"audiobookshelf",
|
||||
{ showListeningTime: true },
|
||||
audiobookshelfStats,
|
||||
);
|
||||
const result = getVisibleStats("audiobookshelf", { showListeningTime: true }, audiobookshelfStats);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(typeof result[0]?.value).toBe("string");
|
||||
});
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment, type CSSProperties } from "react";
|
||||
import { Fragment } from "react";
|
||||
import type { CSSProperties } from "react";
|
||||
import { RingProgress, Text } from "@mantine/core";
|
||||
import {
|
||||
IconFileDescription,
|
||||
IconFileText,
|
||||
IconInbox,
|
||||
IconTag,
|
||||
IconUsers,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconFileDescription, IconFileText, IconInbox, IconTag, IconUsers } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
@@ -74,11 +69,7 @@ const heroPartVisibility = {
|
||||
ring: "showInboxRing",
|
||||
} as const;
|
||||
|
||||
export default function PaperlessNgxWidget({
|
||||
integrationIds,
|
||||
options,
|
||||
width,
|
||||
}: WidgetComponentProps<"paperlessNgx">) {
|
||||
export default function PaperlessNgxWidget({ integrationIds, options, width }: WidgetComponentProps<"paperlessNgx">) {
|
||||
const t = useScopedI18n("widget.paperlessNgx");
|
||||
const [stats] = clientApi.widget.paperlessNgx.getStats.useSuspenseQuery({
|
||||
integrationId: integrationIds[0] ?? "",
|
||||
@@ -150,9 +141,7 @@ export default function PaperlessNgxWidget({
|
||||
{showHero && (
|
||||
<div className={`${classes.hero} ${heroLayoutClass} ${heroRingClass}`}>
|
||||
{visibleHeroParts.map(([partKey]) => (
|
||||
<Fragment key={partKey}>
|
||||
{heroPartRenderers[partKey as keyof typeof heroPartRenderers]}
|
||||
</Fragment>
|
||||
<Fragment key={partKey}>{heroPartRenderers[partKey as keyof typeof heroPartRenderers]}</Fragment>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -94,9 +94,7 @@ export default function UptimeKumaWidget({
|
||||
throw new NoIntegrationDataError();
|
||||
}
|
||||
|
||||
return (
|
||||
<UptimeKumaContent integrationIds={integrationIds} isEditMode={isEditMode} options={options} width={width} />
|
||||
);
|
||||
return <UptimeKumaContent integrationIds={integrationIds} isEditMode={isEditMode} options={options} width={width} />;
|
||||
}
|
||||
|
||||
interface UptimeKumaContentProps {
|
||||
|
||||
Reference in new issue
Block a user