import { useState } from "react"; import { Anchor, Button, Stack, Text } from "@mantine/core"; import { useSession } from "@homarr/auth/client"; import type { stringOrTranslation } from "@homarr/translation"; import { translateIfNecessary } from "@homarr/translation"; import { useI18n } from "@homarr/translation/client"; import { Link } from "@homarr/ui"; import type { TablerIcon } from "@homarr/ui"; export interface BaseWidgetErrorProps { icon: TablerIcon; message: stringOrTranslation; showLogsLink?: boolean; onRetry: () => void; } export const BaseWidgetError = (props: BaseWidgetErrorProps) => { const t = useI18n(); const { data: session } = useSession(); const [errorTimestamp] = useState(Date.now); return ( {translateIfNecessary(t, props.message)} {props.showLogsLink && session?.user.permissions.includes("other-view-logs") && ( {t("common.action.checkLogs")} )} ); };