@allbluecn/web-app 0.4.22 → 0.5.1

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.
Files changed (99) hide show
  1. package/package.json +12 -8
  2. package/src/components/knowledge/knowledge-toolbar.tsx +124 -1
  3. package/src/components/layout/sidebar-03/app-sidebar.tsx +3 -4
  4. package/src/components/layout/sidebar-03/nav-notifications.tsx +135 -52
  5. package/src/components/layout/sidebar-03/user-menu.tsx +4 -2
  6. package/src/components/notifications/settings-notifications.tsx +198 -0
  7. package/src/components/notifications/team-notifications.tsx +343 -0
  8. package/src/components/settings/personal-team/team/team-client.tsx +51 -12
  9. package/src/components/settings/personal-team/team/team-invitations.tsx +181 -181
  10. package/src/components/shared/wave-physics-loader.tsx +155 -0
  11. package/src/components/story/__tests__/dependency-type-badge.test.ts +89 -0
  12. package/src/components/story/constants.ts +124 -51
  13. package/src/components/story/create-story-dialog.tsx +12 -6
  14. package/src/components/story/detail/__tests__/associated-attachments-panel.test.tsx +114 -0
  15. package/src/components/story/detail/activity-timeline.tsx +15 -0
  16. package/src/components/story/detail/story-detail-body.tsx +14 -3
  17. package/src/components/story/detail/story-detail-toolbar/associated-attachments-panel.tsx +748 -0
  18. package/src/components/story/detail/story-detail-toolbar/categories.tsx +23 -18
  19. package/src/components/story/detail/story-detail-toolbar/children.tsx +51 -274
  20. package/src/components/story/detail/story-detail-toolbar/dependencies.tsx +13 -45
  21. package/src/components/story/detail/story-detail-toolbar/dependency-panel.tsx +473 -0
  22. package/src/components/story/detail/story-detail-toolbar.tsx +237 -10
  23. package/src/components/story/display/__tests__/use-paged-story-groups.test.ts +152 -1
  24. package/src/components/story/display/use-paged-story-groups.ts +370 -28
  25. package/src/components/story/inline-editors/story-select-dialog.tsx +107 -16
  26. package/src/components/story/peek-panel.tsx +8 -1
  27. package/src/components/story/relations/__tests__/attachment-manage-dialog.test.tsx +171 -0
  28. package/src/components/story/relations/__tests__/knowledge-select-dialog.test.tsx +174 -0
  29. package/src/components/story/relations/__tests__/link-manage-dialog.test.tsx +93 -0
  30. package/src/components/story/relations/attachment-manage-dialog.tsx +490 -0
  31. package/src/components/story/relations/file-preview.tsx +173 -0
  32. package/src/components/story/relations/format.ts +120 -0
  33. package/src/{config/sidebar-notifications.ts → components/story/relations/general-groups.ts} +12 -30
  34. package/src/components/story/relations/knowledge-select-dialog.tsx +403 -0
  35. package/src/components/story/relations/link-manage-dialog.tsx +191 -0
  36. package/src/components/story/relations/story-ref-row.tsx +319 -0
  37. package/src/components/story/story-list-view.tsx +3 -1
  38. package/src/components/story/story-panel-header.tsx +4 -1
  39. package/src/components/story/types.ts +30 -18
  40. package/src/components/story/views/story-list/batch-toolbar.tsx +12 -1
  41. package/src/components/story/views/story-list/index.tsx +16 -5
  42. package/src/components/story/views/story-list/row.tsx +5 -4
  43. package/src/components/ui/separator.tsx +1 -1
  44. package/src/hooks/use-notifications.ts +4 -1
  45. package/src/lib/__tests__/datetime.test.ts +16 -1
  46. package/src/lib/changelog/sdk-versions.ts +19 -19
  47. package/src/lib/datetime.ts +1 -0
  48. package/src/lib/story/__tests__/video-embed.test.ts +77 -0
  49. package/src/lib/story/video-embed.ts +59 -0
  50. package/src/routeTree.gen.ts +65 -0
  51. package/src/routes/_nav/notifications/route.lazy.tsx +22 -0
  52. package/src/routes/_nav/notifications/route.tsx +30 -0
  53. package/src/routes/_nav/projects/$projectId/settings/route.lazy.tsx +74 -3
  54. package/src/routes/_nav/projects/$projectId/settings/route.tsx +6 -2
  55. package/src/routes/_nav/settings/notifications/route.lazy.tsx +6 -5
  56. package/src/routes/api/attachments/$id/content.ts +60 -0
  57. package/src/routes/api/attachments/upload.ts +148 -0
  58. package/src/routes/api/notifications/stream.ts +4 -0
  59. package/src/server/notifications/__tests__/notification-service.test.ts +189 -0
  60. package/src/server/notifications/notification-service.ts +137 -27
  61. package/src/server/serverFns/__tests__/project-kb.test.ts +147 -0
  62. package/src/server/serverFns/__tests__/team-invitation.test.ts +73 -7
  63. package/src/server/serverFns/__tests__/team-join-request.test.ts +5 -3
  64. package/src/server/serverFns/knowledge.ts +50 -4
  65. package/src/server/serverFns/locale.ts +15 -3
  66. package/src/server/serverFns/notifications.ts +18 -4
  67. package/src/server/serverFns/project.ts +43 -0
  68. package/src/server/serverFns/story/__tests__/kb-scope.test.ts +56 -0
  69. package/src/server/serverFns/story/__tests__/story-assoc.test.ts +222 -0
  70. package/src/server/serverFns/story/__tests__/story-dependencies.test.ts +265 -0
  71. package/src/server/serverFns/story/__tests__/story-groups.test.ts +19 -1
  72. package/src/server/serverFns/story/index.ts +7 -6
  73. package/src/server/serverFns/story/kb-general.ts +39 -0
  74. package/src/server/serverFns/story/kb-scope.ts +52 -0
  75. package/src/server/serverFns/story/link-preview.ts +115 -0
  76. package/src/server/serverFns/story/story-assoc.ts +339 -50
  77. package/src/server/serverFns/story/story-attachments.ts +12 -43
  78. package/src/server/serverFns/story/story-crud.ts +21 -4
  79. package/src/server/serverFns/story/story-dependencies.ts +138 -162
  80. package/src/server/serverFns/story/story-groups.ts +23 -3
  81. package/src/server/serverFns/story/story-links.ts +13 -1
  82. package/src/server/serverFns/story/story-transfer.ts +5 -3
  83. package/src/server/serverFns/story/story-tree.ts +28 -1
  84. package/src/server/serverFns/story/types.ts +37 -0
  85. package/src/server/serverFns/team.ts +51 -2
  86. package/src/styles/globals.css +25 -0
  87. package/vite.shared.ts +2 -0
  88. package/src/components/notifications/notification-list.tsx +0 -232
  89. package/src/components/notifications/notification-preferences.tsx +0 -156
  90. package/src/components/story/detail/story-detail-toolbar/attachments.tsx +0 -73
  91. package/src/components/story/detail/story-detail-toolbar/knowledge.tsx +0 -73
  92. package/src/components/story/detail/story-detail-toolbar/links.tsx +0 -73
  93. package/src/components/story/relation-badge.tsx +0 -57
  94. package/src/components/story/relations/attachments-panel.tsx +0 -179
  95. package/src/components/story/relations/dependency-panel.tsx +0 -190
  96. package/src/components/story/relations/hierarchy-panel.tsx +0 -180
  97. package/src/components/story/relations/knowledge-panel.tsx +0 -284
  98. package/src/components/story/relations/links-panel.tsx +0 -240
  99. package/src/components/story/relations/tab.tsx +0 -212
