refactor: update UI components and styles for improved consistency and functionality

- Refactored Skeleton component to include data-slot attribute and updated class names.
- Enhanced Switch component with size prop and improved styling.
- Updated Tooltip components to include data-slot attributes and improved styling.
- Refactored global CSS to use custom properties for theming and improved dark mode support.
- Added useIsMobile hook for responsive design handling.
- Updated IPC link implementation for tRPC in Electron.
- Adjusted ProjectsPage layout for better responsiveness.
- Removed outdated Tailwind configuration file and integrated Tailwind CSS with Vite.
This commit is contained in:
Roberto Musso
2026-02-20 00:45:22 +01:00
parent 4180c3d215
commit 99140c2c48
32 changed files with 6390 additions and 1934 deletions

View File

@@ -0,0 +1,76 @@
/**
* Renderer-side tRPC IPC link for Electron.
*
* Replaces electron-trpc's ipcLink with a custom implementation that
* works with our custom IPC handler + tRPC v11.
*/
import { observable } from '@trpc/server/observable';
import type { TRPCLink } from '@trpc/client';
import type { AnyRouter } from '@trpc/server';
interface ElectronTRPC {
sendMessage: (msg: unknown) => void;
onMessage: (cb: (data: unknown) => void) => (() => void) | void;
}
declare global {
interface Window {
electronTRPC: ElectronTRPC;
}
}
type TRPCResponse = {
id: number | null;
result?: { type: string; data?: unknown };
error?: unknown;
};
let nextId = 0;
export function ipcLink<TRouter extends AnyRouter>(): TRPCLink<TRouter> {
return () =>
({ op }) =>
observable((observer) => {
const id = ++nextId;
const { electronTRPC } = window;
if (!electronTRPC) {
observer.error(
new Error(
'Could not find `electronTRPC` global. ' +
'Check that the preload script has been loaded.',
) as any, // eslint-disable-line @typescript-eslint/no-explicit-any
);
return;
}
const unsubscribe = electronTRPC.onMessage((response: unknown) => {
const msg = response as TRPCResponse;
if (msg.id !== id) return;
if ('error' in msg) {
observer.error(msg.error as any); // eslint-disable-line @typescript-eslint/no-explicit-any
return;
}
observer.next({
result: msg.result as { type: 'data'; data: unknown },
});
observer.complete();
});
electronTRPC.sendMessage({
method: 'request',
operation: {
id,
type: op.type,
path: op.path,
input: op.input,
},
});
return () => {
if (typeof unsubscribe === 'function') unsubscribe();
};
});
}