(fix): remove unused dependencies
Some checks failed
/ build-desktop (linux) (push) Failing after 52s
/ build-web (push) Failing after 1m3s
/ build-mobile (push) Failing after 1m6s
/ release (push) Has been skipped

(fix): remove dead code
(fix): remove unused exports
This commit is contained in:
Alois 2026-06-03 14:53:18 +02:00
commit be56080ba1
29 changed files with 168 additions and 338 deletions

View file

@ -33,7 +33,7 @@ import { useIsMobile } from "@tensamin/ui";
import { MobileNavbar } from "./navbar";
import SidebarBox from "@tensamin/call/sidebarBox";
import { useShowMobileNavbar } from "@/routes/app/layout";
import { useShowMobileNavbar } from "@/routes/app/useShowMobileNavbar";
import { Ellipsis, Check } from "lucide-react";
import { useState } from "react";
import type { User } from "@tensamin/user/context";

View file

@ -220,7 +220,7 @@ function ContinueButton({
);
}
export function BigCheckbox({
function BigCheckbox({
id,
label,
checked,

View file

@ -1,5 +1,5 @@
import { Label } from "@tensamin/ui";
import { Switch as UISwitch, Input as UIInput } from "@tensamin/ui";
import { Switch as UISwitch } from "@tensamin/ui";
import { useEffect, useState } from "react";
import type { Storage } from "@tensamin/shared/data";
@ -10,28 +10,6 @@ type BooleanStorageKey = {
[K in keyof Storage]: Storage[K] extends boolean ? K : never;
}[keyof Storage];
type StringStorageKey = {
[K in keyof Storage]: Storage[K] extends string ? K : never;
}[keyof Storage];
type NumberStorageKey = {
[K in keyof Storage]: Storage[K] extends number ? K : never;
}[keyof Storage];
type InputProps =
| {
label: string;
id: StringStorageKey;
placeholder?: string;
type?: "text";
}
| {
label: string;
id: NumberStorageKey;
placeholder?: string;
type: "number";
};
export function Switch({
label,
id,
@ -60,49 +38,3 @@ export function Switch({
</div>
);
}
export function Input({ label, id, placeholder, type }: InputProps) {
const { save, load } = useStorage();
const [value, setValue] = useState<string | number>(
type === "number" ? 0 : "",
);
useEffect(() => {
load(id).then((loadedValue) => {
if (type === "number") {
if (typeof loadedValue === "number") {
setValue(loadedValue);
}
return;
}
if (typeof loadedValue === "string") {
setValue(loadedValue);
}
});
}, [id, load, type]);
return (
<div className="flex flex-col gap-1">
<Label htmlFor={id}>{label}</Label>
<UIInput
id={id}
type={type || "text"}
placeholder={placeholder}
value={value}
onChange={(e) => {
if (type === "number") {
const nextValue = Number(e.target.value);
setValue(nextValue);
save(id, nextValue);
return;
}
const nextValue = e.target.value;
setValue(nextValue);
save(id, nextValue);
}}
/>
</div>
);
}

View file

@ -2,17 +2,12 @@ import { type ReactNode } from "react";
import Sidebar from "@/components/sidebar";
import Navbar, { MobileNavbar } from "@/components/navbar";
import { useShowMobileNavbar } from "./useShowMobileNavbar";
import { useIsMobile, cn, SidebarProvider } from "@tensamin/ui";
import { isTauri } from "@tauri-apps/api/core";
import { useLocation, useMatches } from "@tanstack/react-router";
/**
* Executes Layout.
* @param props Parameter props.
* @returns unknown.
*/
export default function Layout({ children }: { children: ReactNode }) {
const isMobile = useIsMobile();
const showMobileNavbar = useShowMobileNavbar();
@ -47,17 +42,3 @@ export default function Layout({ children }: { children: ReactNode }) {
</div>
);
}
export function useShowMobileNavbar(): boolean {
const matches = useMatches();
const location = useLocation();
const value = matches.some(
(match) =>
match.pathname === location.pathname &&
// @ts-expect-error Stuff
match.staticData?.showMobileNavbar === true,
);
return value;
}

View file

@ -0,0 +1,14 @@
import { useLocation, useMatches } from "@tanstack/react-router";
export function useShowMobileNavbar(): boolean {
const matches = useMatches();
const location = useLocation();
return matches.some(
(match) =>
match.pathname === location.pathname &&
// Router staticData is app-defined and not typed by the route matcher here.
// @ts-expect-error App route metadata
match.staticData?.showMobileNavbar === true,
);
}