Skip to content

Commit

Permalink
webapp: remove VIEW_SIZE signal
Browse files Browse the repository at this point in the history
Not needed as a signal.
  • Loading branch information
jasonish committed Dec 28, 2024
1 parent e56226c commit cf85814
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
11 changes: 5 additions & 6 deletions webapp/src/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
getViewSize,
setTheme,
setViewSize,
VIEW_SIZE,
} from "./settings";

export function Settings() {
Expand Down Expand Up @@ -53,19 +52,19 @@ export function Settings() {
class="form-select"
onchange={(e) => setViewSize(e.currentTarget.value)}
>
<option value="100" selected={VIEW_SIZE() === 100}>
<option value="100" selected={getViewSize() === 100}>
100
</option>
<option value="200" selected={VIEW_SIZE() === 200}>
<option value="200" selected={getViewSize() === 200}>
200
</option>
<option value="300" selected={VIEW_SIZE() === 300}>
<option value="300" selected={getViewSize() === 300}>
300
</option>
<option value="400" selected={VIEW_SIZE() === 400}>
<option value="400" selected={getViewSize() === 400}>
400
</option>
<option value="500" selected={VIEW_SIZE() === 500}>
<option value="500" selected={getViewSize() === 500}>
500
</option>
<option value="fit" selected={getViewSize() === "fit"}>
Expand Down
11 changes: 0 additions & 11 deletions webapp/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@ import { parse_timerange } from "./datetime";
import { Chart } from "chart.js";

const DEFAULT_THEME = "light";
const DEFAULT_VIEW_SIZE = 100;

export const [currentThemeName, setCurrentThemeName] =
createSignal(DEFAULT_THEME);

const localViewSize =
+(localStorage.getItem("VIEW_SIZE") || DEFAULT_VIEW_SIZE) ||
DEFAULT_VIEW_SIZE;

// TODO: Probably doesn't need to be a signal.
export const [VIEW_SIZE, SET_VIEW_SIZE] = createSignal<number | string>(
localViewSize
);

export function setTheme(name: string) {
document.getElementById("theme")?.remove();
let e = document.createElement("style");
Expand Down Expand Up @@ -56,7 +46,6 @@ export function loadInitialTheme() {

export function setViewSize(size: number | string) {
localStorage.setItem("VIEW_SIZE", `${size}`);
SET_VIEW_SIZE(size);
}

export function getViewSize(): number | string {
Expand Down

0 comments on commit cf85814

Please sign in to comment.