@allbluecn/web-app 0.5.0 → 0.6.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/package.json +239 -30
- package/src/components/iteration/auto-schedule-dialog.tsx +150 -0
- package/src/components/iteration/burndown-chart.tsx +63 -0
- package/src/components/iteration/constants.ts +28 -0
- package/src/components/iteration/create-iteration-dialog.tsx +140 -0
- package/src/components/iteration/iteration-card.tsx +60 -0
- package/src/components/iteration/iteration-editor.tsx +116 -0
- package/src/components/iteration/iteration-progress-bar.tsx +44 -0
- package/src/components/iteration/iteration-status-badge.tsx +33 -0
- package/src/components/knowledge/dialog/knowledge-form-dialog.tsx +21 -30
- package/src/components/knowledge/knowledge-toolbar.tsx +124 -1
- package/src/components/layout/sidebar-03/__tests__/nav-workspace.test.tsx +2 -2
- package/src/components/layout/sidebar-03/nav-workspace.tsx +2 -2
- package/src/components/project/create-project-dialog.tsx +44 -57
- package/src/components/shared/__tests__/lucide-curated-icons.test.ts +83 -0
- package/src/components/shared/__tests__/lucide-icon-data.test.ts +131 -0
- package/src/components/shared/__tests__/lucide-icon-picker.test.tsx +197 -0
- package/src/components/shared/lucide-icon-picker/curated-icons.ts +478 -0
- package/src/components/shared/lucide-icon-picker/icon-data.ts +109 -0
- package/src/components/shared/lucide-icon-picker/index.tsx +82 -0
- package/src/components/shared/lucide-icon-picker/lucide-icon-by-name.tsx +78 -0
- package/src/components/shared/lucide-icon-picker/panel.tsx +163 -0
- package/src/components/story/__tests__/constants.test.ts +255 -0
- package/src/components/story/ai/story-ai-panel.tsx +23 -15
- package/src/components/story/ai/story-ai-preview-list.tsx +19 -0
- package/src/components/story/constants.ts +43 -1
- package/src/components/story/create-story-dialog.tsx +42 -16
- package/src/components/story/detail/__tests__/associated-attachments-panel.test.tsx +114 -0
- package/src/components/story/detail/__tests__/categories.test.tsx +62 -0
- package/src/components/story/detail/__tests__/dependencies-button.test.tsx +49 -0
- package/src/components/story/detail/activity-timeline.tsx +26 -4
- package/src/components/story/detail/story-detail-body.tsx +90 -38
- package/src/components/story/detail/story-detail-toolbar/associated-attachments-panel.tsx +857 -0
- package/src/components/story/detail/story-detail-toolbar/categories.tsx +23 -18
- package/src/components/story/detail/story-detail-toolbar/children.tsx +9 -4
- package/src/components/story/detail/story-detail-toolbar/dependency-panel.tsx +95 -27
- package/src/components/story/detail/story-detail-toolbar.tsx +159 -8
- package/src/components/story/detail/story-properties.tsx +21 -4
- package/src/components/story/display/__tests__/group-fields.test.ts +107 -0
- package/src/components/story/display/group-resolver.tsx +2 -2
- package/src/components/story/inline-editors/__tests__/dependency-type-select.test.tsx +155 -0
- package/src/components/story/inline-editors/__tests__/labels-editor.test.tsx +155 -0
- package/src/components/story/inline-editors/__tests__/priority-editor.test.tsx +173 -0
- package/src/components/story/inline-editors/__tests__/state-editor.test.tsx +174 -0
- package/src/components/story/inline-editors/dependency-type-select.tsx +180 -0
- package/src/components/story/inline-editors/index.ts +2 -1
- package/src/components/story/inline-editors/labels-editor.tsx +159 -3
- package/src/components/story/inline-editors/story-select-dialog.tsx +41 -63
- package/src/components/story/peek-panel.tsx +121 -21
- package/src/components/story/relations/__tests__/attachment-manage-dialog.test.tsx +171 -0
- package/src/components/story/relations/__tests__/knowledge-select-dialog.test.tsx +174 -0
- package/src/components/story/relations/__tests__/link-manage-dialog.test.tsx +93 -0
- package/src/components/story/relations/attachment-manage-dialog.tsx +490 -0
- package/src/components/story/relations/file-preview.tsx +173 -0
- package/src/components/story/relations/format.ts +120 -0
- package/src/components/story/relations/general-groups.ts +32 -0
- package/src/components/story/relations/knowledge-select-dialog.tsx +403 -0
- package/src/components/story/relations/link-manage-dialog.tsx +192 -0
- package/src/components/story/relations/story-ref-row.tsx +17 -27
- package/src/components/story/story-panel-header.tsx +25 -19
- package/src/components/story/story-toolbar.tsx +3 -3
- package/src/components/story/transfer-story-popover.tsx +2 -2
- package/src/components/story/types.ts +14 -0
- package/src/components/story/views/create-view-dialog.tsx +3 -3
- package/src/components/story/views/story-list/__tests__/group-header.test.tsx +219 -0
- package/src/components/story/views/story-list/group.tsx +1 -1
- package/src/components/story/views/story-list/inline-story-creator.tsx +2 -2
- package/src/components/story/views/story-list/row.tsx +1 -1
- package/src/components/workspace/create-workspace-dialog.tsx +41 -49
- package/src/lib/__tests__/project-display-id.test.ts +8 -5
- package/src/lib/changelog/sdk-versions.ts +20 -20
- package/src/lib/iteration/__tests__/status.test.ts +41 -0
- package/src/lib/iteration/status.ts +28 -0
- package/src/lib/project-display-id.ts +14 -5
- package/src/lib/project-module-meta.ts +77 -0
- package/src/lib/story/__tests__/video-embed.test.ts +77 -0
- package/src/lib/story/video-embed.ts +59 -0
- package/src/lib/utils.d.ts +1 -1
- package/src/plugins/.gen-manifest.json +13 -0
- package/src/plugins/modules.gen.ts +20 -0
- package/src/plugins/plugins.gen.ts +20 -0
- package/src/plugins/ui.gen.ts +8 -0
- package/src/providers/index.tsx +6 -0
- package/src/routeTree.gen.ts +96 -0
- package/src/routes/__root.tsx +0 -8
- package/src/routes/_nav/inspiration/route.tsx +8 -0
- package/src/routes/_nav/knowledge/index.lazy.tsx +2 -2
- package/src/routes/_nav/prd/$id/route.tsx +9 -0
- package/src/routes/_nav/prd/index.tsx +9 -0
- package/src/routes/_nav/prd/route.tsx +8 -0
- package/src/routes/_nav/projects/$projectId/$storyId/route.lazy.tsx +52 -25
- package/src/routes/_nav/projects/$projectId/$storyId/route.tsx +6 -3
- package/src/routes/_nav/projects/$projectId/index.lazy.tsx +32 -15
- package/src/routes/_nav/projects/$projectId/iterations/$iterationId/route.lazy.tsx +289 -0
- package/src/routes/_nav/projects/$projectId/iterations/$iterationId/route.tsx +27 -0
- package/src/routes/_nav/projects/$projectId/iterations/index.lazy.tsx +111 -0
- package/src/routes/_nav/projects/$projectId/iterations/index.tsx +24 -0
- package/src/routes/_nav/projects/$projectId/route.tsx +4 -2
- package/src/routes/_nav/projects/$projectId/settings/route.lazy.tsx +78 -7
- package/src/routes/_nav/projects/$projectId/settings/route.tsx +6 -2
- package/src/routes/_nav/stories/$storyId/route.lazy.tsx +5 -1
- package/src/routes/_nav/stories/$storyId/route.tsx +4 -0
- package/src/routes/_nav/tags/$id/route.tsx +8 -0
- package/src/routes/_nav/tags/index.tsx +8 -0
- package/src/routes/_nav/tags/route.tsx +8 -0
- package/src/routes/_nav/tags/settings/route.tsx +9 -0
- package/src/routes/_nav/workspaces/$workspaceId/route.lazy.tsx +3 -3
- package/src/routes/_nav/workspaces/$workspaceId/settings/route.lazy.tsx +4 -4
- package/src/routes/_nav/workspaces/index.lazy.tsx +3 -3
- package/src/routes/api/attachments/$id/content.ts +60 -0
- package/src/routes/api/attachments/upload.ts +148 -0
- package/src/routes/share/prd/$prdId/route.tsx +10 -0
- package/src/server/serverFns/__tests__/project-kb.test.ts +147 -0
- package/src/server/serverFns/iteration/__tests__/auto-schedule-core.test.ts +62 -0
- package/src/server/serverFns/iteration/__tests__/burndown-core.test.ts +90 -0
- package/src/server/serverFns/iteration/__tests__/iteration-crud.test.ts +211 -0
- package/src/server/serverFns/iteration/__tests__/iteration-stories.test.ts +155 -0
- package/src/server/serverFns/iteration/__tests__/iteration-transfer.test.ts +136 -0
- package/src/server/serverFns/iteration/auto-schedule-core.ts +54 -0
- package/src/server/serverFns/iteration/auto-schedule-internal.ts +88 -0
- package/src/server/serverFns/iteration/burndown-core.ts +60 -0
- package/src/server/serverFns/iteration/index.ts +22 -0
- package/src/server/serverFns/iteration/iteration-auto-schedule.ts +66 -0
- package/src/server/serverFns/iteration/iteration-burndown.ts +70 -0
- package/src/server/serverFns/iteration/iteration-crud.ts +208 -0
- package/src/server/serverFns/iteration/iteration-stories.ts +111 -0
- package/src/server/serverFns/iteration/iteration-transfer.ts +42 -0
- package/src/server/serverFns/iteration/schemas.ts +58 -0
- package/src/server/serverFns/iteration/transfer-internal.ts +62 -0
- package/src/server/serverFns/knowledge.ts +50 -4
- package/src/server/serverFns/project/module-overview.ts +109 -0
- package/src/server/serverFns/project.ts +45 -2
- package/src/server/serverFns/story/__tests__/kb-scope.test.ts +56 -0
- package/src/server/serverFns/story/__tests__/label-suggest-fn.test.ts +100 -0
- package/src/server/serverFns/story/__tests__/labels.test.ts +67 -0
- package/src/server/serverFns/story/__tests__/story-assoc.test.ts +222 -0
- package/src/server/serverFns/story/__tests__/story-dependencies.test.ts +132 -2
- package/src/server/serverFns/story/index.ts +9 -4
- package/src/server/serverFns/story/kb-general.ts +39 -0
- package/src/server/serverFns/story/kb-scope.ts +52 -0
- package/src/server/serverFns/story/link-preview.ts +115 -0
- package/src/server/serverFns/story/story-assoc.ts +372 -51
- package/src/server/serverFns/story/story-attachments.ts +32 -45
- package/src/{components/project/project-icon.tsx → server/serverFns/story/story-crud/label-palette.ts} +16 -19
- package/src/server/serverFns/story/story-crud/label-suggest-core.ts +88 -0
- package/src/server/serverFns/story/story-crud/label-suggest.ts +38 -0
- package/src/{components/knowledge/knowledge-icon.tsx → server/serverFns/story/story-crud/label-upsert.ts} +13 -19
- package/src/server/serverFns/story/story-crud/labels.ts +3 -5
- package/src/server/serverFns/story/story-crud.ts +53 -6
- package/src/server/serverFns/story/story-dependencies.ts +158 -5
- package/src/server/serverFns/story/story-links.ts +43 -7
- package/src/server/serverFns/story/story-transfer.ts +5 -4
- package/src/server/serverFns/story/story-tree.ts +28 -1
- package/src/server/serverFns/story/types.ts +38 -0
- package/src/styles/globals.css +25 -0
- package/src/types/project.ts +5 -5
- package/vite.shared.ts +2 -0
- package/src/components/project/project-animated-icon.tsx +0 -73
- package/src/components/shared/icon-packs/index.ts +0 -1
- package/src/components/shared/icon-packs/knowledge.ts +0 -1
- package/src/components/shared/icon-packs/prd.ts +0 -1
- package/src/components/shared/icon-packs/project.ts +0 -1
- package/src/components/shared/icon-picker.tsx +0 -1
- package/src/components/story/detail/story-detail-toolbar/attachments.tsx +0 -73
- package/src/components/story/detail/story-detail-toolbar/knowledge.tsx +0 -73
- package/src/components/story/detail/story-detail-toolbar/links.tsx +0 -73
- package/src/components/story/relations/attachments-panel.tsx +0 -179
- package/src/components/story/relations/knowledge-panel.tsx +0 -284
- package/src/components/story/relations/links-panel.tsx +0 -240
- package/src/lib/project-mock.ts +0 -156
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import { Plus, FileText, BookOpen, Unlink } from "lucide-react";
|
|
20
|
-
import { useTranslation } from "react-i18next";
|
|
21
|
-
import { Button } from "@/components/ui/button";
|
|
22
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
|
23
|
-
import { Input } from "@/components/ui/input";
|
|
24
|
-
import { useServerFn } from "@tanstack/react-start";
|
|
25
|
-
import {
|
|
26
|
-
linkPrdFn,
|
|
27
|
-
unlinkPrdFn,
|
|
28
|
-
linkDocFn,
|
|
29
|
-
unlinkDocFn,
|
|
30
|
-
searchPrdsFn,
|
|
31
|
-
searchDocsFn,
|
|
32
|
-
} from "@/server/serverFns/story";
|
|
33
|
-
import { toast } from "sonner";
|
|
34
|
-
import { type PrdBrief, type DocBrief } from "../types";
|
|
35
|
-
|
|
36
|
-
export interface KnowledgePanelProps {
|
|
37
|
-
storyId: string;
|
|
38
|
-
data: {
|
|
39
|
-
prds: PrdBrief[];
|
|
40
|
-
docs: DocBrief[];
|
|
41
|
-
};
|
|
42
|
-
onUpdate: (updates: Partial<{ prds: PrdBrief[]; docs: DocBrief[] }>) => void;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function KnowledgePanel({ storyId, data, onUpdate }: KnowledgePanelProps) {
|
|
46
|
-
const { t } = useTranslation("story");
|
|
47
|
-
const [prdDialogOpen, setPrdDialogOpen] = React.useState(false);
|
|
48
|
-
const [docDialogOpen, setDocDialogOpen] = React.useState(false);
|
|
49
|
-
const [prdQuery, setPrdQuery] = React.useState("");
|
|
50
|
-
const [docQuery, setDocQuery] = React.useState("");
|
|
51
|
-
const [prdResults, setPrdResults] = React.useState<PrdBrief[]>([]);
|
|
52
|
-
const [docResults, setDocResults] = React.useState<DocBrief[]>([]);
|
|
53
|
-
|
|
54
|
-
const linkPrd = useServerFn(linkPrdFn);
|
|
55
|
-
const unlinkPrd = useServerFn(unlinkPrdFn);
|
|
56
|
-
const linkDoc = useServerFn(linkDocFn);
|
|
57
|
-
const unlinkDoc = useServerFn(unlinkDocFn);
|
|
58
|
-
|
|
59
|
-
const handleSearchPrds = async (q: string) => {
|
|
60
|
-
setPrdQuery(q);
|
|
61
|
-
if (!q.trim()) {
|
|
62
|
-
setPrdResults([]);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
const results = await searchPrdsFn({ data: { query: q } });
|
|
67
|
-
setPrdResults(results);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error(t("knowledge.searchPrdFailed"), error);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const handleSearchDocs = async (q: string) => {
|
|
74
|
-
setDocQuery(q);
|
|
75
|
-
if (!q.trim()) {
|
|
76
|
-
setDocResults([]);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
const results = await searchDocsFn({ data: { query: q } });
|
|
81
|
-
setDocResults(results);
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.error(t("knowledge.searchDocFailed"), error);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const handleLinkPrd = async (prd: PrdBrief) => {
|
|
88
|
-
try {
|
|
89
|
-
await linkPrd({ data: { storyId, prdId: prd.id } });
|
|
90
|
-
toast.success(t("knowledge.prdLinked"));
|
|
91
|
-
onUpdate({ prds: [...data.prds, prd] });
|
|
92
|
-
setPrdDialogOpen(false);
|
|
93
|
-
setPrdQuery("");
|
|
94
|
-
setPrdResults([]);
|
|
95
|
-
} catch (error: any) {
|
|
96
|
-
console.error(t("knowledge.linkPrdFailed"), error);
|
|
97
|
-
toast.error(error.message || t("knowledge.linkPrdFailed"));
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const handleUnlinkPrd = async (prdId: string) => {
|
|
102
|
-
try {
|
|
103
|
-
await unlinkPrd({ data: { storyId, prdId } });
|
|
104
|
-
toast.success(t("knowledge.prdUnlinked"));
|
|
105
|
-
onUpdate({ prds: data.prds.filter((p) => p.id !== prdId) });
|
|
106
|
-
} catch (error: any) {
|
|
107
|
-
console.error(t("knowledge.unlinkPrdFailed"), error);
|
|
108
|
-
toast.error(error.message || t("knowledge.unlinkPrdFailed"));
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const handleLinkDoc = async (doc: DocBrief) => {
|
|
113
|
-
try {
|
|
114
|
-
await linkDoc({ data: { storyId, docId: doc.id } });
|
|
115
|
-
toast.success(t("knowledge.docLinked"));
|
|
116
|
-
onUpdate({ docs: [...data.docs, doc] });
|
|
117
|
-
setDocDialogOpen(false);
|
|
118
|
-
setDocQuery("");
|
|
119
|
-
setDocResults([]);
|
|
120
|
-
} catch (error: any) {
|
|
121
|
-
console.error(t("knowledge.linkDocFailed"), error);
|
|
122
|
-
toast.error(error.message || t("knowledge.linkDocFailed"));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const handleUnlinkDoc = async (docId: string) => {
|
|
127
|
-
try {
|
|
128
|
-
await unlinkDoc({ data: { storyId, docId } });
|
|
129
|
-
toast.success(t("knowledge.docUnlinked"));
|
|
130
|
-
onUpdate({ docs: data.docs.filter((d) => d.id !== docId) });
|
|
131
|
-
} catch (error: any) {
|
|
132
|
-
console.error(t("knowledge.unlinkDocFailed"), error);
|
|
133
|
-
toast.error(error.message || t("knowledge.unlinkDocFailed"));
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<div className="space-y-6">
|
|
139
|
-
{/* PRD 关联 */}
|
|
140
|
-
<div>
|
|
141
|
-
<div className="flex items-center justify-between mb-2">
|
|
142
|
-
<div className="flex items-center gap-2">
|
|
143
|
-
<FileText className="h-4 w-4 text-muted-foreground" />
|
|
144
|
-
<div className="text-sm font-medium">{t("knowledge.prdTitle")}</div>
|
|
145
|
-
</div>
|
|
146
|
-
<Dialog open={prdDialogOpen} onOpenChange={setPrdDialogOpen}>
|
|
147
|
-
<DialogTrigger asChild>
|
|
148
|
-
<Button type="button" variant="outline" size="sm">
|
|
149
|
-
<Plus className="h-4 w-4 mr-2" />
|
|
150
|
-
{t("knowledge.linkPrd")}
|
|
151
|
-
</Button>
|
|
152
|
-
</DialogTrigger>
|
|
153
|
-
<DialogContent>
|
|
154
|
-
<DialogHeader>
|
|
155
|
-
<DialogTitle>{t("knowledge.searchPrdTitle")}</DialogTitle>
|
|
156
|
-
</DialogHeader>
|
|
157
|
-
<div className="space-y-3">
|
|
158
|
-
<Input
|
|
159
|
-
placeholder={t("knowledge.searchPrdPlaceholder")}
|
|
160
|
-
value={prdQuery}
|
|
161
|
-
onChange={(e) => handleSearchPrds(e.target.value)}
|
|
162
|
-
/>
|
|
163
|
-
<div className="max-h-64 overflow-y-auto space-y-1">
|
|
164
|
-
{prdResults.map((prd) => (
|
|
165
|
-
<button
|
|
166
|
-
key={prd.id}
|
|
167
|
-
type="button"
|
|
168
|
-
className="w-full text-left px-3 py-2 rounded-md hover:bg-muted text-sm"
|
|
169
|
-
onClick={() => handleLinkPrd(prd)}
|
|
170
|
-
>
|
|
171
|
-
{prd.title}
|
|
172
|
-
</button>
|
|
173
|
-
))}
|
|
174
|
-
{prdResults.length === 0 && prdQuery && (
|
|
175
|
-
<div className="text-sm text-muted-foreground text-center py-4">
|
|
176
|
-
{t("knowledge.noResults")}
|
|
177
|
-
</div>
|
|
178
|
-
)}
|
|
179
|
-
</div>
|
|
180
|
-
</div>
|
|
181
|
-
</DialogContent>
|
|
182
|
-
</Dialog>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
{data.prds.length > 0 ? (
|
|
186
|
-
<div className="space-y-2">
|
|
187
|
-
{data.prds.map((prd) => (
|
|
188
|
-
<div
|
|
189
|
-
key={prd.id}
|
|
190
|
-
className="flex items-center justify-between p-3 bg-muted rounded-md"
|
|
191
|
-
>
|
|
192
|
-
<span className="text-sm">{prd.title}</span>
|
|
193
|
-
<Button
|
|
194
|
-
type="button"
|
|
195
|
-
variant="ghost"
|
|
196
|
-
size="sm"
|
|
197
|
-
onClick={() => handleUnlinkPrd(prd.id)}
|
|
198
|
-
>
|
|
199
|
-
<Unlink className="h-4 w-4" />
|
|
200
|
-
</Button>
|
|
201
|
-
</div>
|
|
202
|
-
))}
|
|
203
|
-
</div>
|
|
204
|
-
) : (
|
|
205
|
-
<div className="text-sm text-muted-foreground text-center py-2">
|
|
206
|
-
{t("knowledge.noPrds")}
|
|
207
|
-
</div>
|
|
208
|
-
)}
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
{/* 知识文档关联 */}
|
|
212
|
-
<div>
|
|
213
|
-
<div className="flex items-center justify-between mb-2">
|
|
214
|
-
<div className="flex items-center gap-2">
|
|
215
|
-
<BookOpen className="h-4 w-4 text-muted-foreground" />
|
|
216
|
-
<div className="text-sm font-medium">{t("knowledge.docTitle")}</div>
|
|
217
|
-
</div>
|
|
218
|
-
<Dialog open={docDialogOpen} onOpenChange={setDocDialogOpen}>
|
|
219
|
-
<DialogTrigger asChild>
|
|
220
|
-
<Button type="button" variant="outline" size="sm">
|
|
221
|
-
<Plus className="h-4 w-4 mr-2" />
|
|
222
|
-
{t("knowledge.linkDoc")}
|
|
223
|
-
</Button>
|
|
224
|
-
</DialogTrigger>
|
|
225
|
-
<DialogContent>
|
|
226
|
-
<DialogHeader>
|
|
227
|
-
<DialogTitle>{t("knowledge.searchDocTitle")}</DialogTitle>
|
|
228
|
-
</DialogHeader>
|
|
229
|
-
<div className="space-y-3">
|
|
230
|
-
<Input
|
|
231
|
-
placeholder={t("knowledge.searchDocPlaceholder")}
|
|
232
|
-
value={docQuery}
|
|
233
|
-
onChange={(e) => handleSearchDocs(e.target.value)}
|
|
234
|
-
/>
|
|
235
|
-
<div className="max-h-64 overflow-y-auto space-y-1">
|
|
236
|
-
{docResults.map((doc) => (
|
|
237
|
-
<button
|
|
238
|
-
key={doc.id}
|
|
239
|
-
type="button"
|
|
240
|
-
className="w-full text-left px-3 py-2 rounded-md hover:bg-muted text-sm"
|
|
241
|
-
onClick={() => handleLinkDoc(doc)}
|
|
242
|
-
>
|
|
243
|
-
{doc.title}
|
|
244
|
-
</button>
|
|
245
|
-
))}
|
|
246
|
-
{docResults.length === 0 && docQuery && (
|
|
247
|
-
<div className="text-sm text-muted-foreground text-center py-4">
|
|
248
|
-
{t("knowledge.noResults")}
|
|
249
|
-
</div>
|
|
250
|
-
)}
|
|
251
|
-
</div>
|
|
252
|
-
</div>
|
|
253
|
-
</DialogContent>
|
|
254
|
-
</Dialog>
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
{data.docs.length > 0 ? (
|
|
258
|
-
<div className="space-y-2">
|
|
259
|
-
{data.docs.map((doc) => (
|
|
260
|
-
<div
|
|
261
|
-
key={doc.id}
|
|
262
|
-
className="flex items-center justify-between p-3 bg-muted rounded-md"
|
|
263
|
-
>
|
|
264
|
-
<span className="text-sm">{doc.title}</span>
|
|
265
|
-
<Button
|
|
266
|
-
type="button"
|
|
267
|
-
variant="ghost"
|
|
268
|
-
size="sm"
|
|
269
|
-
onClick={() => handleUnlinkDoc(doc.id)}
|
|
270
|
-
>
|
|
271
|
-
<Unlink className="h-4 w-4" />
|
|
272
|
-
</Button>
|
|
273
|
-
</div>
|
|
274
|
-
))}
|
|
275
|
-
</div>
|
|
276
|
-
) : (
|
|
277
|
-
<div className="text-sm text-muted-foreground text-center py-2">
|
|
278
|
-
{t("knowledge.noDocs")}
|
|
279
|
-
</div>
|
|
280
|
-
)}
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
);
|
|
284
|
-
}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import { Plus, ExternalLink, Trash2, Edit2 } from "lucide-react";
|
|
20
|
-
import { useTranslation } from "react-i18next";
|
|
21
|
-
import { Button } from "@/components/ui/button";
|
|
22
|
-
import { Input } from "@/components/ui/input";
|
|
23
|
-
import { Textarea } from "@/components/ui/textarea";
|
|
24
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
|
25
|
-
import { useServerFn } from "@tanstack/react-start";
|
|
26
|
-
import { addLinkFn, updateLinkFn, removeLinkFn } from "@/server/serverFns/story";
|
|
27
|
-
import { toast } from "sonner";
|
|
28
|
-
import { type StoryLinkItem } from "../types";
|
|
29
|
-
|
|
30
|
-
export interface LinksPanelProps {
|
|
31
|
-
storyId: string;
|
|
32
|
-
data: StoryLinkItem[];
|
|
33
|
-
onUpdate: (newLinks: StoryLinkItem[]) => void;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function LinksPanel({ storyId, data, onUpdate }: LinksPanelProps) {
|
|
37
|
-
const { t } = useTranslation("story");
|
|
38
|
-
const [open, setOpen] = React.useState(false);
|
|
39
|
-
const [editingLink, setEditingLink] = React.useState<StoryLinkItem | null>(null);
|
|
40
|
-
const [form, setForm] = React.useState({ url: "", title: "", description: "" });
|
|
41
|
-
|
|
42
|
-
const addLink = useServerFn(addLinkFn);
|
|
43
|
-
const updateLink = useServerFn(updateLinkFn);
|
|
44
|
-
const removeLink = useServerFn(removeLinkFn);
|
|
45
|
-
|
|
46
|
-
const handleOpenAdd = () => {
|
|
47
|
-
setEditingLink(null);
|
|
48
|
-
setForm({ url: "", title: "", description: "" });
|
|
49
|
-
setOpen(true);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const handleOpenEdit = (link: StoryLinkItem) => {
|
|
53
|
-
setEditingLink(link);
|
|
54
|
-
setForm({ url: link.url, title: link.title || "", description: link.description || "" });
|
|
55
|
-
setOpen(true);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
if (editingLink) {
|
|
63
|
-
await updateLink({
|
|
64
|
-
data: {
|
|
65
|
-
linkId: editingLink.id,
|
|
66
|
-
url: form.url,
|
|
67
|
-
title: form.title || undefined,
|
|
68
|
-
description: form.description || undefined,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
toast.success(t("links.updated"));
|
|
72
|
-
|
|
73
|
-
onUpdate(
|
|
74
|
-
data.map((link) =>
|
|
75
|
-
link.id === editingLink.id
|
|
76
|
-
? { ...link, url: form.url, title: form.title || null, description: form.description || null }
|
|
77
|
-
: link
|
|
78
|
-
)
|
|
79
|
-
);
|
|
80
|
-
} else {
|
|
81
|
-
const result = await addLink({
|
|
82
|
-
data: {
|
|
83
|
-
storyId,
|
|
84
|
-
url: form.url,
|
|
85
|
-
title: form.title || undefined,
|
|
86
|
-
description: form.description || undefined,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
toast.success(t("links.added"));
|
|
90
|
-
|
|
91
|
-
onUpdate([
|
|
92
|
-
...data,
|
|
93
|
-
{
|
|
94
|
-
id: result.id,
|
|
95
|
-
url: result.url,
|
|
96
|
-
title: result.title,
|
|
97
|
-
description: result.description,
|
|
98
|
-
},
|
|
99
|
-
]);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
setOpen(false);
|
|
103
|
-
} catch (error: any) {
|
|
104
|
-
console.error(t("links.saveFailed"), error);
|
|
105
|
-
toast.error(error.message || t("links.saveFailed"));
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const handleRemove = async (linkId: string) => {
|
|
110
|
-
try {
|
|
111
|
-
await removeLink({ data: { linkId } });
|
|
112
|
-
toast.success(t("links.removed"));
|
|
113
|
-
|
|
114
|
-
onUpdate(data.filter((link) => link.id !== linkId));
|
|
115
|
-
} catch (error: any) {
|
|
116
|
-
console.error(t("links.removeFailed"), error);
|
|
117
|
-
toast.error(error.message || t("links.removeFailed"));
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<div className="space-y-4">
|
|
123
|
-
<div className="flex items-center justify-between">
|
|
124
|
-
<div className="text-sm font-medium">{t("links.title")}</div>
|
|
125
|
-
<Dialog open={open} onOpenChange={setOpen}>
|
|
126
|
-
<DialogTrigger asChild>
|
|
127
|
-
<Button type="button" variant="outline" size="sm" onClick={handleOpenAdd}>
|
|
128
|
-
<Plus className="h-4 w-4 mr-2" />
|
|
129
|
-
{t("links.add")}
|
|
130
|
-
</Button>
|
|
131
|
-
</DialogTrigger>
|
|
132
|
-
<DialogContent>
|
|
133
|
-
<DialogHeader>
|
|
134
|
-
<DialogTitle>{t(editingLink ? "links.editTitle" : "links.addTitle")}</DialogTitle>
|
|
135
|
-
</DialogHeader>
|
|
136
|
-
<form onSubmit={handleSubmit} className="space-y-4">
|
|
137
|
-
<div>
|
|
138
|
-
<label className="text-sm font-medium">URL</label>
|
|
139
|
-
<Input
|
|
140
|
-
type="url"
|
|
141
|
-
placeholder="https://example.com"
|
|
142
|
-
value={form.url}
|
|
143
|
-
onChange={(e) => setForm({ ...form, url: e.target.value })}
|
|
144
|
-
required
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
147
|
-
<div>
|
|
148
|
-
<label className="text-sm font-medium">{t("links.titleOptional")}</label>
|
|
149
|
-
<Input
|
|
150
|
-
placeholder={t("links.titlePlaceholder")}
|
|
151
|
-
value={form.title}
|
|
152
|
-
onChange={(e) => setForm({ ...form, title: e.target.value })}
|
|
153
|
-
/>
|
|
154
|
-
</div>
|
|
155
|
-
<div>
|
|
156
|
-
<label className="text-sm font-medium">{t("links.descOptional")}</label>
|
|
157
|
-
<Textarea
|
|
158
|
-
placeholder={t("links.descPlaceholder")}
|
|
159
|
-
value={form.description}
|
|
160
|
-
onChange={(e) => setForm({ ...form, description: e.target.value })}
|
|
161
|
-
rows={3}
|
|
162
|
-
/>
|
|
163
|
-
</div>
|
|
164
|
-
<div className="flex justify-end gap-2">
|
|
165
|
-
<Button type="button" variant="outline" onClick={() => setOpen(false)}>
|
|
166
|
-
{t("links.cancel")}
|
|
167
|
-
</Button>
|
|
168
|
-
<Button type="submit">{t(editingLink ? "links.update" : "links.add")}</Button>
|
|
169
|
-
</div>
|
|
170
|
-
</form>
|
|
171
|
-
</DialogContent>
|
|
172
|
-
</Dialog>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
{data.length > 0 ? (
|
|
176
|
-
<div className="space-y-2">
|
|
177
|
-
{data.map((link) => (
|
|
178
|
-
<div
|
|
179
|
-
key={link.id}
|
|
180
|
-
className="flex items-start justify-between p-3 bg-muted rounded-md"
|
|
181
|
-
>
|
|
182
|
-
<div className="flex-1 min-w-0">
|
|
183
|
-
<div className="flex items-center gap-2 mb-1">
|
|
184
|
-
<ExternalLink className="h-4 w-4 text-muted-foreground shrink-0" />
|
|
185
|
-
{link.title ? (
|
|
186
|
-
<span className="text-sm font-medium truncate">{link.title}</span>
|
|
187
|
-
) : (
|
|
188
|
-
<a
|
|
189
|
-
href={link.url}
|
|
190
|
-
target="_blank"
|
|
191
|
-
rel="noopener noreferrer"
|
|
192
|
-
className="text-sm truncate hover:underline"
|
|
193
|
-
>
|
|
194
|
-
{link.url}
|
|
195
|
-
</a>
|
|
196
|
-
)}
|
|
197
|
-
</div>
|
|
198
|
-
{link.description && (
|
|
199
|
-
<p className="text-sm text-muted-foreground truncate">{link.description}</p>
|
|
200
|
-
)}
|
|
201
|
-
{!link.title && (
|
|
202
|
-
<a
|
|
203
|
-
href={link.url}
|
|
204
|
-
target="_blank"
|
|
205
|
-
rel="noopener noreferrer"
|
|
206
|
-
className="text-xs text-muted-foreground truncate block"
|
|
207
|
-
>
|
|
208
|
-
{link.url}
|
|
209
|
-
</a>
|
|
210
|
-
)}
|
|
211
|
-
</div>
|
|
212
|
-
<div className="flex items-center gap-1 ml-2">
|
|
213
|
-
<Button
|
|
214
|
-
type="button"
|
|
215
|
-
variant="ghost"
|
|
216
|
-
size="icon"
|
|
217
|
-
onClick={() => handleOpenEdit(link)}
|
|
218
|
-
>
|
|
219
|
-
<Edit2 className="h-4 w-4" />
|
|
220
|
-
</Button>
|
|
221
|
-
<Button
|
|
222
|
-
type="button"
|
|
223
|
-
variant="ghost"
|
|
224
|
-
size="icon"
|
|
225
|
-
onClick={() => handleRemove(link.id)}
|
|
226
|
-
>
|
|
227
|
-
<Trash2 className="h-4 w-4" />
|
|
228
|
-
</Button>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
))}
|
|
232
|
-
</div>
|
|
233
|
-
) : (
|
|
234
|
-
<div className="text-sm text-muted-foreground text-center py-4">
|
|
235
|
-
{t("links.empty")}
|
|
236
|
-
</div>
|
|
237
|
-
)}
|
|
238
|
-
</div>
|
|
239
|
-
);
|
|
240
|
-
}
|
package/src/lib/project-mock.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
ClipboardList,
|
|
20
|
-
Package2,
|
|
21
|
-
Palette,
|
|
22
|
-
FlaskConical,
|
|
23
|
-
Bug,
|
|
24
|
-
CircleCheckBig,
|
|
25
|
-
} from "lucide-react";
|
|
26
|
-
import type {
|
|
27
|
-
ProjectModuleKey,
|
|
28
|
-
ProjectModuleOverview,
|
|
29
|
-
ProjectModuleItem,
|
|
30
|
-
} from "@/types/project";
|
|
31
|
-
|
|
32
|
-
// 6 个板块元数据(key 与路由 $module 对应)
|
|
33
|
-
export const PROJECT_MODULE_META: Record<
|
|
34
|
-
ProjectModuleKey,
|
|
35
|
-
Omit<ProjectModuleOverview, "count" | "lastUpdatedAt" | "link">
|
|
36
|
-
> = {
|
|
37
|
-
requirement: {
|
|
38
|
-
key: "requirement",
|
|
39
|
-
title: "需求",
|
|
40
|
-
description: "收集与跟踪产品需求池",
|
|
41
|
-
icon: ClipboardList,
|
|
42
|
-
},
|
|
43
|
-
prd: {
|
|
44
|
-
key: "prd",
|
|
45
|
-
title: "PRD",
|
|
46
|
-
description: "产品需求文档与原型画板",
|
|
47
|
-
icon: Package2,
|
|
48
|
-
},
|
|
49
|
-
design: {
|
|
50
|
-
key: "design",
|
|
51
|
-
title: "设计",
|
|
52
|
-
description: "UI 设计稿与画板资源",
|
|
53
|
-
icon: Palette,
|
|
54
|
-
},
|
|
55
|
-
testcase: {
|
|
56
|
-
key: "testcase",
|
|
57
|
-
title: "测例",
|
|
58
|
-
description: "测试用例与执行计划",
|
|
59
|
-
icon: FlaskConical,
|
|
60
|
-
},
|
|
61
|
-
bug: {
|
|
62
|
-
key: "bug",
|
|
63
|
-
title: "BUG",
|
|
64
|
-
description: "缺陷跟踪与修复进度",
|
|
65
|
-
icon: Bug,
|
|
66
|
-
},
|
|
67
|
-
acceptance: {
|
|
68
|
-
key: "acceptance",
|
|
69
|
-
title: "验收",
|
|
70
|
-
description: "交付验收与上线检查",
|
|
71
|
-
icon: CircleCheckBig,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const PROJECT_MODULE_KEYS = Object.keys(
|
|
76
|
-
PROJECT_MODULE_META,
|
|
77
|
-
) as ProjectModuleKey[];
|
|
78
|
-
|
|
79
|
-
// 生成 mock 板块概览(根据 projectId 稳定生成数量)
|
|
80
|
-
export function buildModuleOverview(projectId: string): ProjectModuleOverview[] {
|
|
81
|
-
const seed = projectId.charCodeAt(0) + projectId.length;
|
|
82
|
-
return PROJECT_MODULE_KEYS.map((key, idx) => {
|
|
83
|
-
const meta = PROJECT_MODULE_META[key];
|
|
84
|
-
const count = (seed + idx * 7) % 40;
|
|
85
|
-
const daysAgo = (seed + idx * 3) % 30;
|
|
86
|
-
const lastUpdatedAt = new Date(Date.now() - daysAgo * 86400000);
|
|
87
|
-
return {
|
|
88
|
-
...meta,
|
|
89
|
-
count,
|
|
90
|
-
lastUpdatedAt,
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// 板块状态与优先级(mock 文案池)
|
|
96
|
-
const STATUSES = ["待处理", "进行中", "已完成", "已验收", "已关闭"];
|
|
97
|
-
const PRIORITIES = ["高", "中", "高", "中", "低"];
|
|
98
|
-
const ASSIGNEES = ["张明", "李华", "王芳", "赵磊", "陈静", "刘洋"];
|
|
99
|
-
const TITLES: Record<ProjectModuleKey, string[]> = {
|
|
100
|
-
requirement: [
|
|
101
|
-
"用户登录优化",
|
|
102
|
-
"支付流程改造",
|
|
103
|
-
"首页性能提升",
|
|
104
|
-
"消息中心重构",
|
|
105
|
-
"数据看板新增",
|
|
106
|
-
"权限体系完善",
|
|
107
|
-
],
|
|
108
|
-
prd: [
|
|
109
|
-
"登录注册 PRD v2",
|
|
110
|
-
"支付系统 PRD",
|
|
111
|
-
"首页改版 PRD",
|
|
112
|
-
"消息中心 PRD",
|
|
113
|
-
],
|
|
114
|
-
design: [
|
|
115
|
-
"首页视觉稿",
|
|
116
|
-
"支付页设计",
|
|
117
|
-
"个人中心 UI",
|
|
118
|
-
"引导页插画",
|
|
119
|
-
"图标库更新",
|
|
120
|
-
],
|
|
121
|
-
testcase: [
|
|
122
|
-
"登录用例集",
|
|
123
|
-
"支付回归用例",
|
|
124
|
-
"首页兼容性用例",
|
|
125
|
-
"性能压测用例",
|
|
126
|
-
"权限用例",
|
|
127
|
-
],
|
|
128
|
-
bug: [
|
|
129
|
-
"iOS 16 输入框错位",
|
|
130
|
-
"支付偶发失败",
|
|
131
|
-
"列表滑动卡顿",
|
|
132
|
-
"深色模式样式异常",
|
|
133
|
-
],
|
|
134
|
-
acceptance: [
|
|
135
|
-
"v2.1 版本验收",
|
|
136
|
-
"支付模块验收",
|
|
137
|
-
"性能优化验收",
|
|
138
|
-
],
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// 根据 projectId + module 生成稳定的 mock 列表
|
|
142
|
-
export function listModuleItems(
|
|
143
|
-
projectId: string,
|
|
144
|
-
module: ProjectModuleKey,
|
|
145
|
-
): ProjectModuleItem[] {
|
|
146
|
-
const titles = TITLES[module];
|
|
147
|
-
const seed = projectId.charCodeAt(0) + module.charCodeAt(0);
|
|
148
|
-
return titles.map((title, idx) => ({
|
|
149
|
-
id: `${projectId}-${module}-${idx}`,
|
|
150
|
-
title,
|
|
151
|
-
status: STATUSES[(seed + idx) % STATUSES.length],
|
|
152
|
-
priority: PRIORITIES[(seed + idx) % PRIORITIES.length],
|
|
153
|
-
assignee: ASSIGNEES[(seed + idx) % ASSIGNEES.length],
|
|
154
|
-
updatedAt: new Date(Date.now() - ((seed + idx * 2) % 30) * 86400000),
|
|
155
|
-
}));
|
|
156
|
-
}
|