@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,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
- }