Skip to content

Commit

Permalink
Revert "Add opacity control to widget settings and match history disp…
Browse files Browse the repository at this point in the history
…lay"

This reverts commit 689b5ce
  • Loading branch information
raimannma committed Feb 11, 2025
1 parent f59de86 commit 56cc289
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 39 deletions.
23 changes: 0 additions & 23 deletions app/components/widget-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type PreviewBackgroundColor = RGB | RGBA | HEX;
export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps) {
const [widgetType, setWidgetType] = useState<string>(widgetTypes[0]);
const [theme, setTheme] = useState<Theme>("dark");
const [opacity, setOpacity] = useState<number>(100);
const [widgetUrl, setWidgetUrl] = useState<string | null>(null);
const [widgetPreview, setWidgetPreview] = useState<ReactElement | null>(null);
const [widgetPreviewBackgroundImage, setWidgetPreviewBackgroundImage] = useState<boolean>(true);
Expand Down Expand Up @@ -58,7 +57,6 @@ 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());
Expand All @@ -78,7 +76,6 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps)
labels={labels}
extraArgs={extraArgs}
theme={theme}
opacity={opacity}
showHeader={showHeader}
showBranding={showBranding}
showMatchHistory={showMatchHistory}
Expand All @@ -98,7 +95,6 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps)
labels,
extraArgs,
theme,
opacity,
showHeader,
showBranding,
matchHistoryShowsToday,
Expand Down Expand Up @@ -151,25 +147,6 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps)
</select>
</div>

<div>
<label htmlFor="opacity" className="block text-sm font-medium text-gray-700">
Opacity
</label>
<div className="flex items-center gap-2">
<input
id="opacity"
type="range"
min={0}
max={100}
step={5}
value={opacity}
onChange={(e) => setOpacity(Number.parseInt(e.target.value))}
className="rounded border-gray-300 bg-gray-200 w-min"
/>
<span className="text-sm font-medium text-gray-700">{opacity.toFixed(0)}%</span>
</div>
</div>

<div className="space-y-4">
<div className="flex items-center gap-2">
<input
Expand Down
3 changes: 1 addition & 2 deletions app/components/widgets/MatchHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UPDATE_INTERVAL_MS } from "~/constants/widget";
import { cn } from "~/lib/utils";
import type { Hero, Match, MatchHistoryProps } from "~/types/match-history";

export const MatchHistory: FC<MatchHistoryProps> = ({ theme, opacity, numMatches, accountId, refresh }) => {
export const MatchHistory: FC<MatchHistoryProps> = ({ theme, numMatches, accountId, refresh }) => {
const [matches, setMatches] = useState<Match[]>([]);
const [heroes, setHeroes] = useState<Map<number, string>>(new Map());
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -62,7 +62,6 @@ export const MatchHistory: FC<MatchHistoryProps> = ({ theme, opacity, numMatches
"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);
Expand Down
10 changes: 1 addition & 9 deletions app/components/widgets/box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const BoxWidget: FC<BoxWidgetProps> = ({
labels = DEFAULT_LABELS,
extraArgs = {},
theme = "dark",
opacity = 100,
showHeader = true,
refreshInterval = UPDATE_INTERVAL_MS,
showBranding = true,
Expand Down Expand Up @@ -98,13 +97,7 @@ export const BoxWidget: FC<BoxWidgetProps> = ({
className="grow-1 w-0 overflow-clip
"
>
<MatchHistory
theme={theme}
opacity={opacity}
refresh={refreshChildren}
numMatches={numMatchesToShow}
accountId={accountId}
/>
<MatchHistory theme={theme} refresh={refreshChildren} numMatches={numMatchesToShow} accountId={accountId} />
</div>
</div>
)}
Expand All @@ -122,7 +115,6 @@ export const BoxWidget: FC<BoxWidgetProps> = ({
"shadow-lg",
THEME_STYLES[theme].container,
)}
style={{ opacity: opacity / 100 }}
>
{shouldShowHeader && (
<div
Expand Down
4 changes: 1 addition & 3 deletions app/routes/widgets.$region.$accountId.$widgetType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ export default function Widget() {
const variables = searchParams.get("vars")?.split(",");
const labels = searchParams.get("labels")?.split(",") ?? variables?.map(snakeToPretty);
const theme = (searchParams.get("theme") ?? "dark") as Theme;
const opacity = Number.parseFloat(searchParams.get("opacity") ?? "100");
const showHeader = searchParams.get("showHeader") !== "false";
const showBranding = searchParams.get("showBranding") !== "false";
const showMatchHistory = searchParams.get("showMatchHistory") !== "false";
const matchHistoryShowsToday = searchParams.get("matchHistoryShowsToday") !== "false";
const numMatches = Number.parseInt(searchParams.get("numMatches") ?? "10");
const numMatches = Number.parseInt(searchParams.get("numMatches") ?? "10", 10);
const extraArgs = Object.fromEntries(
Array.from(searchParams.entries()).filter(
([key]) =>
Expand All @@ -80,7 +79,6 @@ export default function Widget() {
labels={labels}
extraArgs={extraArgs}
theme={theme}
opacity={opacity}
showHeader={showHeader}
showBranding={showBranding}
showMatchHistory={showMatchHistory}
Expand Down
1 change: 0 additions & 1 deletion app/types/match-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type Hero = {

export type MatchHistoryProps = {
theme: string;
opacity: number;
numMatches?: number;
accountId: string;
refresh: number;
Expand Down
1 change: 0 additions & 1 deletion app/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type BoxWidgetProps = {
labels?: string[];
extraArgs?: Record<string, string>;
theme?: Theme;
opacity?: number;
showHeader?: boolean;
refreshInterval?: number;
showBranding?: boolean;
Expand Down

0 comments on commit 56cc289

Please sign in to comment.