chore: clean up project configuration and remove unused dependencies
- Updated knip.json to exclude unused Remotion paths and dependencies. - Cleaned up pnpm-lock.yaml by removing obsolete Remotion packages. - Refactored TypeScript function signatures in main files for improved clarity. - Enhanced various components for better code readability and maintainability.
This commit is contained in:
parent
aacadf1a2d
commit
da1a8998fc
11 changed files with 46 additions and 1425 deletions
|
|
@ -6,11 +6,9 @@
|
|||
"src/preload/index.ts",
|
||||
"src/renderer/main.tsx",
|
||||
"electron.vite.config.ts",
|
||||
"vite.standalone.config.ts",
|
||||
"remotion/index.ts",
|
||||
"remotion/**/*.{ts,tsx}"
|
||||
"vite.standalone.config.ts"
|
||||
],
|
||||
"project": ["src/**/*.{ts,tsx}!", "remotion/**/*.{ts,tsx}!"],
|
||||
"project": ["src/**/*.{ts,tsx}!"],
|
||||
"ignore": ["tsconfig*.json"],
|
||||
"paths": {
|
||||
"@main/*": ["./src/main/*"],
|
||||
|
|
@ -18,6 +16,5 @@
|
|||
"@preload/*": ["./src/preload/*"],
|
||||
"@shared/*": ["./src/shared/*"]
|
||||
},
|
||||
"ignoreDependencies": ["@remotion/light-leaks", "remotion"],
|
||||
"ignoreBinaries": ["pkg"]
|
||||
}
|
||||
|
|
|
|||
1393
pnpm-lock.yaml
1393
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -116,7 +116,7 @@ function wireFileWatcherEvents(context: ServiceContext): void {
|
|||
}
|
||||
|
||||
// Wire file-change events to renderer and HTTP SSE
|
||||
const fileChangeHandler = (event: unknown) => {
|
||||
const fileChangeHandler = (event: unknown): void => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send('file-change', event);
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ function wireFileWatcherEvents(context: ServiceContext): void {
|
|||
fileChangeCleanup = () => context.fileWatcher.off('file-change', fileChangeHandler);
|
||||
|
||||
// Forward checklist-change events to renderer and HTTP SSE (mirrors file-change pattern above)
|
||||
const todoChangeHandler = (event: unknown) => {
|
||||
const todoChangeHandler = (event: unknown): void => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send('todo-change', event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ export class HttpServer {
|
|||
await this.app.register(cors, { origin: origins, credentials: true });
|
||||
} else {
|
||||
// Default: allow all localhost origins
|
||||
// eslint-disable-next-line security/detect-unsafe-regex -- anchored, no backtracking risk
|
||||
const localhostPattern = /^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/;
|
||||
await this.app.register(cors, {
|
||||
origin: (origin, cb) => {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ import {
|
|||
getTodosBasePath,
|
||||
setClaudeBasePathOverride,
|
||||
} from './utils/pathDecoder';
|
||||
import {
|
||||
LocalFileSystemProvider,
|
||||
NotificationManager,
|
||||
ServiceContext,
|
||||
} from './services';
|
||||
import { LocalFileSystemProvider, NotificationManager, ServiceContext } from './services';
|
||||
|
||||
import type { HttpServices } from './http';
|
||||
import type { SshConnectionManager } from './services/infrastructure/SshConnectionManager';
|
||||
|
|
@ -59,7 +55,12 @@ const updaterServiceStub = {
|
|||
|
||||
/** No-op SshConnectionManager stub — SSH is managed per-user in the Electron app. */
|
||||
const sshConnectionManagerStub = {
|
||||
getStatus: () => ({ state: 'disconnected' as const, host: null, error: null, remoteProjectsPath: null }),
|
||||
getStatus: () => ({
|
||||
state: 'disconnected' as const,
|
||||
host: null,
|
||||
error: null,
|
||||
remoteProjectsPath: null,
|
||||
}),
|
||||
getProvider: () => new LocalFileSystemProvider(),
|
||||
isRemote: () => false,
|
||||
connect: async () => {},
|
||||
|
|
@ -148,7 +149,7 @@ async function start(): Promise<void> {
|
|||
};
|
||||
|
||||
// No-op mode switch handler (no SSH in standalone)
|
||||
const modeSwitchHandler = async () => {};
|
||||
const modeSwitchHandler = async (): Promise<void> => {};
|
||||
|
||||
// Start the server
|
||||
const port = await httpServer.start(services, modeSwitchHandler, PORT, HOST);
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ export const RankedInjectionList = ({
|
|||
</button>
|
||||
{/* Copy path button for CLAUDE.md and File items */}
|
||||
{copyPath && (
|
||||
<span className="shrink-0" onClick={(e) => e.stopPropagation()}>
|
||||
<span className="shrink-0">
|
||||
<CopyButton text={copyPath} inline />
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ let globalResolver: ConfirmResolver = null;
|
|||
* Usage:
|
||||
* const confirmed = await confirm({ title: 'Delete?', message: 'This cannot be undone.' });
|
||||
*/
|
||||
// eslint-disable-next-line react-refresh/only-export-components -- imperative API shares singleton state with component
|
||||
export async function confirm(opts: {
|
||||
title: string;
|
||||
message: string;
|
||||
|
|
|
|||
|
|
@ -33,14 +33,20 @@ export const UpdateBanner = (): React.JSX.Element | null => {
|
|||
>
|
||||
{isDownloading ? (
|
||||
<div className="pr-8">
|
||||
<div className="mb-1.5 flex items-center gap-2 text-xs" style={{ color: 'var(--color-text-secondary)' }}>
|
||||
<div
|
||||
className="mb-1.5 flex items-center gap-2 text-xs"
|
||||
style={{ color: 'var(--color-text-secondary)' }}
|
||||
>
|
||||
<Loader2 className="size-3.5 shrink-0 animate-spin text-blue-400" />
|
||||
<span>Updating app</span>
|
||||
<span className="tabular-nums" style={{ color: 'var(--color-text-muted)' }}>
|
||||
{clampedPercent}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-1 w-full overflow-hidden rounded-full" style={{ backgroundColor: 'var(--color-border)' }}>
|
||||
<div
|
||||
className="h-1 w-full overflow-hidden rounded-full"
|
||||
style={{ backgroundColor: 'var(--color-border)' }}
|
||||
>
|
||||
<div
|
||||
className="h-full rounded-full bg-blue-500 transition-all duration-300 ease-out"
|
||||
style={{ width: `${clampedPercent}%` }}
|
||||
|
|
@ -74,7 +80,7 @@ export const UpdateBanner = (): React.JSX.Element | null => {
|
|||
{/* Dismiss */}
|
||||
<button
|
||||
onClick={dismissUpdateBanner}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 shrink-0 rounded p-0.5 transition-colors hover:bg-white/10"
|
||||
className="absolute right-3 top-1/2 shrink-0 -translate-y-1/2 rounded p-0.5 transition-colors hover:bg-white/10"
|
||||
style={{ color: 'var(--color-text-muted)' }}
|
||||
>
|
||||
<X className="size-3.5" />
|
||||
|
|
|
|||
|
|
@ -333,9 +333,7 @@ export const SidebarHeader = (): React.JSX.Element => {
|
|||
style={
|
||||
{
|
||||
height: `${HEADER_ROW1_HEIGHT}px`,
|
||||
paddingLeft: isMacElectron
|
||||
? 'var(--macos-traffic-light-padding-left, 72px)'
|
||||
: '16px',
|
||||
paddingLeft: isMacElectron ? 'var(--macos-traffic-light-padding-left, 72px)' : '16px',
|
||||
WebkitAppRegion: isMacElectron ? 'drag' : undefined,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,21 +61,14 @@ const ConsumptionBadge = ({
|
|||
contextConsumption: number;
|
||||
phaseBreakdown?: PhaseTokenBreakdown[];
|
||||
}>): React.JSX.Element => {
|
||||
const [showPopover, setShowPopover] = useState(false);
|
||||
const [popoverPosition, setPopoverPosition] = useState<{
|
||||
top: number;
|
||||
left: number;
|
||||
} | null>(null);
|
||||
const badgeRef = useRef<HTMLSpanElement>(null);
|
||||
const isHigh = contextConsumption > 150_000;
|
||||
|
||||
// Calculate popover position relative to viewport for portal rendering
|
||||
const popoverPosition =
|
||||
showPopover && badgeRef.current
|
||||
? (() => {
|
||||
const rect = badgeRef.current.getBoundingClientRect();
|
||||
return {
|
||||
top: rect.top - 6,
|
||||
left: rect.left + rect.width / 2,
|
||||
};
|
||||
})()
|
||||
: null;
|
||||
const showPopover = popoverPosition !== null;
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- tooltip trigger via hover, not interactive
|
||||
|
|
@ -83,8 +76,16 @@ const ConsumptionBadge = ({
|
|||
ref={badgeRef}
|
||||
className="tabular-nums"
|
||||
style={{ color: isHigh ? 'rgb(251, 191, 36)' : undefined }}
|
||||
onMouseEnter={() => setShowPopover(true)}
|
||||
onMouseLeave={() => setShowPopover(false)}
|
||||
onMouseEnter={() => {
|
||||
const rect = badgeRef.current?.getBoundingClientRect();
|
||||
if (rect) {
|
||||
setPopoverPosition({
|
||||
top: rect.top - 6,
|
||||
left: rect.left + rect.width / 2,
|
||||
});
|
||||
}
|
||||
}}
|
||||
onMouseLeave={() => setPopoverPosition(null)}
|
||||
>
|
||||
{formatTokensCompact(contextConsumption)}
|
||||
{showPopover &&
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ export function initializeNotificationListeners(): () => void {
|
|||
(eventProjectBaseId == null || selectedProjectBaseId === eventProjectBaseId);
|
||||
const isTopLevelSessionEvent = !event.isSubagent;
|
||||
const isUnknownSessionInSidebar =
|
||||
event.sessionId == null || !state.sessions.some((session) => session.id === event.sessionId);
|
||||
event.sessionId == null ||
|
||||
!state.sessions.some((session) => session.id === event.sessionId);
|
||||
const shouldRefreshForPotentialNewSession =
|
||||
isTopLevelSessionEvent &&
|
||||
matchesSelectedProject &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue