Skip to content

Commit

Permalink
Adjust default variables/labels
Browse files Browse the repository at this point in the history
  • Loading branch information
raimannma committed Feb 6, 2025
1 parent 0be20df commit a05dd7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/components/widget-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type ReactElement, useEffect, useState } from "react";
import type { Variable } from "~/components/command/CommandBuilder";
import { ExtraArguments } from "~/components/widgets/ExtraArguments";
import { BoxWidget } from "~/components/widgets/box";
import { DEFAULT_LABELS, DEFAULT_VARIABLES } from "~/constants/widget";
import { snakeToPretty } from "~/lib/utils";
import type { Region, Theme } from "~/types/widget";

Expand All @@ -17,8 +18,8 @@ export default function WidgetBuilder({ region, accountId }: WidgetBuilderProps)
const [theme, setTheme] = useState<Theme>("dark");
const [widgetUrl, setWidgetUrl] = useState<string | null>(null);
const [widgetPreview, setWidgetPreview] = useState<ReactElement | null>(null);
const [variables, setVariables] = useState<string[]>(["leaderboard_place", "wins_today", "losses_today"]);
const [labels, setLabels] = useState<string[]>(["Leaderboard Place", "Wins Today", "Losses Today"]);
const [variables, setVariables] = useState<string[]>(DEFAULT_VARIABLES);
const [labels, setLabels] = useState<string[]>(DEFAULT_LABELS);
const [extraArgs, setExtraArgs] = useState<{ [key: string]: string }>({});
const [availableVariables, setAvailableVariables] = useState<Variable[]>([]);
const [showHeader, setShowHeader] = useState(true);
Expand Down
4 changes: 2 additions & 2 deletions app/components/widgets/box.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type FC, useEffect, useState } from "react";
import { DEFAULT_VARIABLES, THEME_STYLES, UPDATE_INTERVAL_MS } from "~/constants/widget";
import { DEFAULT_LABELS, DEFAULT_VARIABLES, THEME_STYLES, UPDATE_INTERVAL_MS } from "~/constants/widget";
import { cn, snakeToPretty } from "~/lib/utils";
import type { BoxWidgetProps, Region, Stat } from "~/types/widget";
import { MatchHistory } from "./MatchHistory";
Expand All @@ -9,7 +9,7 @@ export const BoxWidget: FC<BoxWidgetProps> = ({
region,
accountId,
variables = DEFAULT_VARIABLES,
labels,
labels = DEFAULT_LABELS,
extraArgs = {},
theme = "default",
showHeader = true,
Expand Down
4 changes: 3 additions & 1 deletion app/constants/widget.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const UPDATE_INTERVAL_MS = 2 * 60 * 1000;

export const DEFAULT_VARIABLES = ["leaderboard_place", "wins_today", "losses_today", "winrate_today"];
export const DEFAULT_VARIABLES = ["leaderboard_place", "leaderboard_rank", "wins_losses_today", "total_kd"];

export const DEFAULT_LABELS = ["Place", "Rank", "Daily W-L", "K/D"];

export const THEME_STYLES = {
default: {
Expand Down

0 comments on commit a05dd7c

Please sign in to comment.