Skip to content

Commit 851586d

Browse files
committed
refactor: drop unreferenced files and exports
Removes inline-error, useErrorHandler, the unused hooks barrel, and seven dead exports including the events API superseded by useTauriEvent.
1 parent 8065a18 commit 851586d

11 files changed

Lines changed: 3 additions & 303 deletions

File tree

ui/src/components/common/ErrorBoundary.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ interface ErrorBoundaryState {
1313
error: Error | null;
1414
}
1515

16-
export class ErrorBoundary extends Component<
17-
ErrorBoundaryProps,
18-
ErrorBoundaryState
19-
> {
16+
class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
2017
constructor(props: ErrorBoundaryProps) {
2118
super(props);
2219
this.state = { hasError: false, error: null };

ui/src/components/ui/inline-error.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

ui/src/components/ui/lazy-image.tsx

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,6 @@ import { type RefObject, useState } from "react";
22
import { useLazyImage } from "@/hooks/useLazyImage";
33
import { cn } from "@/lib/utils";
44

5-
interface LazyImageProps {
6-
src: string;
7-
alt: string;
8-
className?: string;
9-
placeholderClassName?: string;
10-
}
11-
12-
/**
13-
* Basic lazy-loaded image that shows a placeholder until in view.
14-
*/
15-
export function LazyImage({
16-
src,
17-
alt,
18-
className,
19-
placeholderClassName = "h-32 bg-muted animate-pulse",
20-
}: LazyImageProps) {
21-
const { ref, isInView } = useLazyImage();
22-
23-
return (
24-
<div ref={ref as RefObject<HTMLDivElement>}>
25-
{isInView ? (
26-
<img src={src} alt={alt} className={className} />
27-
) : (
28-
<div className={placeholderClassName} />
29-
)}
30-
</div>
31-
);
32-
}
33-
345
interface LazyImageWithFallbackProps {
356
src: string;
367
alt?: string;

ui/src/hooks/index.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

ui/src/hooks/useErrorHandler.ts

Lines changed: 0 additions & 159 deletions
This file was deleted.

ui/src/lib/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ export const PRIORITY_CONFIG: Record<
3535
"bg-red-500/20 text-red-500 border-red-500/30 hover:bg-red-500/30",
3636
},
3737
} as const;
38-
39-
export const DEFAULT_SERVER_URL = "https://ntfy.sh";

ui/src/lib/tauri.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
import { isTauri as isTauriCore } from "@tauri-apps/api/core";
12-
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
1312
import {
1413
disable as autostartDisable,
1514
enable as autostartEnable,
@@ -242,25 +241,6 @@ export const syncApi = {
242241
unwrap(await commands.syncSubscriptions(serverUrl)),
243242
};
244243

245-
// ===== Event Listeners =====
246-
247-
export const events = {
248-
onNewNotification: (
249-
callback: (notification: Notification) => void,
250-
): Promise<UnlistenFn> =>
251-
listen<Notification>("notification:new", (event) =>
252-
callback(event.payload),
253-
),
254-
255-
onSubscriptionsSynced: (callback: () => void): Promise<UnlistenFn> =>
256-
listen<void>("subscriptions:synced", () => callback()),
257-
258-
onNavigateSubscription: (
259-
callback: (subscriptionId: string) => void,
260-
): Promise<UnlistenFn> =>
261-
listen<string>("navigate:subscription", (event) => callback(event.payload)),
262-
};
263-
264244
// ===== Autostart API =====
265245

266246
export const autostartApi = {

ui/src/themes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ export interface ThemeDefinition {
4343
}
4444

4545
// All themes array
46-
export { getDarkThemes, getLightThemes, getThemeById, themes } from "./presets";
46+
export { getThemeById, themes } from "./presets";

ui/src/themes/presets/index.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,3 @@ const themeMap = new Map<string, ThemeDefinition>(
5353
export function getThemeById(id: string): ThemeDefinition | undefined {
5454
return themeMap.get(id);
5555
}
56-
57-
/**
58-
* Get all light themes (for system preference matching)
59-
*/
60-
export function getLightThemes(): ThemeDefinition[] {
61-
return themes.filter((theme) => !theme.isDark);
62-
}
63-
64-
/**
65-
* Get all dark themes (for system preference matching)
66-
*/
67-
export function getDarkThemes(): ThemeDefinition[] {
68-
return themes.filter((theme) => theme.isDark);
69-
}

ui/src/themes/systemPreference.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,3 @@ export function getSystemPreference(): "light" | "dark" {
77
? "dark"
88
: "light";
99
}
10-
11-
/**
12-
* Subscribe to system color scheme changes
13-
*/
14-
export function onSystemPreferenceChange(
15-
callback: (preference: "light" | "dark") => void,
16-
): () => void {
17-
if (typeof window === "undefined") return () => {};
18-
19-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
20-
const handler = (event: MediaQueryListEvent) => {
21-
callback(event.matches ? "dark" : "light");
22-
};
23-
24-
mediaQuery.addEventListener("change", handler);
25-
return () => mediaQuery.removeEventListener("change", handler);
26-
}

0 commit comments

Comments
 (0)