fix(widgets): restore readable summary text and icons (#7068)
* fix(widgets): restore readable summary text and icons * fix: size Bazarr columns using displayed dimensions * Revert "fix: size Bazarr columns using displayed dimensions" This reverts commit 02e28a964faa191a91f840b7b45d79ea937dac5d.
This commit is contained in:
1 parent
8d78d0ae54
commit
2ea05f50cc
5 files changed
+58
-19
No files matched your search
@@ -35,11 +35,16 @@
|
|||||||
|
|
||||||
.grid[data-short] .statTile {
|
.grid[data-short] .statTile {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 3px;
|
gap: calc(3px * var(--board-canvas-ui-scale, 1));
|
||||||
padding: 3px 4px;
|
padding: 3px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid[data-short] .statValue {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.grid[data-short] .statLabel {
|
.grid[data-short] .statLabel {
|
||||||
|
min-width: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.statLabel {
|
.statLabel {
|
||||||
font-size: clamp(8px, 2.5cqi, 12px);
|
font-size: clamp(var(--mantine-font-size-xs), 2.5cqi, var(--mantine-font-size-sm));
|
||||||
color: var(--mantine-color-dimmed);
|
color: var(--mantine-color-dimmed);
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -66,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.statValue {
|
.statValue {
|
||||||
font-size: clamp(14px, 5.5cqi, 24px);
|
font-size: clamp(var(--mantine-font-size-lg), 5.5cqi, var(--mantine-font-size-2xl));
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: var(--mantine-primary-color-filled);
|
color: var(--mantine-primary-color-filled);
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default function BazarrWidget({
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
displayMode,
|
displayMode,
|
||||||
|
displayScale = 1,
|
||||||
}: WidgetComponentProps<"bazarr">) {
|
}: WidgetComponentProps<"bazarr">) {
|
||||||
const t = useI18n("widget.bazarr");
|
const t = useI18n("widget.bazarr");
|
||||||
const { data: badges, error } = clientApi.widget.bazarr.getBadges.useQuery(
|
const { data: badges, error } = clientApi.widget.bazarr.getBadges.useQuery(
|
||||||
@@ -84,7 +85,9 @@ export default function BazarrWidget({
|
|||||||
const visibleStatKeys = getVisibleBazarrStatKeys(options, displayMode);
|
const visibleStatKeys = getVisibleBazarrStatKeys(options, displayMode);
|
||||||
|
|
||||||
const gridCols = getGridCols(width, height, visibleStatKeys.length);
|
const gridCols = getGridCols(width, height, visibleStatKeys.length);
|
||||||
const iconSize = getIconSize(Math.min(width, height));
|
const iconSize = Math.max(20, getIconSize(Math.min(width, height)));
|
||||||
|
let responsiveHeight = height;
|
||||||
|
if (displayMode !== "advanced") responsiveHeight *= displayScale;
|
||||||
|
|
||||||
if (visibleStatKeys.length === 0) {
|
if (visibleStatKeys.length === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -102,7 +105,7 @@ export default function BazarrWidget({
|
|||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<div
|
<div
|
||||||
className={classes.grid}
|
className={classes.grid}
|
||||||
data-short={height < 120 || undefined}
|
data-short={(responsiveHeight < 120 && gridCols < visibleStatKeys.length) || undefined}
|
||||||
style={{ "--stat-cols": gridCols } as CSSProperties}
|
style={{ "--stat-cols": gridCols } as CSSProperties}
|
||||||
>
|
>
|
||||||
{visibleStatKeys.map((statKey) => {
|
{visibleStatKeys.map((statKey) => {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ export default function NotificationsWidget({
|
|||||||
aria-label={t("openService")}
|
aria-label={t("openService")}
|
||||||
title={t("openService")}
|
title={t("openService")}
|
||||||
>
|
>
|
||||||
<IconExternalLink size={16} />
|
<IconExternalLink style={iconSizes.md} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
)}
|
)}
|
||||||
{notification.integrationKind === "gotify" &&
|
{notification.integrationKind === "gotify" &&
|
||||||
@@ -187,7 +187,7 @@ export default function NotificationsWidget({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash style={iconSizes.md} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.heroTextOnly .heroValue {
|
.heroTextOnly .heroValue {
|
||||||
font-size: clamp(22px, 10cqmin, 36px);
|
font-size: clamp(var(--mantine-font-size-2xl), 10cqmin, var(--mantine-font-size-4xl));
|
||||||
}
|
}
|
||||||
|
|
||||||
.heroText {
|
.heroText {
|
||||||
@@ -48,13 +48,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.heroLabel {
|
.heroLabel {
|
||||||
font-size: clamp(9px, 2.8cqmin, 13px);
|
font-size: clamp(var(--mantine-font-size-xs), 2.8cqmin, var(--mantine-font-size-sm));
|
||||||
color: var(--mantine-color-dimmed);
|
color: var(--mantine-color-dimmed);
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.heroValue {
|
.heroValue {
|
||||||
font-size: clamp(18px, 8cqmin, 32px);
|
font-size: clamp(var(--mantine-font-size-xl), 8cqmin, var(--mantine-font-size-4xl));
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
}
|
}
|
||||||
@@ -88,19 +88,32 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.root[data-short] .statTile {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.root[data-short] .statValue {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.root[data-short] .statLabel {
|
||||||
|
min-width: 0;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.statIcon {
|
.statIcon {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statValue {
|
.statValue {
|
||||||
font-size: clamp(14px, 5.5cqmin, 24px);
|
font-size: clamp(var(--mantine-font-size-lg), 5.5cqmin, var(--mantine-font-size-2xl));
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statLabel {
|
.statLabel {
|
||||||
font-size: clamp(8px, 2.5cqmin, 12px);
|
font-size: clamp(var(--mantine-font-size-xs), 2.5cqmin, var(--mantine-font-size-sm));
|
||||||
color: var(--mantine-color-dimmed);
|
color: var(--mantine-color-dimmed);
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export default function UptimeKumaWidget({
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
displayMode = "compact",
|
displayMode = "compact",
|
||||||
|
displayScale = 1,
|
||||||
}: WidgetComponentProps<"uptimeKuma">) {
|
}: WidgetComponentProps<"uptimeKuma">) {
|
||||||
if (integrationIds.length === 0) {
|
if (integrationIds.length === 0) {
|
||||||
throw new NoIntegrationDataError();
|
throw new NoIntegrationDataError();
|
||||||
@@ -97,6 +98,7 @@ export default function UptimeKumaWidget({
|
|||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
displayMode={displayMode}
|
displayMode={displayMode}
|
||||||
|
displayScale={displayScale}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -107,9 +109,17 @@ interface UptimeKumaContentProps {
|
|||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
displayMode: "compact" | "advanced";
|
displayMode: "compact" | "advanced";
|
||||||
|
displayScale: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
function UptimeKumaContent({ integrationIds, options, width, height, displayMode }: UptimeKumaContentProps) {
|
function UptimeKumaContent({
|
||||||
|
integrationIds,
|
||||||
|
options,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
displayMode,
|
||||||
|
displayScale,
|
||||||
|
}: UptimeKumaContentProps) {
|
||||||
const t = useI18n("widget.uptimeKuma");
|
const t = useI18n("widget.uptimeKuma");
|
||||||
const dashboardQuery = clientApi.widget.uptimeKuma.getDashboard.useQuery({ integrationIds });
|
const dashboardQuery = clientApi.widget.uptimeKuma.getDashboard.useQuery({ integrationIds });
|
||||||
const dashboardData = getUsableWidgetQueryData(dashboardQuery);
|
const dashboardData = getUsableWidgetQueryData(dashboardQuery);
|
||||||
@@ -129,11 +139,17 @@ function UptimeKumaContent({ integrationIds, options, width, height, displayMode
|
|||||||
);
|
);
|
||||||
const uptimeValue = clampPercent(combined.averageUptimePercent);
|
const uptimeValue = clampPercent(combined.averageUptimePercent);
|
||||||
const uptimeColor = getUptimeColor(uptimeValue);
|
const uptimeColor = getUptimeColor(uptimeValue);
|
||||||
const visualScale = Math.min(width, height);
|
|
||||||
const ringSize = getRingSize(visualScale);
|
|
||||||
const iconSize = getIconSize(visualScale);
|
|
||||||
const gridCols = getGridCols(width);
|
|
||||||
const isAdvanced = displayMode === "advanced";
|
const isAdvanced = displayMode === "advanced";
|
||||||
|
let responsiveWidth = width;
|
||||||
|
let responsiveHeight = height;
|
||||||
|
if (!isAdvanced) {
|
||||||
|
responsiveWidth *= displayScale;
|
||||||
|
responsiveHeight *= displayScale;
|
||||||
|
}
|
||||||
|
const visualScale = Math.min(responsiveWidth, responsiveHeight);
|
||||||
|
const ringSize = getRingSize(visualScale);
|
||||||
|
const iconSize = getIconSize(Math.min(width, height));
|
||||||
|
const gridCols = getGridCols(responsiveWidth);
|
||||||
|
|
||||||
const enabledStatKeys = Object.entries(statVisibilityByOption)
|
const enabledStatKeys = Object.entries(statVisibilityByOption)
|
||||||
.filter(([optionKey]) => isAdvanced || options[optionKey as keyof typeof options])
|
.filter(([optionKey]) => isAdvanced || options[optionKey as keyof typeof options])
|
||||||
@@ -149,7 +165,7 @@ function UptimeKumaContent({ integrationIds, options, width, height, displayMode
|
|||||||
const heroRingClass = heroVariantByRing[String(showRing) as keyof typeof heroVariantByRing];
|
const heroRingClass = heroVariantByRing[String(showRing) as keyof typeof heroVariantByRing];
|
||||||
|
|
||||||
const summaryContent = (
|
const summaryContent = (
|
||||||
<div className={classes.root}>
|
<div className={classes.root} data-short={responsiveHeight < 240 || undefined}>
|
||||||
{showHero && (
|
{showHero && (
|
||||||
<div className={`${classes.hero} ${heroLayoutClass} ${heroRingClass}`}>
|
<div className={`${classes.hero} ${heroLayoutClass} ${heroRingClass}`}>
|
||||||
<div className={classes.heroText}>
|
<div className={classes.heroText}>
|
||||||
@@ -195,7 +211,9 @@ function UptimeKumaContent({ integrationIds, options, width, height, displayMode
|
|||||||
color={`var(--mantine-color-${color}-6)`}
|
color={`var(--mantine-color-${color}-6)`}
|
||||||
/>
|
/>
|
||||||
<span className={classes.statValue}>{formatNumber(combined[statKey], 0)}</span>
|
<span className={classes.statValue}>{formatNumber(combined[statKey], 0)}</span>
|
||||||
<span className={classes.statLabel}>{t(`stats.${statKey}`)}</span>
|
<span className={classes.statLabel} title={t(`stats.${statKey}`)}>
|
||||||
|
{t(`stats.${statKey}`)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in new issue
Block a user