Skip to content

Commit eecfd5d

Browse files
echobtfactorydroid
andauthored
fix(gui): resolve TypeScript errors in Git components (#314)
- AddWorktreeDialog: Remove unused onMount import, prefix loadingBranches with _ - GitLFSManager: Remove unused createEffect, Modal imports; fix tokens.colors.surface.default to .base; fix Tabs API (use id prop, activeTab instead of value); fix ProgressBar variant - LFSFileIndicator: Remove unused Show import; fix SimpleTooltip prop (content -> text) - LFSTrackDialog: Remove unused onMount import - TagManager: Wrap Icon with span for title attribute - WorktreeManager: Remove unused gitBranches, GitBranch, getProjectPath, ListItem imports; fix typography.fontFamily.code to .mono; wrap Text with span for title; prefix _getParentPath; wrap Icon with span for title These changes address TS2322, TS2339, and TS6133 errors in the Git-related UI components. Co-authored-by: Droid Agent <droid@factory.ai>
1 parent 888813d commit eecfd5d

File tree

6 files changed

+52
-48
lines changed

6 files changed

+52
-48
lines changed

cortex-gui/src/components/git/AddWorktreeDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* - Remote branch tracking
99
*/
1010

11-
import { createSignal, Show, For, createEffect, onMount } from "solid-js";
11+
import { createSignal, Show, For, createEffect } from "solid-js";
1212
import { Icon } from "../ui/Icon";
1313
import {
1414
gitBranches,
@@ -54,7 +54,7 @@ export function AddWorktreeDialog(props: AddWorktreeDialogProps) {
5454
// UI state
5555
const [branches, setBranches] = createSignal<GitBranch[]>([]);
5656
const [branchSearch, setBranchSearch] = createSignal("");
57-
const [loadingBranches, setLoadingBranches] = createSignal(false);
57+
const [_loadingBranches, setLoadingBranches] = createSignal(false);
5858
const [showBranchList, setShowBranchList] = createSignal(false);
5959

6060
// Validation state

cortex-gui/src/components/git/GitLFSManager.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* - File locking support
1010
*/
1111

12-
import { createSignal, createEffect, For, Show, createMemo, onMount, onCleanup } from "solid-js";
12+
import { createSignal, For, Show, createMemo, onMount, onCleanup } from "solid-js";
1313
import { Icon } from "../ui/Icon";
1414
import { invoke } from "@tauri-apps/api/core";
1515
import {
@@ -19,7 +19,6 @@ import {
1919
Badge,
2020
Text,
2121
ListItem,
22-
Modal,
2322
ProgressBar,
2423
EmptyState,
2524
Tabs,
@@ -159,7 +158,8 @@ async function unlockFile(repoPath: string, filePath: string, force: boolean = f
159158
return invoke("git_lfs_unlock", { path: repoPath, filePath, force });
160159
}
161160

162-
async function getLFSLocks(repoPath: string): Promise<LFSLock[]> {
161+
// Prepared for locks feature (future use)
162+
async function _getLFSLocks(repoPath: string): Promise<LFSLock[]> {
163163
return invoke("git_lfs_locks", { path: repoPath });
164164
}
165165

@@ -610,7 +610,7 @@ export function GitLFSManager(props: GitLFSManagerProps) {
610610
display: "flex",
611611
"flex-direction": "column",
612612
height: "100%",
613-
background: tokens.colors.surface.default,
613+
background: tokens.colors.surface.base,
614614
}}
615615
>
616616
{/* Header */}
@@ -698,7 +698,7 @@ export function GitLFSManager(props: GitLFSManagerProps) {
698698
<Show when={storagePercentage() !== null}>
699699
<ProgressBar
700700
value={storagePercentage()!}
701-
variant={storagePercentage()! > 90 ? "error" : storagePercentage()! > 75 ? "warning" : "default"}
701+
variant={storagePercentage()! > 90 ? "error" : storagePercentage()! > 75 ? "primary" : "default"}
702702
size="sm"
703703
/>
704704
</Show>
@@ -759,35 +759,35 @@ export function GitLFSManager(props: GitLFSManagerProps) {
759759
</div>
760760

761761
{/* Tabs */}
762-
<Tabs value={activeTab()} onChange={setActiveTab}>
762+
<Tabs activeTab={activeTab()} onChange={setActiveTab}>
763763
<TabList>
764-
<Tab value="files">
764+
<Tab id="files">
765765
Files
766766
<Show when={pointerFileCount() > 0}>
767767
<Badge variant="warning" size="sm" style={{ "margin-left": "6px" }}>
768768
{pointerFileCount()}
769769
</Badge>
770770
</Show>
771771
</Tab>
772-
<Tab value="patterns">
772+
<Tab id="patterns">
773773
Patterns
774774
<Badge variant="default" size="sm" style={{ "margin-left": "6px" }}>
775775
{status()?.trackedPatterns.length || 0}
776776
</Badge>
777777
</Tab>
778-
<Tab value="locks">
778+
<Tab id="locks">
779779
Locks
780780
<Show when={(status()?.locks.length || 0) > 0}>
781781
<Badge variant="warning" size="sm" style={{ "margin-left": "6px" }}>
782782
{status()?.locks.length}
783783
</Badge>
784784
</Show>
785785
</Tab>
786-
<Tab value="storage">Storage</Tab>
786+
<Tab id="storage">Storage</Tab>
787787
</TabList>
788788

789789
{/* Files Tab */}
790-
<TabPanel value="files">
790+
<TabPanel id="files">
791791
<div style={{ height: "100%", "overflow-y": "auto" }}>
792792
{/* Search */}
793793
<div style={{ padding: "8px 16px" }}>
@@ -897,7 +897,7 @@ export function GitLFSManager(props: GitLFSManagerProps) {
897897
</TabPanel>
898898

899899
{/* Patterns Tab */}
900-
<TabPanel value="patterns">
900+
<TabPanel id="patterns">
901901
<div style={{ height: "100%", "overflow-y": "auto" }}>
902902
<Show
903903
when={(status()?.trackedPatterns.length || 0) > 0}
@@ -949,7 +949,7 @@ export function GitLFSManager(props: GitLFSManagerProps) {
949949
</TabPanel>
950950

951951
{/* Locks Tab */}
952-
<TabPanel value="locks">
952+
<TabPanel id="locks">
953953
<div style={{ height: "100%", "overflow-y": "auto" }}>
954954
<Show
955955
when={(status()?.locks.length || 0) > 0}
@@ -1002,7 +1002,7 @@ export function GitLFSManager(props: GitLFSManagerProps) {
10021002
</TabPanel>
10031003

10041004
{/* Storage Tab */}
1005-
<TabPanel value="storage">
1005+
<TabPanel id="storage">
10061006
<div style={{ padding: "16px" }}>
10071007
<Show
10081008
when={status()?.storage}

cortex-gui/src/components/git/LFSFileIndicator.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* - Lock icon: File is locked
99
*/
1010

11-
import { createSignal, createEffect, Show, createMemo } from "solid-js";
11+
import { createSignal, createEffect, createMemo } from "solid-js";
1212
import { Icon } from '../ui/Icon';
1313
import { invoke } from "@tauri-apps/api/core";
1414
import { SimpleTooltip } from "@/components/ui";
@@ -267,7 +267,7 @@ export function LFSFileIndicator(props: LFSFileIndicatorProps) {
267267
// Wrap with tooltip if enabled
268268
if (props.showTooltip !== false && status() !== "not-tracked") {
269269
return (
270-
<SimpleTooltip content={getTooltipText()}>
270+
<SimpleTooltip text={getTooltipText()}>
271271
{indicator}
272272
</SimpleTooltip>
273273
);
@@ -338,7 +338,7 @@ export function LFSDirectoryIndicator(props: LFSDirectoryIndicatorProps) {
338338
// Show warning if there are pointer files
339339
if (s.pointerFiles > 0) {
340340
return (
341-
<SimpleTooltip content={`${s.pointerFiles} LFS files not fetched`}>
341+
<SimpleTooltip text={`${s.pointerFiles} LFS files not fetched`}>
342342
<span style={{ display: "inline-flex", "align-items": "center" }}>
343343
<Icon
344344
name="download"
@@ -356,7 +356,7 @@ export function LFSDirectoryIndicator(props: LFSDirectoryIndicatorProps) {
356356
// Show lock icon if there are locked files
357357
if (s.lockedFiles > 0) {
358358
return (
359-
<SimpleTooltip content={`${s.lockedFiles} locked files`}>
359+
<SimpleTooltip text={`${s.lockedFiles} locked files`}>
360360
<span style={{ display: "inline-flex", "align-items": "center" }}>
361361
<Icon
362362
name="lock"
@@ -373,7 +373,7 @@ export function LFSDirectoryIndicator(props: LFSDirectoryIndicatorProps) {
373373

374374
// Show cloud icon for fully synced LFS directory
375375
return (
376-
<SimpleTooltip content={`${s.totalFiles} LFS files`}>
376+
<SimpleTooltip text={`${s.totalFiles} LFS files`}>
377377
<span style={{ display: "inline-flex", "align-items": "center" }}>
378378
<Icon
379379
name="cloud"

cortex-gui/src/components/git/LFSTrackDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* - Common patterns quick-select
99
*/
1010

11-
import { createSignal, createEffect, For, Show, createMemo, onMount } from "solid-js";
11+
import { createSignal, createEffect, For, Show, createMemo } from "solid-js";
1212
import { Icon } from '../ui/Icon';
1313
import { invoke } from "@tauri-apps/api/core";
1414
import {

cortex-gui/src/components/git/TagManager.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,14 @@ export function TagManager(props: TagManagerProps) {
340340
</span>
341341
</Show>
342342
<Show when={tag().isPushed}>
343-
<Icon name="cloud" style={{ width: "12px", height: "12px", color: tokens.colors.semantic.success }} title="Pushed to remote" />
343+
<span title="Pushed to remote">
344+
<Icon name="cloud" style={{ width: "12px", height: "12px", color: tokens.colors.semantic.success }} />
345+
</span>
344346
</Show>
345347
<Show when={!tag().isPushed}>
346-
<Icon name="cloud-slash" style={{ width: "12px", height: "12px", color: tokens.colors.text.muted }} title="Local only" />
348+
<span title="Local only">
349+
<Icon name="cloud-slash" style={{ width: "12px", height: "12px", color: tokens.colors.text.muted }} />
350+
</span>
347351
</Show>
348352
</div>
349353
}

cortex-gui/src/components/git/WorktreeManager.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,14 @@ import {
1818
gitWorktreeRepair,
1919
gitWorktreePrune,
2020
gitStatus,
21-
gitBranches,
2221
type GitWorktree,
23-
type GitBranch,
2422
} from "../../utils/tauri-api";
25-
import { getProjectPath } from "../../utils/workspace";
2623
import {
2724
Button,
2825
IconButton,
2926
Input,
3027
Badge,
3128
Text,
32-
ListItem,
3329
Modal,
3430
} from "@/components/ui";
3531
import { tokens } from "@/design-system/tokens";
@@ -244,7 +240,8 @@ export function WorktreeManager(props: WorktreeManagerProps) {
244240
return parts[parts.length - 1];
245241
};
246242

247-
const getParentPath = (path: string): string => {
243+
// Helper for potential future use (e.g., path navigation)
244+
const _getParentPath = (path: string): string => {
248245
const parts = path.split(/[/\\]/);
249246
if (parts.length <= 1) return "";
250247
return parts.slice(0, -1).join("/");
@@ -498,7 +495,9 @@ export function WorktreeManager(props: WorktreeManagerProps) {
498495
</Show>
499496

500497
<Show when={worktree.isLocked}>
501-
<Icon name="lock" size={12} style={{ color: tokens.colors.semantic.warning }} title="Locked" />
498+
<span title="Locked">
499+
<Icon name="lock" size={12} style={{ color: tokens.colors.semantic.warning }} />
500+
</span>
502501
</Show>
503502

504503
<Show when={isDirty()}>
@@ -529,25 +528,26 @@ export function WorktreeManager(props: WorktreeManagerProps) {
529528
detached HEAD
530529
</Text>
531530
</Show>
532-
<Text style={{ "font-size": "10px", "font-family": tokens.typography.fontFamily.code, color: tokens.colors.text.muted }}>
531+
<Text style={{ "font-size": "10px", "font-family": tokens.typography.fontFamily.mono, color: tokens.colors.text.muted }}>
533532
{worktree.commit.substring(0, 7)}
534533
</Text>
535534
</div>
536535

537536
{/* Path */}
538-
<Text
539-
style={{
540-
"font-size": "10px",
541-
color: tokens.colors.text.muted,
542-
overflow: "hidden",
543-
"text-overflow": "ellipsis",
544-
"white-space": "nowrap",
545-
"margin-top": "2px",
546-
}}
547-
title={worktree.path}
548-
>
549-
{worktree.path}
550-
</Text>
537+
<span title={worktree.path}>
538+
<Text
539+
style={{
540+
"font-size": "10px",
541+
color: tokens.colors.text.muted,
542+
overflow: "hidden",
543+
"text-overflow": "ellipsis",
544+
"white-space": "nowrap",
545+
"margin-top": "2px",
546+
}}
547+
>
548+
{worktree.path}
549+
</Text>
550+
</span>
551551
</div>
552552

553553
{/* Quick actions */}
@@ -625,7 +625,7 @@ export function WorktreeManager(props: WorktreeManagerProps) {
625625
<Text style={{ "font-size": "10px", "font-weight": "600", "text-transform": "uppercase", "letter-spacing": "0.5px", color: tokens.colors.text.muted, "margin-bottom": tokens.spacing.xs }}>
626626
Path
627627
</Text>
628-
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.code, color: tokens.colors.text.primary, "word-break": "break-all" }}>
628+
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.mono, color: tokens.colors.text.primary, "word-break": "break-all" }}>
629629
{worktree.path}
630630
</Text>
631631
</div>
@@ -645,7 +645,7 @@ export function WorktreeManager(props: WorktreeManagerProps) {
645645
<Text style={{ "font-size": "10px", "font-weight": "600", "text-transform": "uppercase", "letter-spacing": "0.5px", color: tokens.colors.text.muted, "margin-bottom": tokens.spacing.xs }}>
646646
HEAD Commit
647647
</Text>
648-
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.code, color: tokens.colors.text.primary }}>
648+
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.mono, color: tokens.colors.text.primary }}>
649649
{worktree.commit}
650650
</Text>
651651
</div>
@@ -794,7 +794,7 @@ export function WorktreeManager(props: WorktreeManagerProps) {
794794
<Text style={{ "font-size": "12px", "font-weight": "500", color: tokens.colors.text.primary }}>
795795
{getWorktreeName(confirmRemove()!.path)}
796796
</Text>
797-
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.code, color: tokens.colors.text.muted, "margin-top": tokens.spacing.xs }}>
797+
<Text style={{ "font-size": "11px", "font-family": tokens.typography.fontFamily.mono, color: tokens.colors.text.muted, "margin-top": tokens.spacing.xs }}>
798798
{confirmRemove()!.path}
799799
</Text>
800800
</div>
@@ -857,7 +857,7 @@ export function WorktreeManager(props: WorktreeManagerProps) {
857857
<Text style={{ "font-size": "12px", "font-weight": "500", color: tokens.colors.text.muted, "margin-bottom": tokens.spacing.sm }}>
858858
Current Location
859859
</Text>
860-
<Text style={{ "font-size": "12px", "font-family": tokens.typography.fontFamily.code, color: tokens.colors.text.primary }}>
860+
<Text style={{ "font-size": "12px", "font-family": tokens.typography.fontFamily.mono, color: tokens.colors.text.primary }}>
861861
{showMoveDialog()!.path}
862862
</Text>
863863
</div>

0 commit comments

Comments
 (0)