diff --git a/app/components/widget-builder.tsx b/app/components/widget-builder.tsx index 741fdac..61567f2 100644 --- a/app/components/widget-builder.tsx +++ b/app/components/widget-builder.tsx @@ -22,6 +22,7 @@ type PreviewBackground = "image" | RGB | RGBA | HEX; export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) { const [widgetType, setWidgetType] = useState(widgetTypes[0]); const [theme, setTheme] = useState("dark"); + const [opacity, setOpacity] = useState(100); const [widgetUrl, setWidgetUrl] = useState(null); const [widgetPreview, setWidgetPreview] = useState(null); const [widgetPreviewBackground, setWidgetPreviewBackground] = useState("#f3f4f6"); @@ -56,6 +57,7 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) if (variables.length > 0) url.searchParams.set("vars", variables.join(",")); if (labels.length > 0) url.searchParams.set("labels", labels.join(",")); url.searchParams.set("theme", theme); + url.searchParams.set("opacity", opacity.toString()); url.searchParams.set("showHeader", showHeader.toString()); url.searchParams.set("showBranding", showBranding.toString()); url.searchParams.set("showMatchHistory", showMatchHistory.toString()); @@ -75,6 +77,7 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) labels={labels} extraArgs={extraArgs} theme={theme} + opacity={opacity} showHeader={showHeader} showBranding={showBranding} showMatchHistory={showMatchHistory} @@ -94,6 +97,7 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) labels, extraArgs, theme, + opacity, showHeader, showBranding, matchHistoryShowsToday, @@ -146,6 +150,25 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) +
+ +
+ setOpacity(Number.parseInt(e.target.value))} + className="rounded border-gray-300 bg-gray-200 w-min" + /> + {opacity.toFixed(0)}% +
+
+
= ({ theme, numMatches, accountId, refresh }) => { +export const MatchHistory: FC = ({ theme, opacity, numMatches, accountId, refresh }) => { const [matches, setMatches] = useState([]); const [heroes, setHeroes] = useState>(new Map()); const [loading, setLoading] = useState(true); @@ -62,6 +62,7 @@ export const MatchHistory: FC = ({ theme, numMatches, account "flex gap-0.5 justify-start items-center h-9 rounded-t-xl pt-1", theme === "light" ? "bg-white" : theme === "dark" ? "bg-[#1A1B1E]" : "text-white", )} + style={{ opacity: opacity / 100 }} > {[...matches].map((match) => { const heroImage = heroes.get(match.hero_id); diff --git a/app/components/widgets/box.tsx b/app/components/widgets/box.tsx index f8bb159..0b338a2 100644 --- a/app/components/widgets/box.tsx +++ b/app/components/widgets/box.tsx @@ -13,6 +13,7 @@ export const BoxWidget: FC = ({ labels = DEFAULT_LABELS, extraArgs = {}, theme = "default", + opacity = 100, showHeader = true, refreshInterval = UPDATE_INTERVAL_MS, showBranding = true, @@ -97,7 +98,13 @@ export const BoxWidget: FC = ({ className="grow-1 w-0 overflow-clip " > - +
)} @@ -115,6 +122,7 @@ export const BoxWidget: FC = ({ "shadow-lg", THEME_STYLES[theme].container, )} + style={{ opacity: opacity / 100 }} > {shouldShowHeader && (
@@ -79,6 +80,7 @@ export default function Widget() { labels={labels} extraArgs={extraArgs} theme={theme} + opacity={opacity} showHeader={showHeader} showBranding={showBranding} showMatchHistory={showMatchHistory} diff --git a/app/types/match-history.ts b/app/types/match-history.ts index a60653c..9a945f9 100644 --- a/app/types/match-history.ts +++ b/app/types/match-history.ts @@ -14,6 +14,7 @@ export type Hero = { export type MatchHistoryProps = { theme: string; + opacity: number; numMatches?: number; accountId: string; refresh: number; diff --git a/app/types/widget.ts b/app/types/widget.ts index 4451540..ef0aada 100644 --- a/app/types/widget.ts +++ b/app/types/widget.ts @@ -21,6 +21,7 @@ export type BoxWidgetProps = { labels?: string[]; extraArgs?: Record; theme?: Theme; + opacity?: number; showHeader?: boolean; refreshInterval?: number; showBranding?: boolean;