~ashkeel/strimertul

97c9117ce683b53db8579dbc85efe3cc0dfe7fe2 — Ash Keel a month ago d8a9c7e
refactor: fix biome lint issues
M frontend/biome.json => frontend/biome.json +3 -1
@@ 1,7 1,9 @@
{
	"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
	"files": {
		"ignore": ["wailsjs/**", "dist/**"]
	},
	"linter": {
		"ignore": ["wailsjs/**"],
		"rules": {
			"a11y": {
				"useValidAnchor": "off"

M frontend/src/store/logging/reducer.ts => frontend/src/store/logging/reducer.ts +5 -5
@@ 1,5 1,5 @@
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
import type { main } from "@wailsapp/go/models";
import type { log } from "@wailsapp/go/models";

export interface ProcessedLogEntry {
	id: string;


@@ 9,7 9,7 @@ export interface ProcessedLogEntry {
	data: object;
}

export function processEntry({ id, time, level, message, data }: main.LogEntry): ProcessedLogEntry {
export function processEntry({ id, time, level, message, data }: log.Entry): ProcessedLogEntry {
	return {
		id,
		time: new Date(time),


@@ 27,13 27,13 @@ const initialState: LoggingState = {
	messages: [],
};

const keyfn = (ev: main.LogEntry) => ev.id;
const keyfn = (ev: log.Entry) => ev.id;

const loggingReducer = createSlice({
	name: "logging",
	initialState,
	reducers: {
		loadedLogData(state, { payload }: PayloadAction<main.LogEntry[]>) {
		loadedLogData(state, { payload }: PayloadAction<log.Entry[]>) {
			const logKeys = payload.map(keyfn);

			// Clean up duplicates before setting to state


@@ 43,7 43,7 @@ const loggingReducer = createSlice({
				.map(processEntry)
				.sort((a, b) => a.time.getTime() - b.time.getTime());
		},
		receivedEvent(state, { payload }: PayloadAction<main.LogEntry>) {
		receivedEvent(state, { payload }: PayloadAction<log.Entry>) {
			state.messages.push(processEntry(payload));
		},
		clearedEvents(state) {

M frontend/src/ui/App.tsx => frontend/src/ui/App.tsx +6 -3
@@ 15,7 15,7 @@ import { useEffect, useState } from "react";
import { Route, Routes, useLocation, useNavigate } from "react-router-dom";

import { GetKilovoltBind, GetLastLogs, IsServerReady } from "@wailsapp/go/main/App";
import type { main } from "@wailsapp/go/models";
import type { log, main } from "@wailsapp/go/models";

import { useAppDispatch, useAppSelector } from "~/store";
import { createWSClient, useAuthBypass } from "~/store/api/reducer";


@@ 176,7 176,7 @@ export default function App(): JSX.Element {
		void GetLastLogs().then((logs) => {
			dispatch(loggingReducer.actions.loadedLogData(logs));
		});
		EventsOn("log-event", (event: main.LogEntry) => {
		EventsOn("log-event", (event: log.Entry) => {
			dispatch(loggingReducer.actions.receivedEvent(event));
		});
		return () => {


@@ 257,7 257,10 @@ export default function App(): JSX.Element {
			{showSidebar ? <Sidebar sections={sections} /> : null}
			<Scrollbar vertical={true} root={{ flex: 1 }} viewport={{ height: "100vh", flex: "1" }}>
				<PageContent>
					<PageWrapper role="main">
					<PageWrapper
						// biome-ignore lint/a11y/useSemanticElements: false positive, biome issue with stitches
						role="main"
					>
						<Routes>
							<Route path="/" element={<Dashboard />} />
							<Route path="/setup" element={<OnboardingPage />} />

M frontend/src/ui/ErrorWindow.tsx => frontend/src/ui/ErrorWindow.tsx +2 -2
@@ 1,6 1,6 @@
import { CheckIcon } from "@radix-ui/react-icons";
import { GetBackups, GetLastLogs, RestoreBackup, SendCrashReport } from "@wailsapp/go/main/App";
import type { main } from "@wailsapp/go/models";
import type { log, main } from "@wailsapp/go/models";
import { EventsOff, EventsOn } from "@wailsapp/runtime";
import { Fragment, useEffect, useState } from "react";
import { Trans, useTranslation } from "react-i18next";


@@ 473,7 473,7 @@ export default function ErrorWindow(): JSX.Element {
		void GetLastLogs().then((appLogs) => {
			setLogs(appLogs.map(processEntry).reverse());
		});
		EventsOn("log-event", (event: main.LogEntry) => {
		EventsOn("log-event", (event: log.Entry) => {
			setLogs([processEntry(event), ...logs]);
		});
		return () => {

M frontend/src/ui/components/PageList.tsx => frontend/src/ui/components/PageList.tsx +1 -0
@@ 29,6 29,7 @@ function PageList({
	const { t } = useTranslation();
	return (
		<Toolbar
			// biome-ignore lint/a11y/useSemanticElements: False positive, biome issue with stitches
			role="navigation"
			aria-label={t("pagination.title")}
			css={{

M frontend/src/ui/pages/system/ServerSettings.tsx => frontend/src/ui/pages/system/ServerSettings.tsx +1 -1
@@ 103,7 103,7 @@ export default function ServerSettingsPage(): React.ReactElement {
								}),
							)
						}
						value={serverConfig?.enable_static_server ? serverConfig?.path ?? "" : ""}
						value={serverConfig?.enable_static_server ? (serverConfig?.path ?? "") : ""}
					/>
					<FieldNote>
						{t("pages.http.static-help", {

M frontend/src/ui/pages/twitch/TwitchSettings/TwitchChatSettings.tsx => frontend/src/ui/pages/twitch/TwitchSettings/TwitchChatSettings.tsx +1 -1
@@ 62,7 62,7 @@ export default function TwitchChatSettings() {
					id="bot-chat-history"
					required={true}
					disabled={disabled}
					defaultValue={chatConfig ? chatConfig.command_cooldown ?? 2 : undefined}
					defaultValue={chatConfig ? (chatConfig.command_cooldown ?? 2) : undefined}
					onChange={(ev) =>
						dispatch(
							apiReducer.actions.twitchChatConfigChanged({