@vibe-forge/client 0.11.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +6 -11
- package/dist/assets/{arc-De_WjPJ3.js → arc-CbOXL0l9.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-C4aR2zTE.js → blockDiagram-c4efeb88-CqxINvsS.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-BZH3rq_m.js → c4Diagram-c83219d4-BKazU0hb.js} +1 -1
- package/dist/assets/channel-Dnopc5A6.js +1 -0
- package/dist/assets/{classDiagram-beda092f-BzJgBrIK.js → classDiagram-beda092f-fAFX5BpB.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-5ZtXcnT3.js → classDiagram-v2-2358418a-w1VkNGJj.js} +1 -1
- package/dist/assets/clone-sQthahUA.js +1 -0
- package/dist/assets/{createText-1719965b-DUVvEtmR.js → createText-1719965b-CEinakVP.js} +1 -1
- package/dist/assets/{cssMode-GoTNjuXX.js → cssMode-DPqRki4y.js} +1 -1
- package/dist/assets/{edges-96097737-Dd7m4Cvs.js → edges-96097737-Cb0F1_3K.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-DxqFlG_f.js → erDiagram-0228fc6a-C-N2fx-J.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-DU0C5kCI.js → flowDb-c6c81e3f-D1Xz_8Gf.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-Di1uDa_X.js → flowDiagram-50d868cf-DyPSZyAj.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-OazrdWQO.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-CwG8aty5.js → flowchart-elk-definition-6af322e1-Dr1DDXwE.js} +1 -1
- package/dist/assets/{freemarker2-j39cqTlI.js → freemarker2-C3DvPFaK.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-baO_lzL-.js → ganttDiagram-a2739b55-DmvY1GRj.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-COoHjYMf.js → gitGraphDiagram-82fe8481-CoXfPYYi.js} +1 -1
- package/dist/assets/{graph-KxESr4M5.js → graph-BkDQy7Qt.js} +1 -1
- package/dist/assets/{handlebars-BgjdZO8G.js → handlebars-BcTFdqjl.js} +1 -1
- package/dist/assets/{html-Ba7tYObe.js → html-Dg-O6XFr.js} +1 -1
- package/dist/assets/{htmlMode-Bztvbig1.js → htmlMode-B_wqYWvn.js} +1 -1
- package/dist/assets/{index-5325376f-BMTAx2mL.js → index-5325376f-kxPTR3_e.js} +1 -1
- package/dist/assets/index-o93dlo92.css +32 -0
- package/dist/assets/{index-Pm_kLJvG.js → index-wkhI4dr6.js} +350 -329
- package/dist/assets/{infoDiagram-8eee0895-CC74qbHY.js → infoDiagram-8eee0895-BEvqkwPI.js} +1 -1
- package/dist/assets/{javascript-C1e1cllX.js → javascript-DhlOH8_z.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-C4MyOdE6.js → journeyDiagram-c64418c1-gKtLYmmp.js} +1 -1
- package/dist/assets/{jsonMode-BC98AlvF.js → jsonMode-DxTbF9OD.js} +1 -1
- package/dist/assets/{layout-CxAyTlr7.js → layout-CDaZEk6E.js} +1 -1
- package/dist/assets/{line-DhaUfI71.js → line-DNRQu8iq.js} +1 -1
- package/dist/assets/{linear-MYukzldK.js → linear-Cph9Z6_j.js} +1 -1
- package/dist/assets/{liquid-DahfJEYl.js → liquid-ByZ6JgRG.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-BWDJcswW.js → lspLanguageFeatures-DzvhkgnM.js} +1 -1
- package/dist/assets/{mdx-BELlF_FD.js → mdx-D8RGHTl6.js} +1 -1
- package/dist/assets/{mermaid.core-BrQnSGSY.js → mermaid.core-BgcryF__.js} +4 -4
- package/dist/assets/{mindmap-definition-8da855dc-B0FoxTiy.js → mindmap-definition-8da855dc-WrxK0FcB.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-Ddr2cjSL.js → pieDiagram-a8764435-VsZBsiQy.js} +1 -1
- package/dist/assets/{python--C9if_AD.js → python-CXVtk_cg.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-BlEs7Mrl.js → quadrantDiagram-1e28029f-BVlgwOvU.js} +1 -1
- package/dist/assets/{razor-B9U9JxKn.js → razor-0tind7h2.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-kEFOAu2v.js → requirementDiagram-08caed73-CpPMPoYp.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-BBghez8I.js → sankeyDiagram-a04cb91d-Cm5nnRmc.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-CJqgzdUE.js → sequenceDiagram-c5b8d532-DpMlJvJB.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-BER4XEI6.js → stateDiagram-1ecb1508-DU1zc7vq.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-EBV2vSks.js → stateDiagram-v2-c2b004d7-D-0RgmAp.js} +1 -1
- package/dist/assets/{styles-b4e223ce-k0eswZsE.js → styles-b4e223ce-BSO-yNWV.js} +1 -1
- package/dist/assets/{styles-ca3715f6-Ckr7GA-0.js → styles-ca3715f6-CHnsn2Ro.js} +1 -1
- package/dist/assets/{styles-d45a18b0-C1bpSwV3.js → styles-d45a18b0-B-rVGjEq.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-CDtKpGvy.js → svgDrawCommon-b86b1483-CA3Pl89f.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-BeGR-vua.js → timeline-definition-faaaa080-BcihLR6s.js} +1 -1
- package/dist/assets/{tsMode-D_gJXIy3.js → tsMode-D9GGa5Ur.js} +1 -1
- package/dist/assets/{typescript-BoKcNXkN.js → typescript-BT9CK_EL.js} +1 -1
- package/dist/assets/{xml-DZvURlJ-.js → xml-DNO75J-T.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-DxfeLuYV.js → xychartDiagram-f5964ef8-DJTwe32X.js} +1 -1
- package/dist/assets/{yaml-CTC8PAGY.js → yaml-7CVzhiP2.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +13 -10
- package/src/api/git.ts +12 -0
- package/src/api/sessions.ts +131 -4
- package/src/api/types.ts +2 -1
- package/src/api.ts +13 -0
- package/src/components/ArchiveView.scss +143 -54
- package/src/components/ArchiveView.tsx +181 -167
- package/src/components/CodeBlock.scss +5 -0
- package/src/components/ConfigView.scss +142 -31
- package/src/components/ConfigView.tsx +161 -86
- package/src/components/MarkdownContent.tsx +7 -0
- package/src/components/NavRail.scss +248 -0
- package/src/components/NavRail.tsx +80 -107
- package/src/components/NavRailCompact.tsx +107 -0
- package/src/components/NavRailCompactMoreSheet.tsx +141 -0
- package/src/components/ShortcutTooltip.tsx +4 -2
- package/src/components/Sidebar.scss +51 -0
- package/src/components/Sidebar.tsx +43 -16
- package/src/components/automation-view/RuleFormPanel.scss +40 -13
- package/src/components/automation-view/RuleSidebar.scss +73 -47
- package/src/components/automation-view/RuleSidebar.tsx +9 -13
- package/src/components/automation-view/RunHistoryPanel.scss +141 -13
- package/src/components/automation-view/RunHistoryPanel.tsx +203 -161
- package/src/components/automation-view/TaskList.scss +44 -13
- package/src/components/automation-view/TriggerList.scss +46 -14
- package/src/components/automation-view/index.scss +82 -10
- package/src/components/automation-view/index.tsx +108 -55
- package/src/components/benchmark-view/BenchmarkCasePanel.scss +36 -16
- package/src/components/benchmark-view/BenchmarkSidebar.scss +44 -22
- package/src/components/benchmark-view/BenchmarkSidebar.tsx +0 -6
- package/src/components/benchmark-view/BenchmarkView.scss +63 -20
- package/src/components/benchmark-view/index.tsx +71 -34
- package/src/components/chat/AGENTS.md +14 -2
- package/src/components/chat/ChatComposerCard.scss +77 -0
- package/src/components/chat/ChatComposerCard.tsx +59 -0
- package/src/components/chat/ChatHeader.scss +187 -0
- package/src/components/chat/ChatHeader.tsx +209 -57
- package/src/components/chat/ChatHistoryView.tsx +279 -52
- package/src/components/chat/ChatTimelineView.scss +94 -1
- package/src/components/chat/ChatTimelineView.tsx +42 -0
- package/src/components/chat/CurrentTodoList.scss +210 -200
- package/src/components/chat/CurrentTodoList.tsx +116 -48
- package/src/components/chat/NewSessionGuide.scss +139 -1
- package/src/components/chat/NewSessionGuide.tsx +57 -100
- package/src/components/chat/NewSessionGuideCompactPanel.tsx +130 -0
- package/src/components/chat/NewSessionGuideGrid.tsx +141 -0
- package/src/components/chat/QueuedMessagesCard.scss +195 -0
- package/src/components/chat/QueuedMessagesCard.tsx +170 -0
- package/src/components/chat/git-controls/BranchSwitcherDropdown.tsx +61 -56
- package/src/components/chat/git-controls/BranchSwitcherResults.tsx +167 -0
- package/src/components/chat/git-controls/BranchTreeEntries.tsx +99 -0
- package/src/components/chat/git-controls/ChatGitControls.scss +437 -5
- package/src/components/chat/git-controls/ChatGitControls.tsx +136 -109
- package/src/components/chat/git-controls/DraftGitControls.tsx +91 -0
- package/src/components/chat/git-controls/GitOperationsDropdown.tsx +10 -2
- package/src/components/chat/git-controls/GitWorktreeDropdown.tsx +301 -28
- package/src/components/chat/git-controls/git-branch-tree.ts +148 -0
- package/src/components/chat/git-controls/use-chat-draft-git-controls.ts +168 -0
- package/src/components/chat/git-controls/use-chat-git-controls.ts +76 -3
- package/src/components/chat/messages/MessageContextMenu.tsx +3 -1
- package/src/components/chat/messages/MessageItem.scss +78 -4
- package/src/components/chat/messages/MessageItem.tsx +47 -3
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectControl.scss +23 -0
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsControl.scss +17 -0
- package/src/components/chat/sender/@components/reference-actions/ReferencePermissionActionsPopover.tsx +4 -1
- package/src/components/chat/sender/@components/sender-attachments/SenderAttachments.scss +167 -30
- package/src/components/chat/sender/@components/sender-attachments/SenderAttachments.tsx +95 -23
- package/src/components/chat/sender/@components/sender-body/SenderBody.tsx +10 -0
- package/src/components/chat/sender/@components/sender-interaction-panel/SenderInteractionPanel.scss +161 -45
- package/src/components/chat/sender/@components/sender-interaction-panel/SenderInteractionPanel.tsx +310 -71
- package/src/components/chat/sender/@components/sender-monaco-editor/SenderMonacoEditor.tsx +18 -0
- package/src/components/chat/sender/@components/sender-monaco-editor/use-sender-monaco-editor.ts +86 -9
- package/src/components/chat/sender/@components/sender-monaco-editor/use-sender-monaco-theme.ts +52 -3
- package/src/components/chat/sender/@components/sender-submit-action/SenderSubmitAction.scss +110 -1
- package/src/components/chat/sender/@components/sender-submit-action/SenderSubmitAction.tsx +137 -17
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectBase.scss +21 -0
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectShared.scss +21 -0
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.scss +63 -0
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.tsx +12 -6
- package/src/components/chat/sender/@core/build-sender-controller-result.ts +6 -0
- package/src/components/chat/sender/@core/build-sender-toolbar.ts +25 -2
- package/src/components/chat/sender/@core/create-sender-toolbar-handlers.ts +9 -2
- package/src/components/chat/sender/@core/get-sender-runtime-state.ts +1 -1
- package/src/components/chat/sender/@core/interaction-request.ts +2 -2
- package/src/components/chat/sender/@core/sender-toolbar-bindings.ts +28 -4
- package/src/components/chat/sender/@hooks/use-model-select-browser.tsx +4 -2
- package/src/components/chat/sender/@hooks/use-sender-controller.ts +56 -11
- package/src/components/chat/sender/@hooks/use-sender-keydown.ts +64 -0
- package/src/components/chat/sender/@hooks/use-sender-shortcuts.ts +16 -1
- package/src/components/chat/sender/@hooks/use-sender-submit.ts +16 -8
- package/src/components/chat/sender/@types/sender-props.ts +20 -3
- package/src/components/chat/sender/@types/sender-toolbar-types.ts +12 -1
- package/src/components/chat/sender/Sender.scss +4 -1
- package/src/components/chat/sender/Sender.tsx +3 -12
- package/src/components/chat/session-timeline-panel/EventList.scss +88 -0
- package/src/components/chat/session-timeline-panel/EventList.tsx +99 -47
- package/src/components/chat/session-timeline-panel/gantt.ts +23 -7
- package/src/components/chat/session-timeline-panel/git-graph.ts +6 -1
- package/src/components/chat/session-timeline-panel/index.scss +14 -1
- package/src/components/chat/session-timeline-panel/index.tsx +86 -10
- package/src/components/chat/session-timeline-panel/types.ts +4 -0
- package/src/components/chat/status-bar/ChatStatusBar.scss +27 -0
- package/src/components/chat/status-bar/ChatStatusBar.tsx +39 -0
- package/src/components/chat/terminal/ChatTerminalView.tsx +6 -0
- package/src/components/chat/tools/core/ToolCallBox.scss +19 -0
- package/src/components/chat/tools/core/ToolGroup.scss +32 -0
- package/src/components/chat/tools/task/components/TaskToolCard.scss +59 -1
- package/src/components/config/ConfigEditors.scss +20 -6
- package/src/components/config/ConfigFieldRow.scss +57 -17
- package/src/components/config/ConfigSectionForm.scss +10 -4
- package/src/components/config/ConfigSectionPanel.tsx +18 -11
- package/src/components/config/configSchema.ts +1 -0
- package/src/components/config/record-editors/RecordEditors.scss +42 -9
- package/src/components/dock-panel/DockPanel.scss +6 -2
- package/src/components/dock-panel/DockPanel.tsx +12 -16
- package/src/components/knowledge-base/KnowledgeBaseView.scss +180 -6
- package/src/components/knowledge-base/KnowledgeBaseView.tsx +98 -26
- package/src/components/knowledge-base/components/ActionButton.scss +4 -0
- package/src/components/knowledge-base/components/EmptyState.scss +5 -8
- package/src/components/knowledge-base/components/EntitiesTab.tsx +8 -2
- package/src/components/knowledge-base/components/EntityItem.scss +10 -3
- package/src/components/knowledge-base/components/FilterBar.scss +13 -2
- package/src/components/knowledge-base/components/FlowsTab.tsx +8 -2
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.scss +2 -23
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.tsx +0 -5
- package/src/components/knowledge-base/components/KnowledgeList.scss +15 -6
- package/src/components/knowledge-base/components/LoadingState.scss +4 -0
- package/src/components/knowledge-base/components/RuleItem.scss +86 -0
- package/src/components/knowledge-base/components/RuleItem.tsx +2 -0
- package/src/components/knowledge-base/components/RulesTab.tsx +8 -2
- package/src/components/knowledge-base/components/SectionHeader.scss +3 -18
- package/src/components/knowledge-base/components/SectionHeader.tsx +3 -7
- package/src/components/knowledge-base/components/SkillsTab.tsx +8 -3
- package/src/components/knowledge-base/components/SpecItem.scss +16 -7
- package/src/components/layout/@hooks/use-mobile-sidebar-modal.ts +190 -0
- package/src/components/layout/AppShell.scss +106 -6
- package/src/components/layout/AppShell.tsx +118 -10
- package/src/components/layout/PageShell.scss +41 -0
- package/src/components/layout/PageShell.tsx +32 -0
- package/src/components/layout/mobile-sidebar-constants.ts +1 -0
- package/src/components/nav-rail-compact-config.ts +114 -0
- package/src/components/nav-rail-items.tsx +181 -0
- package/src/components/sidebar/SessionContextMenu.tsx +3 -1
- package/src/components/sidebar/SessionItem.scss +62 -0
- package/src/components/sidebar/SessionItem.tsx +97 -52
- package/src/components/sidebar/SessionList.tsx +6 -0
- package/src/components/sidebar/SidebarHeader.scss +49 -0
- package/src/components/sidebar/SidebarHeader.tsx +27 -5
- package/src/components/sidebar/SidebarHeaderBatchActions.tsx +8 -4
- package/src/components/sidebar/SidebarHeaderSearchActions.tsx +6 -3
- package/src/components/sidebar/SidebarUtilityFooter.tsx +69 -0
- package/src/components/workspace/ContextFilePicker.tsx +12 -4
- package/src/hooks/chat/chat-session-workspace-draft.ts +25 -0
- package/src/hooks/chat/session-view-cache.ts +4 -1
- package/src/hooks/chat/use-chat-adapter.ts +5 -1
- package/src/hooks/chat/use-chat-model-adapter-selection.tsx +5 -1
- package/src/hooks/chat/use-chat-scroll.ts +24 -7
- package/src/hooks/chat/use-chat-session-actions.ts +118 -6
- package/src/hooks/chat/use-chat-session-messages.ts +20 -1
- package/src/hooks/chat/use-chat-session.ts +2 -0
- package/src/hooks/use-responsive-layout.ts +115 -0
- package/src/main.tsx +8 -0
- package/src/resources/adapters.ts +15 -0
- package/src/resources/locales/en.json +84 -1
- package/src/resources/locales/zh.json +84 -1
- package/src/routes/ChatRoute.scss +152 -9
- package/src/routes/ChatRoute.tsx +31 -34
- package/src/store/index.ts +2 -0
- package/dist/assets/channel-BvERb8WU.js +0 -1
- package/dist/assets/clone-B9_0v-6Y.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-LpS8Kb00.js +0 -1
- package/dist/assets/index-C1oh0w9H.css +0 -32
- package/src/components/chat/ThinkingStatus.scss +0 -70
- package/src/components/chat/ThinkingStatus.tsx +0 -13
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
.queued-messages-card {
|
|
2
|
+
&__summary {
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&__body {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__headline {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__headline-icon {
|
|
20
|
+
flex: 0 0 auto;
|
|
21
|
+
font-size: 15px;
|
|
22
|
+
color: var(--primary-color, #2563eb);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__headline-copy {
|
|
26
|
+
min-width: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: baseline;
|
|
29
|
+
gap: 6px;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__headline-title {
|
|
34
|
+
font-size: 11px;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
line-height: 1.25;
|
|
37
|
+
color: var(--text-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__headline-meta {
|
|
41
|
+
font-size: 10px;
|
|
42
|
+
line-height: 1.2;
|
|
43
|
+
color: var(--sub-text-color, #6b7280);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__list {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 4px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__item {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
gap: 8px;
|
|
57
|
+
padding: 5px 8px;
|
|
58
|
+
border: 1px solid rgba(148, 163, 184, .16);
|
|
59
|
+
border-radius: 10px;
|
|
60
|
+
background: transparent;
|
|
61
|
+
transition: background-color .18s ease, border-color .18s ease;
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
background: var(--tag-hover-bg, rgba(148, 163, 184, .08));
|
|
65
|
+
border-color: rgba(148, 163, 184, .26);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__item-main {
|
|
70
|
+
min-width: 0;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 6px;
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__drag {
|
|
78
|
+
flex: 0 0 auto;
|
|
79
|
+
color: var(--sub-text-color, #94a3b8);
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
cursor: grab;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__item-copy {
|
|
85
|
+
min-width: 0;
|
|
86
|
+
flex: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&__item-summary {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: 6px;
|
|
93
|
+
min-width: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&__flags {
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
gap: 4px;
|
|
100
|
+
flex: 0 0 auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__flag {
|
|
104
|
+
width: 18px;
|
|
105
|
+
height: 18px;
|
|
106
|
+
border-radius: 999px;
|
|
107
|
+
background: var(--tag-bg, rgba(15, 23, 42, .06));
|
|
108
|
+
color: var(--sub-text-color, #6b7280);
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
|
|
113
|
+
.material-symbols-rounded {
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
line-height: 1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__item-text {
|
|
120
|
+
display: -webkit-box;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
color: var(--text-color);
|
|
123
|
+
font-size: 12px;
|
|
124
|
+
line-height: 1.45;
|
|
125
|
+
white-space: pre-wrap;
|
|
126
|
+
word-break: break-word;
|
|
127
|
+
-webkit-box-orient: vertical;
|
|
128
|
+
-webkit-line-clamp: 3;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&__actions {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 2px;
|
|
135
|
+
flex: 0 0 auto;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&__action {
|
|
139
|
+
width: 24px;
|
|
140
|
+
height: 24px;
|
|
141
|
+
border: 0;
|
|
142
|
+
border-radius: 8px;
|
|
143
|
+
background: transparent;
|
|
144
|
+
color: var(--sub-text-color, #6b7280);
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
transition: background-color .18s ease, color .18s ease;
|
|
150
|
+
|
|
151
|
+
&:hover {
|
|
152
|
+
background: var(--tag-hover-bg, rgba(148, 163, 184, .12));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.material-symbols-rounded {
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
line-height: 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__action--edit {
|
|
162
|
+
color: var(--sub-text-color, #6b7280);
|
|
163
|
+
|
|
164
|
+
&:hover {
|
|
165
|
+
background: var(--tag-hover-bg, rgba(148, 163, 184, .12));
|
|
166
|
+
color: var(--text-color);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&__action--move {
|
|
171
|
+
color: var(--primary-color, #2563eb);
|
|
172
|
+
|
|
173
|
+
&:hover {
|
|
174
|
+
background: color-mix(
|
|
175
|
+
in srgb,
|
|
176
|
+
var(--primary-color, #2563eb) 12%,
|
|
177
|
+
transparent
|
|
178
|
+
);
|
|
179
|
+
color: color-mix(
|
|
180
|
+
in srgb,
|
|
181
|
+
var(--primary-color, #2563eb) 82%,
|
|
182
|
+
var(--text-color) 18%
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&__action--delete {
|
|
188
|
+
color: #dc2626;
|
|
189
|
+
|
|
190
|
+
&:hover {
|
|
191
|
+
background: rgba(220, 38, 38, .12);
|
|
192
|
+
color: #b91c1c;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import './QueuedMessagesCard.scss'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
|
|
6
|
+
import type { ChatMessageContent, SessionQueuedMessage, SessionQueuedMessageMode } from '@vibe-forge/core'
|
|
7
|
+
|
|
8
|
+
import { ChatComposerCard } from './ChatComposerCard'
|
|
9
|
+
|
|
10
|
+
const getSummaryText = (content: ChatMessageContent[]) => {
|
|
11
|
+
const text = content
|
|
12
|
+
.filter((item): item is Extract<ChatMessageContent, { type: 'text' }> => item.type === 'text')
|
|
13
|
+
.map(item => item.text.trim())
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join('\n')
|
|
16
|
+
|
|
17
|
+
return text
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const getContentFlags = (content: ChatMessageContent[]) => ({
|
|
21
|
+
hasImages: content.some(item => item.type === 'image'),
|
|
22
|
+
hasReferences: content.some(item => item.type === 'file')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const reorderIds = (ids: string[], draggedId: string, targetId: string) => {
|
|
26
|
+
if (draggedId === targetId) {
|
|
27
|
+
return ids
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const current = [...ids]
|
|
31
|
+
const fromIndex = current.indexOf(draggedId)
|
|
32
|
+
const toIndex = current.indexOf(targetId)
|
|
33
|
+
if (fromIndex === -1 || toIndex === -1) {
|
|
34
|
+
return ids
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
current.splice(fromIndex, 1)
|
|
38
|
+
current.splice(toIndex, 0, draggedId)
|
|
39
|
+
return current
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function QueuedMessagesCard({
|
|
43
|
+
mode,
|
|
44
|
+
items,
|
|
45
|
+
onMove,
|
|
46
|
+
onDelete,
|
|
47
|
+
onEdit,
|
|
48
|
+
onReorder
|
|
49
|
+
}: {
|
|
50
|
+
mode: SessionQueuedMessageMode
|
|
51
|
+
items: SessionQueuedMessage[]
|
|
52
|
+
onMove: (item: SessionQueuedMessage, targetMode: SessionQueuedMessageMode) => void | Promise<unknown>
|
|
53
|
+
onDelete: (item: SessionQueuedMessage) => void | Promise<unknown>
|
|
54
|
+
onEdit: (item: SessionQueuedMessage) => void | Promise<unknown>
|
|
55
|
+
onReorder: (ids: string[]) => void | Promise<unknown>
|
|
56
|
+
}) {
|
|
57
|
+
const { t } = useTranslation()
|
|
58
|
+
const [draggedId, setDraggedId] = useState<string | null>(null)
|
|
59
|
+
|
|
60
|
+
const summaryLabel = mode === 'next'
|
|
61
|
+
? t('chat.queue.nextTitle')
|
|
62
|
+
: t('chat.queue.steerTitle')
|
|
63
|
+
const summaryCount = t('chat.queue.count', { count: items.length })
|
|
64
|
+
|
|
65
|
+
if (items.length === 0) {
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const targetMode = mode === 'next' ? 'steer' : 'next'
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<ChatComposerCard
|
|
73
|
+
className='queued-messages-card'
|
|
74
|
+
summaryClassName='queued-messages-card__summary'
|
|
75
|
+
bodyClassName='queued-messages-card__body'
|
|
76
|
+
narrow
|
|
77
|
+
summary={
|
|
78
|
+
<div className='queued-messages-card__headline'>
|
|
79
|
+
<span className='material-symbols-rounded queued-messages-card__headline-icon'>
|
|
80
|
+
{mode === 'next' ? 'pending' : 'schedule'}
|
|
81
|
+
</span>
|
|
82
|
+
<div className='queued-messages-card__headline-copy'>
|
|
83
|
+
<div className='queued-messages-card__headline-title'>{summaryLabel}</div>
|
|
84
|
+
<div className='queued-messages-card__headline-meta'>{summaryCount}</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
}
|
|
88
|
+
>
|
|
89
|
+
<div className='queued-messages-card__list'>
|
|
90
|
+
{items.map((item) => {
|
|
91
|
+
const summaryText = getSummaryText(item.content)
|
|
92
|
+
const { hasImages, hasReferences } = getContentFlags(item.content)
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
key={item.id}
|
|
96
|
+
className='queued-messages-card__item'
|
|
97
|
+
draggable
|
|
98
|
+
onDragStart={() => setDraggedId(item.id)}
|
|
99
|
+
onDragEnd={() => setDraggedId(null)}
|
|
100
|
+
onDragOver={(event) => {
|
|
101
|
+
event.preventDefault()
|
|
102
|
+
}}
|
|
103
|
+
onDrop={(event) => {
|
|
104
|
+
event.preventDefault()
|
|
105
|
+
if (draggedId == null) {
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
const nextIds = reorderIds(items.map(queueItem => queueItem.id), draggedId, item.id)
|
|
109
|
+
setDraggedId(null)
|
|
110
|
+
void onReorder(nextIds)
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<div className='queued-messages-card__item-main'>
|
|
114
|
+
<span className='queued-messages-card__drag material-symbols-rounded' aria-hidden='true'>
|
|
115
|
+
drag_indicator
|
|
116
|
+
</span>
|
|
117
|
+
<div className='queued-messages-card__item-copy'>
|
|
118
|
+
<div className='queued-messages-card__item-summary'>
|
|
119
|
+
{(hasImages || hasReferences) && (
|
|
120
|
+
<div className='queued-messages-card__flags'>
|
|
121
|
+
{hasImages && (
|
|
122
|
+
<span className='queued-messages-card__flag' title={t('chat.queue.hasImage')}>
|
|
123
|
+
<span className='material-symbols-rounded'>image</span>
|
|
124
|
+
</span>
|
|
125
|
+
)}
|
|
126
|
+
{hasReferences && (
|
|
127
|
+
<span className='queued-messages-card__flag' title={t('chat.queue.hasReference')}>
|
|
128
|
+
<span className='material-symbols-rounded'>attach_file</span>
|
|
129
|
+
</span>
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
133
|
+
<div className='queued-messages-card__item-text'>
|
|
134
|
+
{summaryText !== '' ? summaryText : t('chat.queue.attachmentsOnly')}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
<div className='queued-messages-card__actions'>
|
|
140
|
+
<button
|
|
141
|
+
type='button'
|
|
142
|
+
className='queued-messages-card__action queued-messages-card__action--move'
|
|
143
|
+
onClick={() => void onMove(item, targetMode)}
|
|
144
|
+
title={t(targetMode === 'next' ? 'chat.queue.moveToNext' : 'chat.queue.moveToSteer')}
|
|
145
|
+
aria-label={t(targetMode === 'next' ? 'chat.queue.moveToNext' : 'chat.queue.moveToSteer')}
|
|
146
|
+
>
|
|
147
|
+
<span className='material-symbols-rounded'>swap_horiz</span>
|
|
148
|
+
</button>
|
|
149
|
+
<button
|
|
150
|
+
type='button'
|
|
151
|
+
className='queued-messages-card__action queued-messages-card__action--edit'
|
|
152
|
+
onClick={() => void onEdit(item)}
|
|
153
|
+
>
|
|
154
|
+
<span className='material-symbols-rounded'>edit</span>
|
|
155
|
+
</button>
|
|
156
|
+
<button
|
|
157
|
+
type='button'
|
|
158
|
+
className='queued-messages-card__action queued-messages-card__action--delete'
|
|
159
|
+
onClick={() => void onDelete(item)}
|
|
160
|
+
>
|
|
161
|
+
<span className='material-symbols-rounded'>delete</span>
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
})}
|
|
167
|
+
</div>
|
|
168
|
+
</ChatComposerCard>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Button, Dropdown, Empty, Input, Spin } from 'antd'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { useTranslation } from 'react-i18next'
|
|
3
4
|
|
|
4
5
|
import type { GitBranchSummary, GitRepositoryState } from '@vibe-forge/types'
|
|
5
6
|
|
|
7
|
+
import { BranchSwitcherResults } from './BranchSwitcherResults'
|
|
8
|
+
|
|
6
9
|
export function BranchSwitcherDropdown({
|
|
7
10
|
availableLocalBranches,
|
|
8
11
|
currentBranchLabel,
|
|
12
|
+
compact = false,
|
|
9
13
|
isBusy,
|
|
10
14
|
isLoading,
|
|
11
15
|
open,
|
|
@@ -13,6 +17,7 @@ export function BranchSwitcherDropdown({
|
|
|
13
17
|
branchQuery,
|
|
14
18
|
canCreateBranch,
|
|
15
19
|
hasBranchResults,
|
|
20
|
+
placement = 'bottomLeft',
|
|
16
21
|
remoteBranches,
|
|
17
22
|
onCreateBranch,
|
|
18
23
|
onOpenChange,
|
|
@@ -20,6 +25,7 @@ export function BranchSwitcherDropdown({
|
|
|
20
25
|
onSwitchBranch
|
|
21
26
|
}: {
|
|
22
27
|
availableLocalBranches: GitBranchSummary[]
|
|
28
|
+
compact?: boolean
|
|
23
29
|
currentBranchLabel: string
|
|
24
30
|
isBusy: boolean
|
|
25
31
|
isLoading: boolean
|
|
@@ -28,6 +34,7 @@ export function BranchSwitcherDropdown({
|
|
|
28
34
|
branchQuery: string
|
|
29
35
|
canCreateBranch: boolean
|
|
30
36
|
hasBranchResults: boolean
|
|
37
|
+
placement?: 'bottomLeft' | 'topLeft'
|
|
31
38
|
remoteBranches: GitBranchSummary[]
|
|
32
39
|
onCreateBranch: (name: string) => void
|
|
33
40
|
onOpenChange: (open: boolean) => void
|
|
@@ -35,67 +42,57 @@ export function BranchSwitcherDropdown({
|
|
|
35
42
|
onSwitchBranch: (branch: GitBranchSummary) => void
|
|
36
43
|
}) {
|
|
37
44
|
const { t } = useTranslation()
|
|
38
|
-
|
|
39
|
-
const renderBranchSection = (title: string, branches: GitBranchSummary[]) => {
|
|
40
|
-
if (branches.length === 0) {
|
|
41
|
-
return null
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div className='chat-header-git__section'>
|
|
46
|
-
<span className='chat-header-git__section-label'>{title}</span>
|
|
47
|
-
{branches.map(branch => {
|
|
48
|
-
return (
|
|
49
|
-
<button
|
|
50
|
-
key={`${branch.kind}:${branch.name}`}
|
|
51
|
-
type='button'
|
|
52
|
-
className='chat-header-git__branch-row'
|
|
53
|
-
disabled={isBusy}
|
|
54
|
-
title={branch.name}
|
|
55
|
-
onClick={() => onSwitchBranch(branch)}
|
|
56
|
-
>
|
|
57
|
-
<div className='chat-header-git__branch-row-main'>
|
|
58
|
-
<span className='chat-header-git__row-icon material-symbols-rounded'>
|
|
59
|
-
{branch.kind === 'local' ? 'call_split' : 'cloud_sync'}
|
|
60
|
-
</span>
|
|
61
|
-
<span className='chat-header-git__row-copy'>
|
|
62
|
-
<span className='chat-header-git__row-title'>{branch.name}</span>
|
|
63
|
-
</span>
|
|
64
|
-
</div>
|
|
65
|
-
{branch.isCurrent
|
|
66
|
-
? (
|
|
67
|
-
<span className='chat-header-git__row-state material-symbols-rounded'>check</span>
|
|
68
|
-
)
|
|
69
|
-
: null}
|
|
70
|
-
</button>
|
|
71
|
-
)
|
|
72
|
-
})}
|
|
73
|
-
</div>
|
|
74
|
-
)
|
|
75
|
-
}
|
|
45
|
+
const [displayMode, setDisplayMode] = useState<'flat' | 'tree'>('tree')
|
|
76
46
|
|
|
77
47
|
return (
|
|
78
48
|
<Dropdown
|
|
79
49
|
open={open}
|
|
80
|
-
placement=
|
|
50
|
+
placement={placement}
|
|
81
51
|
trigger={['click']}
|
|
82
52
|
onOpenChange={onOpenChange}
|
|
83
53
|
dropdownRender={() => (
|
|
84
54
|
<div className='chat-header-git__overlay chat-header-git__overlay--branches'>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
55
|
+
<div className='chat-header-git__search-row'>
|
|
56
|
+
<Input
|
|
57
|
+
allowClear
|
|
58
|
+
autoFocus
|
|
59
|
+
className='chat-header-git__search'
|
|
60
|
+
placeholder={t('chat.gitSearchBranches')}
|
|
61
|
+
prefix={<span className='material-symbols-rounded'>search</span>}
|
|
62
|
+
value={branchQuery}
|
|
63
|
+
onChange={(event) => onQueryChange(event.target.value)}
|
|
64
|
+
onPressEnter={() => {
|
|
65
|
+
if (canCreateBranch) {
|
|
66
|
+
onCreateBranch(branchQuery)
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<div
|
|
72
|
+
className='chat-header-git__view-switch'
|
|
73
|
+
role='tablist'
|
|
74
|
+
aria-label={t('chat.gitBranchViewMode')}
|
|
75
|
+
>
|
|
76
|
+
<button
|
|
77
|
+
type='button'
|
|
78
|
+
className={`chat-header-git__view-button ${displayMode === 'tree' ? 'is-active' : ''}`}
|
|
79
|
+
title={t('chat.gitBranchViewTree')}
|
|
80
|
+
aria-label={t('chat.gitBranchViewTree')}
|
|
81
|
+
onClick={() => setDisplayMode('tree')}
|
|
82
|
+
>
|
|
83
|
+
<span className='material-symbols-rounded'>account_tree</span>
|
|
84
|
+
</button>
|
|
85
|
+
<button
|
|
86
|
+
type='button'
|
|
87
|
+
className={`chat-header-git__view-button ${displayMode === 'flat' ? 'is-active' : ''}`}
|
|
88
|
+
title={t('chat.gitBranchViewFlat')}
|
|
89
|
+
aria-label={t('chat.gitBranchViewFlat')}
|
|
90
|
+
onClick={() => setDisplayMode('flat')}
|
|
91
|
+
>
|
|
92
|
+
<span className='material-symbols-rounded'>reorder</span>
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
99
96
|
|
|
100
97
|
{canCreateBranch && (
|
|
101
98
|
<button
|
|
@@ -124,8 +121,14 @@ export function BranchSwitcherDropdown({
|
|
|
124
121
|
: hasBranchResults
|
|
125
122
|
? (
|
|
126
123
|
<div className='chat-header-git__sections'>
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
<BranchSwitcherResults
|
|
125
|
+
availableLocalBranches={availableLocalBranches}
|
|
126
|
+
branchQuery={branchQuery}
|
|
127
|
+
isBusy={isBusy}
|
|
128
|
+
mode={displayMode}
|
|
129
|
+
remoteBranches={remoteBranches}
|
|
130
|
+
onSwitchBranch={onSwitchBranch}
|
|
131
|
+
/>
|
|
129
132
|
</div>
|
|
130
133
|
)
|
|
131
134
|
: (
|
|
@@ -141,7 +144,9 @@ export function BranchSwitcherDropdown({
|
|
|
141
144
|
>
|
|
142
145
|
<Button
|
|
143
146
|
type='text'
|
|
144
|
-
className={`chat-header-git__trigger ${open ? 'is-open' : ''} ${
|
|
147
|
+
className={`chat-header-git__trigger chat-header-git__trigger--branch ${open ? 'is-open' : ''} ${
|
|
148
|
+
isBusy ? 'is-disabled' : ''
|
|
149
|
+
} ${compact ? 'is-compact' : ''}`.trim()}
|
|
145
150
|
title={t('chat.gitBranchSwitcher')}
|
|
146
151
|
aria-label={t('chat.gitBranchSwitcher')}
|
|
147
152
|
>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
|
|
4
|
+
import type { GitBranchSummary } from '@vibe-forge/types'
|
|
5
|
+
|
|
6
|
+
import { BranchTreeEntries } from './BranchTreeEntries'
|
|
7
|
+
import type { GitBranchDisplayMode } from './git-branch-tree'
|
|
8
|
+
import {
|
|
9
|
+
buildGitBranchTree,
|
|
10
|
+
collectGitBranchTreeFolderKeys,
|
|
11
|
+
getGitBranchTreeFolderKeysForBranch
|
|
12
|
+
} from './git-branch-tree'
|
|
13
|
+
|
|
14
|
+
export function BranchSwitcherResults({
|
|
15
|
+
availableLocalBranches,
|
|
16
|
+
branchQuery,
|
|
17
|
+
isBusy,
|
|
18
|
+
mode,
|
|
19
|
+
remoteBranches,
|
|
20
|
+
onSwitchBranch
|
|
21
|
+
}: {
|
|
22
|
+
availableLocalBranches: GitBranchSummary[]
|
|
23
|
+
branchQuery: string
|
|
24
|
+
isBusy: boolean
|
|
25
|
+
mode: GitBranchDisplayMode
|
|
26
|
+
remoteBranches: GitBranchSummary[]
|
|
27
|
+
onSwitchBranch: (branch: GitBranchSummary) => void
|
|
28
|
+
}) {
|
|
29
|
+
const { t } = useTranslation()
|
|
30
|
+
const localBranchTree = useMemo(
|
|
31
|
+
() => buildGitBranchTree(availableLocalBranches, 'local'),
|
|
32
|
+
[availableLocalBranches]
|
|
33
|
+
)
|
|
34
|
+
const remoteBranchTree = useMemo(
|
|
35
|
+
() => buildGitBranchTree(remoteBranches, 'remote'),
|
|
36
|
+
[remoteBranches]
|
|
37
|
+
)
|
|
38
|
+
const [collapsedFolderKeys, setCollapsedFolderKeys] = useState<string[]>([])
|
|
39
|
+
const hasSearchQuery = branchQuery.trim() !== ''
|
|
40
|
+
const currentLocalBranch = useMemo(
|
|
41
|
+
() => availableLocalBranches.find(branch => branch.isCurrent),
|
|
42
|
+
[availableLocalBranches]
|
|
43
|
+
)
|
|
44
|
+
const currentRemoteBranch = useMemo(
|
|
45
|
+
() => remoteBranches.find(branch => branch.isCurrent),
|
|
46
|
+
[remoteBranches]
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const unifiedTreeEntries = useMemo(() => {
|
|
50
|
+
const entries = []
|
|
51
|
+
if (localBranchTree.length > 0) {
|
|
52
|
+
entries.push({
|
|
53
|
+
type: 'folder' as const,
|
|
54
|
+
folder: {
|
|
55
|
+
entries: localBranchTree,
|
|
56
|
+
hasCurrentBranch: currentLocalBranch != null,
|
|
57
|
+
key: 'local',
|
|
58
|
+
label: t('chat.gitBranchesLocal')
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
if (remoteBranchTree.length > 0) {
|
|
63
|
+
entries.push({
|
|
64
|
+
type: 'folder' as const,
|
|
65
|
+
folder: {
|
|
66
|
+
entries: remoteBranchTree,
|
|
67
|
+
hasCurrentBranch: currentRemoteBranch != null,
|
|
68
|
+
key: 'remote',
|
|
69
|
+
label: t('chat.gitBranchesRemote')
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return entries.sort((left, right) => {
|
|
75
|
+
if (left.folder.hasCurrentBranch !== right.folder.hasCurrentBranch) {
|
|
76
|
+
return left.folder.hasCurrentBranch ? -1 : 1
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return left.folder.label.localeCompare(right.folder.label)
|
|
80
|
+
})
|
|
81
|
+
}, [currentLocalBranch, currentRemoteBranch, localBranchTree, remoteBranchTree, t])
|
|
82
|
+
|
|
83
|
+
const allFolderKeys = useMemo(
|
|
84
|
+
() => new Set(collectGitBranchTreeFolderKeys(unifiedTreeEntries)),
|
|
85
|
+
[unifiedTreeEntries]
|
|
86
|
+
)
|
|
87
|
+
const defaultExpandedFolderKeys = useMemo(
|
|
88
|
+
() =>
|
|
89
|
+
new Set([
|
|
90
|
+
...(currentLocalBranch != null ? getGitBranchTreeFolderKeysForBranch(currentLocalBranch, 'local') : []),
|
|
91
|
+
...(currentRemoteBranch != null ? getGitBranchTreeFolderKeysForBranch(currentRemoteBranch, 'remote') : [])
|
|
92
|
+
]),
|
|
93
|
+
[currentLocalBranch, currentRemoteBranch]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
setCollapsedFolderKeys(
|
|
98
|
+
Array.from(allFolderKeys).filter(key => !defaultExpandedFolderKeys.has(key))
|
|
99
|
+
)
|
|
100
|
+
}, [allFolderKeys, defaultExpandedFolderKeys])
|
|
101
|
+
|
|
102
|
+
const toggleFolder = (folderKey: string) => {
|
|
103
|
+
setCollapsedFolderKeys(currentKeys => (
|
|
104
|
+
currentKeys.includes(folderKey)
|
|
105
|
+
? currentKeys.filter(key => key !== folderKey)
|
|
106
|
+
: [...currentKeys, folderKey]
|
|
107
|
+
))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const renderBranchSection = (title: string, branches: GitBranchSummary[]) => {
|
|
111
|
+
if (branches.length === 0) {
|
|
112
|
+
return null
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<div className='chat-header-git__section'>
|
|
117
|
+
<span className='chat-header-git__section-label'>{title}</span>
|
|
118
|
+
{branches.map(branch => {
|
|
119
|
+
return (
|
|
120
|
+
<button
|
|
121
|
+
key={`${branch.kind}:${branch.name}`}
|
|
122
|
+
type='button'
|
|
123
|
+
className='chat-header-git__branch-row'
|
|
124
|
+
disabled={isBusy}
|
|
125
|
+
title={branch.name}
|
|
126
|
+
onClick={() => onSwitchBranch(branch)}
|
|
127
|
+
>
|
|
128
|
+
<div className='chat-header-git__branch-row-main'>
|
|
129
|
+
<span className='chat-header-git__row-icon material-symbols-rounded'>
|
|
130
|
+
{branch.kind === 'local' ? 'call_split' : 'cloud_sync'}
|
|
131
|
+
</span>
|
|
132
|
+
<span className='chat-header-git__row-copy'>
|
|
133
|
+
<span className='chat-header-git__row-title'>{branch.name}</span>
|
|
134
|
+
</span>
|
|
135
|
+
</div>
|
|
136
|
+
{branch.isCurrent
|
|
137
|
+
? (
|
|
138
|
+
<span className='chat-header-git__row-state material-symbols-rounded'>check</span>
|
|
139
|
+
)
|
|
140
|
+
: null}
|
|
141
|
+
</button>
|
|
142
|
+
)
|
|
143
|
+
})}
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return mode === 'tree'
|
|
149
|
+
? (
|
|
150
|
+
<div className='chat-header-git__branch-tree'>
|
|
151
|
+
<BranchTreeEntries
|
|
152
|
+
collapsedFolderKeys={collapsedFolderKeys}
|
|
153
|
+
hasSearchQuery={hasSearchQuery}
|
|
154
|
+
isBusy={isBusy}
|
|
155
|
+
treeEntries={unifiedTreeEntries}
|
|
156
|
+
onSwitchBranch={onSwitchBranch}
|
|
157
|
+
onToggleFolder={toggleFolder}
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
)
|
|
161
|
+
: (
|
|
162
|
+
<>
|
|
163
|
+
{renderBranchSection(t('chat.gitBranchesLocal'), availableLocalBranches)}
|
|
164
|
+
{renderBranchSection(t('chat.gitBranchesRemote'), remoteBranches)}
|
|
165
|
+
</>
|
|
166
|
+
)
|
|
167
|
+
}
|