Merge remote-tracking branch 'origin/release/v2' into feat/pr6582-nice-changes-release

# Conflicts:
#	apps/nextjs/src/components/board/items/item-select-modal.tsx
This commit is contained in:
Thomas Camlong committed 2026-08-17 12:29:50 +02:00
commit 510845d3b9
55 files changed
+2566 -1731

No files matched your search

@@ -1,4 +1,5 @@
import { TRPCError } from "@trpc/server";
import { parse as parseSuperJson } from "superjson";
import { z } from "zod/v4";
import { encryptSecret } from "@homarr/common/server";
@@ -26,6 +27,32 @@ export const transferProcedures = {
return parseStoredCustomWidgetDefinition(definition);
}),
exportLegacy: permissionRequiredProcedure
.requiresPermission("admin")
.input(z.object({ id: z.string() }))
.query(async ({ ctx, input }) => {
const definition = await ctx.db.query.legacyCustomWidgetDefinitions.findFirst({
where: eq(legacyCustomWidgetDefinitions.id, input.id),
with: { secrets: true },
});
if (!definition) throw new TRPCError({ code: "NOT_FOUND", message: "Legacy custom widget not found" });
return {
$schema: "homarr-custom-widget-v1" as const,
name: definition.name,
description: definition.description,
iconUrl: definition.iconUrl,
url: definition.url,
authType: definition.authType,
headerName: definition.headerName,
method: definition.method,
requestBody: definition.requestBody,
displayType: definition.displayType,
displayConfig: parseLegacyDisplayConfig(definition.displayConfig),
configuredSecretKinds: definition.secrets.map(({ kind }) => kind),
};
}),
import: permissionRequiredProcedure
.requiresPermission("admin")
.input(z.object({ widget: customWidgetImportSchema, secrets: customWidgetSecretsInputSchema.default([]) }))
@@ -117,6 +144,14 @@ export const transferProcedures = {
}),
};
function parseLegacyDisplayConfig(value: string): unknown {
try {
return parseSuperJson(value);
} catch {
return value;
}
}
function canPreserveLegacySecrets(
legacy: typeof legacyCustomWidgetDefinitions.$inferSelect,
widget: z.infer<typeof customWidgetImportSchema>,
@@ -6,17 +6,42 @@ import { describe, expect, test } from "vitest";
const languageDirectory = resolve(import.meta.dirname, "../../../translation/src/lang");
describe("Workshop navigation translations", () => {
test("defines the navbar and breadcrumb label in the source locale", async () => {
test("defines the breadcrumb labels for the Custom Widgets sub-routes", async () => {
const messages = JSON.parse(await readFile(resolve(languageDirectory, "en.json"), "utf8")) as {
management?: { navbar?: { items?: { workshop?: unknown } } };
navigationStructure?: { manage?: { workshop?: { label?: unknown } } };
navigationStructure?: {
manage?: {
workshop?: unknown;
"custom-widgets"?: {
workshop?: { label?: unknown };
publish?: { label?: unknown };
};
};
};
customWidget?: { page?: { tabs?: Record<string, unknown> } };
workshop?: Record<string, unknown>;
};
expect(messages.management?.navbar?.items?.workshop).toBe("Workshop");
expect(messages.navigationStructure?.manage?.workshop?.label).toBe("Workshop");
// The Workshop is reached through the Custom Widgets tabs, not its own navbar entry.
expect(messages.management?.navbar?.items?.workshop).toBeUndefined();
expect(messages.navigationStructure?.manage?.workshop).toBeUndefined();
expect(messages.navigationStructure?.manage?.["custom-widgets"]?.workshop?.label).toBe("Workshop");
expect(messages.navigationStructure?.manage?.["custom-widgets"]?.publish?.label).toBe("Publish to Workshop");
expect(messages.customWidget?.page?.tabs).toMatchObject({
installed: "Installed",
workshop: "Workshop",
ariaLabel: expect.any(String),
});
expect(messages.workshop).toMatchObject({
communityMember: "Community member",
outdated: "Outdated",
install: "Install",
back: expect.any(String),
listAriaLabel: expect.any(String),
installReviewTitle: expect.any(String),
emptyFilteredDescription: expect.any(String),
importCssConfirm: expect.any(String),
reportCount: expect.any(String),
reportWarning: expect.any(String),
reportVisibility: expect.any(String),
@@ -31,7 +56,19 @@ describe("Workshop navigation translations", () => {
inappropriate: expect.any(String),
other: expect.any(String),
}),
publish: expect.objectContaining({ invalidScreenshot: expect.any(String) }),
publish: expect.objectContaining({
invalidScreenshot: expect.any(String),
}),
});
});
test("drops the message keys that only existed for the stacked install modals", async () => {
const messages = JSON.parse(await readFile(resolve(languageDirectory, "en.json"), "utf8")) as {
workshop?: Record<string, unknown>;
};
for (const key of ["installDialog", "continueInstall", "confirmInstallTitle", "backToWidget", "inspectCss"]) {
expect(messages.workshop).not.toHaveProperty(key);
}
});
});
@@ -1,12 +1,11 @@
import type { ReactNode } from "react";
import { Alert, Badge, Button, Code, Group, Modal, Paper, SimpleGrid, Stack, Text } from "@mantine/core";
import { Alert, Badge, Box, Button, Code, Group, Modal, Paper, SimpleGrid, Stack, Text } from "@mantine/core";
import type { ModalProps } from "@mantine/core";
import { IconAlertTriangle } from "@tabler/icons-react";
import type { ImportReview } from "../core/import";
export interface ImportReviewMessages {
title: string;
export interface ImportReviewContentMessages {
description: string;
name: string;
origin: string;
@@ -16,9 +15,13 @@ export interface ImportReviewMessages {
permissions: string;
actionWarningTitle: string;
actionWarningDescription: string;
permission(permission: string): string;
}
export interface ImportReviewMessages extends ImportReviewContentMessages {
title: string;
cancel: string;
confirm: string;
permission(permission: string): string;
}
export interface ImportReviewDialogProps {
@@ -36,6 +39,22 @@ export interface ImportReviewDialogProps {
onConfirm(): void;
}
const importReviewModalStyles = {
content: {
display: "flex",
flexDirection: "column" as const,
maxHeight: "min(85dvh, 900px)",
},
body: {
display: "flex",
flex: 1,
flexDirection: "column" as const,
minHeight: 0,
overflow: "hidden",
padding: 0,
},
};
function ImportFact({ label, value }: { label: string; value: string }) {
return (
<Paper withBorder p="xs">
@@ -47,6 +66,71 @@ function ImportFact({ label, value }: { label: string; value: string }) {
);
}
export interface ImportReviewContentProps {
review: ImportReview;
messages: ImportReviewContentMessages;
children?: ReactNode;
}
/**
* The security facts a user has to review before a custom widget is installed.
* Shared by the import modal and the Workshop install page so both read identically.
*/
export function ImportReviewContent({ review, messages, children }: ImportReviewContentProps) {
return (
<Stack gap="md">
<Text size="sm" c="dimmed">
{messages.description}
</Text>
<SimpleGrid cols={{ base: 1, sm: 2 }} spacing="xs">
<ImportFact label={messages.name} value={review.name} />
<ImportFact label={messages.origin} value={review.origins.join(", ")} />
<ImportFact label={messages.authentication} value={review.authTypes.join(", ")} />
<ImportFact label={messages.networkScope} value={review.networkScopes.join(", ")} />
</SimpleGrid>
<SimpleGrid cols={{ base: 1, sm: 2 }} spacing="md">
<div>
<Text size="sm" fw={600} mb={6}>
{messages.methods}
</Text>
<Group gap={6}>
{review.methods.map((method) => (
<Badge
key={method}
color={method === "DELETE" ? "red" : method === "GET" ? "blue" : "orange"}
variant="light"
>
{method}
</Badge>
))}
</Group>
</div>
<div>
<Text size="sm" fw={600} mb={6}>
{messages.permissions}
</Text>
<Group gap={6}>
{review.permissions.map((permission) => (
<Badge key={permission} color="gray" variant="light">
{messages.permission(permission)}
</Badge>
))}
</Group>
</div>
</SimpleGrid>
{review.hasActions && (
<Alert color="yellow" icon={<IconAlertTriangle size={16} />}>
<Text size="sm" fw={600}>
{messages.actionWarningTitle}
</Text>
<Text size="sm">{messages.actionWarningDescription}</Text>
</Alert>
)}
{children}
</Stack>
);
}
export function ImportReviewDialog({
opened,
review,
@@ -70,65 +154,31 @@ export function ImportReviewDialog({
stackId={stackId}
zIndex={zIndex}
size={size ?? "lg"}
styles={styles}
styles={styles ?? importReviewModalStyles}
>
{review && (
<Stack gap="md">
<Text size="sm" c="dimmed">
{messages.description}
</Text>
<SimpleGrid cols={{ base: 1, sm: 2 }} spacing="xs">
<ImportFact label={messages.name} value={review.name} />
<ImportFact label={messages.origin} value={review.origins.join(", ")} />
<ImportFact label={messages.authentication} value={review.authTypes.join(", ")} />
<ImportFact label={messages.networkScope} value={review.networkScopes.join(", ")} />
</SimpleGrid>
<div>
<Text size="sm" fw={600} mb={6}>
{messages.methods}
</Text>
<Group gap={6}>
{review.methods.map((method) => (
<Badge
key={method}
color={method === "DELETE" ? "red" : method === "GET" ? "blue" : "orange"}
variant="light"
>
{method}
</Badge>
))}
<>
<Box p="lg" style={{ flex: 1, minHeight: 0, overflowY: "auto" }}>
<ImportReviewContent review={review} messages={messages}>
{children}
</ImportReviewContent>
</Box>
<Box
px="lg"
py="md"
bg="var(--mantine-color-body)"
style={{ borderTop: "1px solid var(--mantine-color-default-border)", flexShrink: 0 }}
>
<Group justify="flex-end" gap="sm">
<Button type="button" variant="default" onClick={onClose} disabled={pending}>
{messages.cancel}
</Button>
<Button type="button" onClick={onConfirm} loading={pending} disabled={confirmDisabled}>
{messages.confirm}
</Button>
</Group>
</div>
<div>
<Text size="sm" fw={600} mb={6}>
{messages.permissions}
</Text>
<Group gap={6}>
{review.permissions.map((permission) => (
<Badge key={permission} color="gray" variant="light">
{messages.permission(permission)}
</Badge>
))}
</Group>
</div>
{review.hasActions && (
<Alert color="yellow" icon={<IconAlertTriangle size={16} />}>
<Text size="sm" fw={600}>
{messages.actionWarningTitle}
</Text>
<Text size="sm">{messages.actionWarningDescription}</Text>
</Alert>
)}
{children}
<Group justify="flex-end">
<Button type="button" variant="default" onClick={onClose} disabled={pending}>
{messages.cancel}
</Button>
<Button type="button" onClick={onConfirm} loading={pending} disabled={confirmDisabled}>
{messages.confirm}
</Button>
</Group>
</Stack>
</Box>
</>
)}
</Modal>
);
+1
View File
@@ -9,6 +9,7 @@
"exports": {
".": "./index.ts",
"./collection": "./collection.ts",
"./migrations/custom": "./migrations/custom/index.ts",
"./migrations/seed": "./migrations/seed.ts",
"./proxy-reader": "./proxy-reader.ts",
"./schema": "./schema/index.ts",
+47 -32
View File
@@ -1,5 +1,6 @@
"use client";
import type { ReactNode } from "react";
import { useEffect, useState } from "react";
import { Alert, Button, Center, Paper, Stack, Text, Title } from "@mantine/core";
@@ -13,13 +14,18 @@ import { Finish } from "./finish";
import { SetupStudio } from "./setup-studio";
import { Welcome } from "./welcome";
type ClaimState = "checking" | "ready" | "locked" | "signIn" | "error";
const getInitialClaimState = (accessState: ReturnType<typeof getOnboardingAccessState>): ClaimState => {
if (accessState === "claim") return "checking";
return accessState;
};
export const OnboardingStudio = (props: OnboardingStudioProps) => {
const t = useScopedI18n("init.studio.claim");
const tCommon = useScopedI18n("common.action");
const accessState = getOnboardingAccessState(props.environment);
const [claimState, setClaimState] = useState<"checking" | "ready" | "locked" | "signIn" | "error">(
accessState === "claim" ? "checking" : accessState,
);
const [claimState, setClaimState] = useState<ClaimState>(() => getInitialClaimState(accessState));
const [claimError, setClaimError] = useState<string | null>(null);
useEffect(() => {
@@ -56,43 +62,52 @@ export const OnboardingStudio = (props: OnboardingStudioProps) => {
}, [accessState, t]);
if (claimState !== "ready") {
const signIn = claimState === "signIn";
let title = t("errorTitle");
let description = claimError ?? t("errorDescription");
let action: ReactNode = (
<Stack align="center">
<Alert color="red" role="alert">
{description}
</Alert>
<Button onClick={() => window.location.reload()}>{tCommon("tryAgain")}</Button>
</Stack>
);
switch (claimState) {
case "checking":
title = t("checkingTitle");
description = t("checking");
action = null;
break;
case "signIn":
title = t("signInTitle");
description = t("signInDescription");
action = (
<Button component={Link} href="/auth/login?callbackUrl=%2Finit">
{t("signIn")}
</Button>
);
break;
case "locked":
title = t("lockedTitle");
description = t("lockedDescription");
action = <Button onClick={() => window.location.reload()}>{tCommon("tryAgain")}</Button>;
break;
case "error":
break;
}
return (
<Center mih="100dvh" p="md">
<Paper withBorder radius="lg" p="xl" maw="32rem" w="100%">
<Stack align="center">
<Title order={1} size="h2" ta="center">
{claimState === "checking"
? t("checkingTitle")
: signIn
? t("signInTitle")
: claimState === "locked"
? t("lockedTitle")
: t("errorTitle")}
{title}
</Title>
<Text c="dimmed" ta="center">
{signIn
? t("signInDescription")
: claimState === "locked"
? t("lockedDescription")
: claimState === "checking"
? t("checking")
: (claimError ?? t("errorDescription"))}
{description}
</Text>
{signIn ? (
<Button component={Link} href="/auth/login?callbackUrl=%2Finit">
{t("signIn")}
</Button>
) : claimState === "locked" ? (
<Button onClick={() => window.location.reload()}>{tCommon("tryAgain")}</Button>
) : claimState === "error" ? (
<Stack align="center">
<Alert color="red" role="alert">
{claimError ?? t("errorDescription")}
</Alert>
<Button onClick={() => window.location.reload()}>{tCommon("tryAgain")}</Button>
</Stack>
) : null}
{action}
</Stack>
</Paper>
</Center>
+59 -44
View File
@@ -889,12 +889,17 @@
"list": {
"title": "Custom Widgets",
"noResults": "No custom widgets yet. Create your first one!",
"noDescription": "No description",
"loading": "Loading...",
"enabled": "Enabled",
"disabled": "Disabled",
"disabledDescription": "This widget stays configured but will not load on any board.",
"requestCount": "{count, plural, one {# request} other {# requests}}",
"invalidDefinition": "Invalid definition",
"invalidDefinitionDescription": "This stored widget no longer matches the current Custom Widget schema. Delete it and recreate or import a valid definition.",
"migrationRequired": "Migration required",
"migrationDescription": "This v1 custom widget is preserved but cannot run until it is migrated to Custom JSX v2.",
"migrationInstructions": "Open Actions, copy the redacted migration prompt into an LLM, then copy its single JSON response and choose Paste migrated widget. Existing board placements keep working after migration.",
"migrationInstructions": "Open Actions to copy or export the original v1 definition for manual recreation. You can also use the migration prompt with an LLM. Existing board placements keep working after migration.",
"missingCredentials": "{count, plural, one {Credential missing} other {# credentials missing}}",
"missingCredentialsDescription": "{count, plural, one {This widget still needs one credential.} other {This widget still needs # credentials.}} Edit it to configure the encrypted values."
},
@@ -904,6 +909,11 @@
},
"edit": {
"title": "Edit Custom Widget"
},
"tabs": {
"ariaLabel": "Custom widget sections",
"installed": "Installed",
"workshop": "Workshop"
}
},
"action": {
@@ -924,6 +934,8 @@
"downloadSkill": "View Custom Widget Skill",
"publishWorkshop": "Publish to Workshop",
"migrate": "Migrate Custom Widget",
"copyLegacyDefinition": "Copy original widget content",
"exportLegacyDefinition": "Export original widget content",
"copyMigrationPrompt": "Copy LLM migration prompt",
"pasteMigration": "Paste migrated widget",
"importMigration": "Import migrated JSON file",
@@ -1282,6 +1294,8 @@
"imported": "Widget imported successfully.",
"migrated": "Legacy widget migrated successfully. Existing board placements now use the v2 definition.",
"migrationError": "Failed to migrate the legacy widget. Ensure the file uses the homarr-custom-widget-v2 schema.",
"legacyDefinitionCopied": "The original widget content was copied. Stored credential values are not included.",
"legacyDefinitionCopyError": "Failed to copy the original widget content.",
"migrationPromptCopied": "A redacted migration prompt was copied. Paste it into an LLM, copy its single JSON response, then choose Paste migrated widget here.",
"migrationPromptCopyError": "Failed to copy the migration prompt.",
"aiPromptCopied": "AI prompt copied to clipboard",
@@ -1436,64 +1450,68 @@
}
},
"workshop": {
"installSuccess": "Custom widget installed",
"installSuccessDescription": "Add its credentials, test the requests, and save when it is ready.",
"installError": "Could not install widget",
"installErrorDescription": "The Workshop submission is not a valid Custom JSX v2 widget.",
"title": "Workshop",
"importFromWorkshop": "Import from Workshop",
"browseWorkshop": "Browse Workshop",
"openCommunity": "Open Workshop",
"manageSubmissionsTitle": "Manage submissions on Workshop",
"manageSubmissionsDescription": "Publishing starts in Homarr, but updates, reports, outdated status, and deletion are managed directly on the Workshop website. Sign in there and select Yours to find your submissions.",
"description": "Community Custom JSX v2 widgets. Inspect the source and network capabilities before installing.",
"descriptionCss": "Community Custom CSS themes. Preview every rule before importing it into a board.",
"securityNotice": "Workshop widgets can call their declared API sources and perform declared actions with credentials you configure locally. Secrets are never included.",
"securityNoticeCss": "Community CSS can change the appearance and usability of a board. Review it before importing; nothing is saved until you save board settings.",
"signIn": "Sign in with GitHub",
"signInError": "GitHub sign-in failed. Check that the Workshop OAuth provider is configured and that popups are allowed.",
"signOut": "Sign out",
"openOnWorkshop": "Open {title} on the Workshop website",
"back": "Back to Workshop",
"cancel": "Cancel",
"search": "Search widgets",
"searchCss": "Search CSS themes",
"sort": "Sort",
"sortTop": "Top rated",
"sortNewest": "Newest",
"listAriaLabel": "Workshop widgets",
"listAriaLabelCss": "Workshop CSS themes",
"empty": "No widgets match this search.",
"emptyDescription": "Community widgets published to the Workshop show up here.",
"emptyFilteredTitle": "No widgets match this search",
"emptyFilteredDescription": "No Workshop widget matches \"{search}\".",
"clearSearch": "Clear search",
"emptyCss": "No CSS themes match this search.",
"unavailableTitle": "Homarr Workshop seems to be unavailable",
"unavailable": "The community service may be temporarily down. Try again in a moment. Your installed widgets are unaffected.",
"retry": "Try again",
"empty": "No widgets match this search.",
"emptyCss": "No CSS themes match this search.",
"loadError": "This submission could not be loaded.",
"noDescription": "No description",
"author": "by {name}",
"communityMember": "Community member",
"outdated": "Outdated",
"outdatedWarning": "The author marked this submission as outdated. Review it carefully before importing.",
"reportCount": "{count, plural, one {# report} other {# reports}}",
"reportWarning": "{count, plural, one {This submission has # open community report.} other {This submission has # open community reports.}} It remains installable, but you should review its content first.",
"reportVisibility": "Report details are visible only to this submission's author and Workshop admins.",
"score": "Score: {count, number}",
"upvote": "Upvote",
"downvote": "Downvote",
"voteError": "The vote could not be saved.",
"signIn": "Sign in with GitHub",
"signInError": "GitHub sign-in failed. Check that the Workshop OAuth provider is configured and that popups are allowed.",
"signOut": "Sign out",
"signInHint": "Sign in to vote or report. Installing does not require a Workshop account.",
"securityNotice": "Workshop widgets can call their declared API sources and perform declared actions with credentials you configure locally. Secrets are never included.",
"securityNoticeCss": "Community CSS can change the appearance and usability of a board. Review it before importing; nothing is saved until you save board settings.",
"install": "Install",
"installReviewTitle": "Review before installing",
"installError": "This widget cannot be installed",
"installErrorDescription": "The Workshop submission is not a valid Custom JSX v2 widget.",
"useCss": "Import CSS",
"importCss": "Import CSS from Workshop",
"importCssConfirm": "Replace the current custom CSS with \"{title}\"? Nothing is saved until you save the board settings.",
"screenshotAlt": "{title} screenshot {count, number}",
"upvote": "Upvote, {count, plural, one {# vote} other {# votes}}",
"downvote": "Downvote, {count, plural, one {# vote} other {# votes}}",
"inspectCss": "Inspect CSS",
"zoomScreenshot": "View full size",
"previousScreenshot": "Previous screenshot",
"nextScreenshot": "Next screenshot",
"technicalDetails": "Technical details",
"sourceCode": "Workshop entry",
"loadError": "This submission could not be loaded.",
"sources": "Declared API sources",
"requests": "Declared queries and actions",
"noRequests": "This widget does not declare network requests.",
"export": "Export",
"report": "Report",
"install": "Install widget",
"continueInstall": "Continue installation",
"confirmInstallTitle": "Confirm widget installation",
"confirmInstallDescription": "Confirm where this widget connects and add any credentials required by your Homarr installation.",
"backToWidget": "Back to widget",
"useCss": "Import CSS",
"signInHint": "Sign in to vote or report. Installing does not require a Workshop account.",
"reportTitle": "Report submission",
"reportReason": "Reason",
"reportExplanation": "What should the Workshop moderators know?",
"reportSend": "Send report",
"reportSent": "Report sent",
"reportSentDescription": "Workshop moderators can now review this submission.",
"reportCount": "{count, plural, one {# report} other {# reports}}",
"reportWarning": "{count, plural, one {This submission has # open community report.} other {This submission has # open community reports.}} It remains installable, but you should review its content first.",
"reportVisibility": "Report details are visible only to this submission's author and Workshop admins.",
"reportCategory": {
"outdated": "Outdated or no longer working",
"malicious": "Malicious",
@@ -1502,7 +1520,6 @@
"inappropriate": "Inappropriate",
"other": "Other"
},
"voteError": "The vote could not be saved.",
"publish": {
"title": "Publish to Workshop",
"introTitle": "Share this widget with the community",
@@ -1511,7 +1528,6 @@
"listingDetailsDescription": "These details appear publicly alongside the exported widget definition.",
"success": "Published immediately. Community members can now install and report this widget.",
"successTitle": "Your widget is live",
"manageTitle": "Continue on Workshop",
"manageDescription": "Open the submission to update its listing, review reports, mark it outdated, or delete it. Submission management is handled directly on the Workshop website.",
"viewSubmission": "View and manage submission",
"done": "Done",
@@ -1530,10 +1546,7 @@
"publicationNote": "Publishing is immediate. You can manage the submission afterward on Workshop.",
"definitionChanged": "The widget changed while publication was being prepared. Review its private source URLs again, then retry.",
"error": "Publication failed"
},
"installDialog": "Install from Workshop",
"installed": "Widget installed",
"installedDescription": "{name} is ready to configure."
}
},
"integration": {
"completion": {
@@ -6128,7 +6141,6 @@
"apps": "Apps",
"integrations": "Integrations",
"customWidgets": "Custom Widgets",
"workshop": "Workshop",
"searchEngies": "Search engines",
"medias": "Medias",
"users": {
@@ -7614,11 +7626,14 @@
"flow": {
"label": "Flow"
}
},
"workshop": {
"label": "Workshop"
},
"publish": {
"label": "Publish to Workshop"
}
},
"workshop": {
"label": "Workshop"
},
"users": {
"label": "Users",
"create": {
@@ -1,41 +1,9 @@
.root {
--integration-marquee-accent: var(--mantine-primary-color-filled);
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: var(--mantine-spacing-xl);
height: 100%;
overflow: hidden;
transform: rotate(10deg);
}
.track {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--mantine-spacing-xl);
animation: integrationMarquee var(--marquee-duration) linear infinite;
}
.iconFrame {
display: grid;
flex: 0 0 4.5rem;
width: 4.5rem;
height: 4.5rem;
place-items: center;
border: 1px solid color-mix(in srgb, var(--integration-marquee-accent) 24%, transparent);
border-radius: var(--mantine-radius-lg);
background: color-mix(in srgb, var(--integration-marquee-accent) 8%, var(--mantine-color-body));
box-shadow: var(--mantine-shadow-sm);
}
@keyframes integrationMarquee {
to {
transform: translateY(-50%);
}
.marquee {
mask-image: linear-gradient(to bottom, transparent, black 14%, black 86%, transparent);
}
@media (prefers-reduced-motion: reduce) {
.track {
.content {
animation: none;
}
}
@@ -1,5 +1,4 @@
import type { CSSProperties } from "react";
import { Image } from "@mantine/core";
import { Image, Marquee, SimpleGrid } from "@mantine/core";
import { splitToNChunks } from "@homarr/common";
import { integrationDefs } from "@homarr/definitions";
@@ -15,19 +14,31 @@ const iconGroups = splitToNChunks(
const animationDuration = iconGroups.flat().length * 2;
export const IntegrationMarquee = ({ className }: { className?: string }) => (
<div className={[classes.root, className].filter(Boolean).join(" ")} aria-hidden>
<SimpleGrid
className={className}
cols={3}
spacing="xl"
h="calc(100% + 6rem)"
my="-3rem"
style={{ transform: "rotate(10deg)" }}
aria-hidden
>
{iconGroups.map((icons, columnIndex) => (
<div
<Marquee
key={columnIndex}
className={classes.track}
style={{ "--marquee-duration": `${animationDuration - columnIndex * 3}s` } as CSSProperties}
orientation="vertical"
repeat={2}
duration={(animationDuration - columnIndex * 3) * 1000}
gap="xl"
fadeEdges={false}
h="100%"
className={classes.marquee}
classNames={{ content: classes.content }}
>
{[...icons, ...icons].map((icon, iconIndex) => (
<div key={`${icon}-${iconIndex}`} className={classes.iconFrame}>
<Image src={icon} alt="" fit="contain" w={52} h={52} />
</div>
{icons.map((icon) => (
<Image key={`${icon}-${columnIndex}`} src={icon} alt="" fit="contain" w={52} h={52} />
))}
</div>
</Marquee>
))}
</div>
</SimpleGrid>
);
@@ -135,7 +135,7 @@ export default function BeszelAlertsWidget({
{alerts.length === 0 && (
<Stack align="center" justify="center" py="xl" gap="xs">
<ThemeIcon variant="light" color="gray" size="lg" radius="xl">
<IconBellOff size={18} />
<IconBellOff size="var(--mantine-font-size-lg)" />
</ThemeIcon>
<Text size="sm" c="dimmed">
{t("empty")}
@@ -146,7 +146,7 @@ export default function BeszelAlertsWidget({
{triggeredAlerts.length > 0 && (
<Stack gap={6}>
<Group gap={6}>
<IconFlame size={14} color="var(--mantine-color-red-6)" />
<IconFlame size="var(--mantine-font-size-sm)" color="var(--mantine-color-red-6)" />
<Text size="xs" fw={600} c="red">
{t("status.triggered")} ({triggeredAlerts.length})
</Text>
@@ -171,7 +171,7 @@ export default function BeszelAlertsWidget({
{showOkAlerts && okAlerts.length > 0 && (
<Stack gap={6}>
<Group gap={6}>
<IconCircleCheck size={14} color="var(--mantine-color-green-6)" />
<IconCircleCheck size="var(--mantine-font-size-sm)" color="var(--mantine-color-green-6)" />
<Text size="xs" fw={600} c="dimmed">
{t("status.ok")} ({okAlerts.length})
</Text>
@@ -196,7 +196,7 @@ export default function BeszelAlertsWidget({
<Divider />
<Stack gap={6}>
<Group gap={6}>
<IconHistory size={14} opacity={0.5} />
<IconHistory size="var(--mantine-font-size-sm)" opacity={0.5} />
<Text size="xs" fw={600} c="dimmed">
{t("history")}
</Text>
@@ -215,7 +215,7 @@ export default function BeszelAlertsWidget({
style={{ borderRadius: 2, flexShrink: 0 }}
bg={isResolved ? "green.6" : "red.6"}
/>
<HistoryIcon size={12} opacity={0.5} style={{ flexShrink: 0 }} />
<HistoryIcon size="var(--mantine-font-size-xs)" opacity={0.5} style={{ flexShrink: 0 }} />
<Stack gap={0} style={{ minWidth: 0 }}>
<Text size="xs" fw={500} truncate>
{entry.name}
@@ -229,7 +229,7 @@ export default function BeszelAlertsWidget({
<Badge size="xs" variant="dot" color={isResolved ? "green" : "red"}>
{isResolved ? t("resolved") : t("status.triggered")}
</Badge>
<Text size="10px" c="dimmed">
<Text size="xs" c="dimmed">
{dayjs(entry.created).fromNow()}
</Text>
</Stack>
@@ -292,7 +292,7 @@ function AlertRow({ name, value, min, systemName, integrationName, triggered, sh
backgroundColor: triggered ? "var(--mantine-color-red-light)" : "var(--mantine-color-default-hover)",
}}
>
<Icon size={14} opacity={0.7} style={{ flexShrink: 0 }} />
<Icon size="var(--mantine-font-size-sm)" opacity={0.7} style={{ flexShrink: 0 }} />
<Stack gap={0} style={{ flex: 1, minWidth: 0 }}>
<Group gap={6} wrap="nowrap">
<Text size="xs" fw={600} truncate>
@@ -59,7 +59,7 @@ interface SizeConfig {
const defaultSizeConfig: SizeConfig = {
iconSize: 10,
fontSize: "10px",
fontSize: "xs",
progressSize: "xs",
labelMiw: 40,
valueMiw: 30,
@@ -418,7 +418,7 @@ const SystemCard = ({
{visibleMetrics.map((m) => m.render(system, t, size))}
</Stack>
{hiddenMetricCount > 0 && (
<Text size="10px" c="dimmed" ta="right">
<Text size="xs" c="dimmed" ta="right">
+{hiddenMetricCount}
</Text>
)}
@@ -428,7 +428,7 @@ const SystemCard = ({
const SystemMetadata = ({ label, value }: { label: string; value: string }) => (
<Box style={{ minWidth: 0 }}>
<Text size="10px" c="dimmed">
<Text size="xs" c="dimmed">
{label}
</Text>
<Text size="xs" fw={500} truncate title={value}>
@@ -88,7 +88,7 @@ export function padLiveTimeGrid(data: Record<string, unknown>[], pointCount = 60
});
}
const yAxisBase = { tickMargin: 0, tick: { fontSize: 10 } } as const;
const yAxisBase = { tickMargin: 0, tick: { fontSize: "var(--mantine-font-size-xs)" } } as const;
const chartStyle = { minWidth: 0, minHeight: 1 } as const;
const panelStyle = { minWidth: 0, overflow: "hidden" } as const;
export const CPU_Y_AXIS_DOMAIN: [number, string] = [0, "auto"];
@@ -94,7 +94,7 @@ export const DiskUsage = ({ system, fontSize, progressSize, valueMiw, valueGap =
<Stack gap={6} miw={145}>
{[["/", system.disk] as const, ...filesystems].map(([path, value]) => (
<Stack key={path} gap={1}>
<Text size="10px" c="dimmed" fw={500} lh={1.2}>
<Text size="xs" c="dimmed" fw={500} lh={1.2}>
{mountLabel(path)}
</Text>
<Group gap={8} wrap="nowrap">
@@ -11,7 +11,7 @@ const styles: Record<string, CSSProperties> = {
border: "1px solid var(--mantine-color-dark-4)",
borderRadius: 6,
padding: "6px 10px",
fontSize: 12,
fontSize: "var(--mantine-font-size-xs)",
lineHeight: 1.5,
pointerEvents: "none",
overflowX: "hidden",
+16 -1
View File
@@ -657,6 +657,8 @@ export const workshopQueryKeys = {
] as const,
comments: (backend: WorkshopBackend, submission: string) =>
[...workshopQueryKeys.all, "comments", backend.baseUrl, submission] as const,
userVotes: (backend: WorkshopBackend) =>
[...workshopQueryKeys.all, "user-votes", backend.baseUrl, backend.currentUser?.id ?? "anonymous"] as const,
};
export const workshopListQueryOptions = (backend: WorkshopBackend, options: WorkshopListOptions = {}) =>
@@ -683,6 +685,14 @@ export const workshopReportSummariesQueryOptions = (backend: WorkshopBackend, su
enabled: submission.length > 0,
});
/** The votes the signed-in user already cast, so controls can render their own choice. */
export const workshopUserVotesQueryOptions = (backend: WorkshopBackend) =>
queryOptions({
queryKey: workshopQueryKeys.userVotes(backend),
queryFn: () => backend.listVotesForCurrentUser(),
enabled: backend.currentUser !== null,
});
export const workshopCommentsQueryOptions = (backend: WorkshopBackend, submission: string) =>
queryOptions({
queryKey: workshopQueryKeys.comments(backend, submission),
@@ -771,12 +781,17 @@ export function useWorkshopCommentsQuery(backend: WorkshopBackend, submission: s
return useQuery(workshopCommentsQueryOptions(backend, submission));
}
export function useWorkshopUserVotesQuery(backend: WorkshopBackend) {
return useQuery(workshopUserVotesQueryOptions(backend));
}
function useWorkshopInvalidation(backend: WorkshopBackend) {
const queryClient = useQueryClient();
return {
lists: () => queryClient.invalidateQueries({ queryKey: workshopQueryKeys.lists(backend.baseUrl) }),
details: () => queryClient.invalidateQueries({ queryKey: workshopQueryKeys.details(backend.baseUrl) }),
detail: (id: string) => queryClient.invalidateQueries({ queryKey: workshopQueryKeys.detail(backend, id) }),
userVotes: () => queryClient.invalidateQueries({ queryKey: workshopQueryKeys.userVotes(backend) }),
removeDetail: (id: string) => queryClient.removeQueries({ queryKey: workshopQueryKeys.detail(backend, id) }),
reports: () => queryClient.invalidateQueries({ queryKey: workshopQueryKeys.reports(backend) }),
reportSummaries: (submission: string) =>
@@ -814,7 +829,7 @@ export function useWorkshopVoteMutation(backend: WorkshopBackend) {
const invalidation = useWorkshopInvalidation(backend);
return useMutation({
...workshopVoteMutationOptions(backend),
onSuccess: async () => Promise.all([invalidation.lists(), invalidation.details()]),
onSuccess: async () => Promise.all([invalidation.lists(), invalidation.details(), invalidation.userVotes()]),
});
}