@@ -1,212 +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 { useTranslation } from "react-i18next";
20
- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
21
- import { RELATIONS_ACCORDION_ITEMS } from "../constants";
22
- import { HierarchyPanel } from "./hierarchy-panel";
23
- import { DependencyPanel } from "./dependency-panel";
24
- import { LinksPanel } from "./links-panel";
25
- import { AttachmentsPanel } from "./attachments-panel";
26
- import { KnowledgePanel } from "./knowledge-panel";
27
- import { type RelationsData } from "../types";
28
- import {
29
- listChildStoriesFn,
30
- getDependenciesFn,
31
- getLinksFn,
32
- getAttachmentsFn,
33
- getLinkedPrdsFn,
34
- getLinkedDocsFn,
35
- } from "@/server/serverFns/story";
36
- import { toast } from "sonner";
37
-
38
- export interface RelationsTabProps {
39
- storyId: string;
40
- initialData?: RelationsData;
41
- }
42
-
43
- export function RelationsTab({ storyId, initialData }: RelationsTabProps) {
44
- const { t } = useTranslation("story");
45
- const [data, setData] = React.useState<RelationsData>(
46
- initialData || {
47
- hierarchy: { parent: null, children: [], hasChildren: false },
48
- dependencies: { blocking: [], blockedBy: [], relatesTo: [] },
49
- links: [],
50
- attachments: [],
51
- knowledge: { prds: [], docs: [] },
52
- }
53
- );
54
- const [loading, setLoading] = React.useState(false);
55
-
56
- const refreshAll = React.useCallback(async () => {
57
- setLoading(true);
58
- try {
59
- const [childrenStories, deps, links, attachments, prds, docs] = await Promise.all([
60
- listChildStoriesFn({ data: { parentId: storyId } }),
61
- getDependenciesFn({ data: { storyId } }),
62
- getLinksFn({ data: { storyId } }),
63
- getAttachmentsFn({ data: { storyId } }),
64
- getLinkedPrdsFn({ data: { storyId } }),
65
- getLinkedDocsFn({ data: { storyId } }),
66
- ]);
67
-
68
- setData({
69
- hierarchy: {
70
- parent: null,
71
- children: childrenStories,
72
- hasChildren: childrenStories.length > 0,
73
- },
74
- dependencies: deps as RelationsData["dependencies"],
75
- links,
76
- attachments,
77
- knowledge: {
78
- prds,
79
- docs,
80
- },
81
- });
82
- } catch (error) {
83
- console.error(t("relationsTab.refreshFailed"), error);
84
- toast.error(t("relationsTab.refreshFailed"));
85
- } finally {
86
- setLoading(false);
87
- }
88
- }, [storyId]);
89
-
90
- React.useEffect(() => {
91
- if (!initialData) {
92
- refreshAll();
93
- }
94
- }, [initialData, refreshAll]);
95
-
96
- const updateHierarchy = React.useCallback(
97
- (updates: Partial<RelationsData["hierarchy"]>) => {
98
- setData((prev) => ({
99
- ...prev,
100
- hierarchy: { ...prev.hierarchy, ...updates },
101
- }));
102
- },
103
- []
104
- );
105
-
106
- const updateDependencies = React.useCallback(
107
- (updates: Partial<RelationsData["dependencies"]>) => {
108
- setData((prev) => ({
109
- ...prev,
110
- dependencies: { ...prev.dependencies, ...updates },
111
- }));
112
- },
113
- []
114
- );
115
-
116
- const updateLinks = React.useCallback(
117
- (newLinks: RelationsData["links"]) => {
118
- setData((prev) => ({ ...prev, links: newLinks }));
119
- },
120
- []
121
- );
122
-
123
- const updateAttachments = React.useCallback(
124
- (newAttachments: RelationsData["attachments"]) => {
125
- setData((prev) => ({ ...prev, attachments: newAttachments }));
126
- },
127
- []
128
- );
129
-
130
- const updateKnowledge = React.useCallback(
131
- (updates: Partial<RelationsData["knowledge"]>) => {
132
- setData((prev) => ({
133
- ...prev,
134
- knowledge: { ...prev.knowledge, ...updates },
135
- }));
136
- },
137
- []
138
- );
139
-
140
- return (
141
- <div className="space-y-4">
142
- <div className="flex items-center justify-between">
143
- <h3 className="text-lg font-semibold">{t("relationsTab.title")}</h3>
144
- <button
145
- type="button"
146
- onClick={refreshAll}
147
- disabled={loading}
148
- className="text-sm text-muted-foreground hover:text-foreground disabled:opacity-50"
149
- >
150
- {t(loading ? "relationsTab.refreshing" : "relationsTab.refresh")}
151
- </button>
152
- </div>
153
-
154
- <Accordion type="multiple" defaultValue={Object.values(RELATIONS_ACCORDION_ITEMS)} className="w-full">
155
- <AccordionItem value={RELATIONS_ACCORDION_ITEMS.HIERARCHY}>
156
- <AccordionTrigger>{t("relationsTab.hierarchy")}</AccordionTrigger>
157
- <AccordionContent>
158
- <HierarchyPanel
159
- storyId={storyId}
160
- data={data.hierarchy}
161
- onUpdate={updateHierarchy}
162
- />
163
- </AccordionContent>
164
- </AccordionItem>
165
-
166
- <AccordionItem value={RELATIONS_ACCORDION_ITEMS.DEPENDENCIES}>
167
- <AccordionTrigger>{t("relationsTab.dependencies")}</AccordionTrigger>
168
- <AccordionContent>
169
- <DependencyPanel
170
- storyId={storyId}
171
- data={data.dependencies}
172
- onUpdate={updateDependencies}
173
- />
174
- </AccordionContent>
175
- </AccordionItem>
176
-
177
- <AccordionItem value={RELATIONS_ACCORDION_ITEMS.LINKS}>
178
- <AccordionTrigger>{t("relationsTab.links")}</AccordionTrigger>
179
- <AccordionContent>
180
- <LinksPanel
181
- storyId={storyId}
182
- data={data.links}
183
- onUpdate={updateLinks}
184
- />
185
- </AccordionContent>
186
- </AccordionItem>
187
-
188
- <AccordionItem value={RELATIONS_ACCORDION_ITEMS.ATTACHMENTS}>
189
- <AccordionTrigger>{t("relationsTab.attachments")}</AccordionTrigger>
190
- <AccordionContent>
191
- <AttachmentsPanel
192
- storyId={storyId}
193
- data={data.attachments}
194
- onUpdate={updateAttachments}
195
- />
196
- </AccordionContent>
197
- </AccordionItem>
198
-
199
- <AccordionItem value={RELATIONS_ACCORDION_ITEMS.KNOWLEDGE}>
200
- <AccordionTrigger>{t("relationsTab.knowledge")}</AccordionTrigger>
201
- <AccordionContent>
202
- <KnowledgePanel
203
- storyId={storyId}
204
- data={data.knowledge}
205
- onUpdate={updateKnowledge}
206
- />
207
- </AccordionContent>
208
- </AccordionItem>
209
- </Accordion>
210
- </div>
211
- );
212
- }