@burdenoff/microfe-workspaces 2026.1120.1 → 2026.1123.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.
- package/dist/WorkspacesRoot.js +39 -31
- package/dist/WorkspacesRoutes.js +91 -59
- package/dist/components/ProjectCard.js +48 -47
- package/dist/constants/navigationV2.d.ts +5 -0
- package/dist/constants/navigationV2.js +2 -2
- package/dist/generated/global-operations.d.ts +11 -1
- package/dist/generated/global-types.d.ts +9866 -574
- package/dist/generated/wspace-operations.d.ts +631 -2
- package/dist/generated/wspace-operations.js +5428 -1376
- package/dist/generated/wspace-types.d.ts +200319 -48046
- package/dist/generated/wspace-types.js +19 -0
- package/dist/hooks/useCollaboration.d.ts +143 -0
- package/dist/hooks/useCollaboration.js +119 -0
- package/dist/hooks/useCollaborationMutations.d.ts +177 -0
- package/dist/hooks/useCollaborationMutations.js +126 -0
- package/dist/hooks/v2/useWorkspacePagesV2Data.d.ts +89 -0
- package/dist/hooks/v2/useWorkspacePagesV2Data.js +211 -0
- package/dist/index.d.ts +1 -1
- package/dist/node_modules/sonner/dist/index.js +167 -0
- package/dist/pages/CollaborationConsolePage.d.ts +1 -0
- package/dist/pages/CollaborationConsolePage.js +1059 -0
- package/dist/pages/MembersListPage.js +101 -100
- package/dist/pages/ProjectMembersPage.js +116 -115
- package/dist/pages/ProjectsListPage.js +233 -232
- package/dist/pages/WorkspacesListPage.js +79 -68
- package/dist/pages/v2/ActivityPage.d.ts +1 -0
- package/dist/pages/v2/ActivityPage.js +150 -0
- package/dist/pages/v2/InvitePeopleDialog.d.ts +11 -0
- package/dist/pages/v2/InvitePeopleDialog.js +208 -0
- package/dist/pages/v2/InvitedTab.d.ts +9 -0
- package/dist/pages/v2/InvitedTab.js +223 -0
- package/dist/pages/v2/MembersPage.d.ts +1 -0
- package/dist/pages/v2/MembersPage.js +120 -0
- package/dist/pages/v2/PeopleTab.d.ts +20 -0
- package/dist/pages/v2/PeopleTab.js +253 -0
- package/dist/pages/v2/ProjectsPage.d.ts +1 -0
- package/dist/pages/v2/ProjectsPage.js +242 -0
- package/dist/pages/v2/WorkspacesPage.d.ts +3 -0
- package/dist/pages/v2/WorkspacesPage.js +247 -0
- package/dist/pages/v2/activitySentences.d.ts +50 -0
- package/dist/pages/v2/activitySentences.js +288 -0
- package/dist/pages/v2/inviteEmails.d.ts +12 -0
- package/dist/pages/v2/inviteEmails.js +18 -0
- package/dist/pages/v2/memberRows.d.ts +54 -0
- package/dist/pages/v2/memberRows.js +51 -0
- package/dist/pages/v2/projectRows.d.ts +10 -0
- package/dist/pages/v2/projectRows.js +10 -0
- package/dist/pages/v2/relativeTime.d.ts +6 -0
- package/dist/pages/v2/relativeTime.js +30 -0
- package/dist/store/workspacesStore.d.ts +2 -1
- package/dist/store/workspacesStore.js +1 -1
- package/dist/translations/en.d.ts +436 -0
- package/dist/translations/en.js +436 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/utils/nativeBridge.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
|
|
2
|
+
import { useWorkspacesStore as t } from "../../store/workspacesStore.js";
|
|
3
|
+
import { useWorkspacePermissions as n } from "../../hooks/useWorkspacePermissions.js";
|
|
4
|
+
import { useWorkspacesPageView as r } from "../../hooks/useWorkspacesPageView.js";
|
|
5
|
+
import { useScopedNavigation as i } from "../../hooks/useScopedNavigation.js";
|
|
6
|
+
import { useArchiveProject as a, useDeleteProject as o, useUnarchiveProject as s } from "../../hooks/useProjectMutations.js";
|
|
7
|
+
import { useTr as c } from "../../hooks/useTr.js";
|
|
8
|
+
import { useMyProjectsWithDetails as l } from "../../hooks/v2/useWorkspacePagesV2Data.js";
|
|
9
|
+
import { CreateProjectDialog as u } from "../../components/CreateProjectDialog.js";
|
|
10
|
+
import { RenameProjectDialog as d } from "../../components/RenameProjectDialog.js";
|
|
11
|
+
import { nativeImpact as f } from "../../utils/nativeBridge.js";
|
|
12
|
+
import { PROJECT_STATE_CHIP as p, projectState as m } from "./projectRows.js";
|
|
13
|
+
import { relativeTime as h } from "./relativeTime.js";
|
|
14
|
+
import { useCallback as g, useMemo as _, useState as v } from "react";
|
|
15
|
+
import { Archive as y, ArchiveRestore as b, FolderKanban as x, Pencil as S, Plus as C, SquareArrowOutUpRight as w, Trash2 as T } from "lucide-react";
|
|
16
|
+
import { Button as E, EmptyState as D, IconTile as O, ListPager as ee, ListToolbar as te, ListView as k, LockedButton as ne, Notice as re, RichCard as A, RichCardGrid as ie, StatusChip as j, WorkspacePage as M, countFilterOptions as ae, filterList as oe, pageSlice as se, sortList as ce, useConfirm as N, useListState as le } from "@burdenoff/fe-libs/ui";
|
|
17
|
+
import { jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
18
|
+
import { useI18n as I } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
19
|
+
import { useNavigate as ue, useParams as L, useSearchParams as R } from "react-router";
|
|
20
|
+
import { PageHeader as z } from "@burdenoff/fe-libs/chrome";
|
|
21
|
+
import { useActorProfiles as B } from "@burdenoff/fe-libs/shared";
|
|
22
|
+
// src/pages/v2/ProjectsPage.tsx
|
|
23
|
+
function V(e, { canUpdate: t, canArchive: n, canDelete: r }, i) {
|
|
24
|
+
let a = c(), o = m(e) === "archived", s = a("workspacePagesV2.projects.locked", "Only workspace admins and the project’s managers can change projects.");
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
id: "open",
|
|
28
|
+
label: a("workspacePagesV2.projects.open", "Open"),
|
|
29
|
+
icon: w,
|
|
30
|
+
onSelect: i.open
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "rename",
|
|
34
|
+
label: a("workspacePagesV2.projects.rename", "Rename"),
|
|
35
|
+
icon: S,
|
|
36
|
+
locked: !t,
|
|
37
|
+
lockedReason: s,
|
|
38
|
+
onSelect: i.rename
|
|
39
|
+
},
|
|
40
|
+
o ? {
|
|
41
|
+
id: "restore",
|
|
42
|
+
label: a("workspacePagesV2.projects.restore", "Restore"),
|
|
43
|
+
icon: b,
|
|
44
|
+
locked: !n,
|
|
45
|
+
lockedReason: s,
|
|
46
|
+
onSelect: i.restore
|
|
47
|
+
} : {
|
|
48
|
+
id: "archive",
|
|
49
|
+
label: a("workspacePagesV2.projects.archive", "Archive"),
|
|
50
|
+
icon: y,
|
|
51
|
+
locked: !n,
|
|
52
|
+
lockedReason: s,
|
|
53
|
+
onSelect: i.archive
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "delete",
|
|
57
|
+
label: a("workspacePagesV2.projects.delete", "Delete project…"),
|
|
58
|
+
icon: T,
|
|
59
|
+
danger: !0,
|
|
60
|
+
separatorBefore: !0,
|
|
61
|
+
locked: !r,
|
|
62
|
+
lockedReason: s,
|
|
63
|
+
onSelect: i.remove
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
function H({ project: e, creator: t, now: n, permissions: r, onOpen: i, onRename: l, onError: u }) {
|
|
68
|
+
let d = c(), { locale: g } = I(), _ = N(), { mutateAsync: v } = a(e.workspaceId), { mutateAsync: y } = s(e.workspaceId), { mutateAsync: b } = o(e.workspaceId), S = m(e), C = (e, t) => {
|
|
69
|
+
e().catch((e) => u(e instanceof Error && e.message ? e.message : t));
|
|
70
|
+
}, w = async () => {
|
|
71
|
+
f("medium"), await _({
|
|
72
|
+
title: d("workspacePagesV2.projects.deleteTitle", "Delete {{name}}?", { name: e.name }),
|
|
73
|
+
description: d("workspacePagesV2.projects.deleteDescription", "Everything in the project is removed for good, for everyone in it."),
|
|
74
|
+
consequences: [d("workspacePagesV2.projects.deleteUndo", "This can’t be undone")],
|
|
75
|
+
tone: "danger",
|
|
76
|
+
confirmLabel: d("workspacePagesV2.projects.deleteConfirm", "Delete project"),
|
|
77
|
+
typeToConfirm: e.name
|
|
78
|
+
}) && C(() => b(e.id), d("workspacePagesV2.projects.deleteFailed", "Couldn’t delete the project. Try again."));
|
|
79
|
+
}, T = V(e, r, {
|
|
80
|
+
open: i,
|
|
81
|
+
rename: l,
|
|
82
|
+
archive: () => C(() => v(e.id), d("workspacePagesV2.projects.archiveFailed", "Couldn’t archive the project. Try again.")),
|
|
83
|
+
restore: () => C(() => y(e.id), d("workspacePagesV2.projects.restoreFailed", "Couldn’t restore the project. Try again.")),
|
|
84
|
+
remove: () => void w()
|
|
85
|
+
}), E = {
|
|
86
|
+
active: d("workspacePagesV2.projects.active", "Active"),
|
|
87
|
+
paused: d("workspacePagesV2.projects.paused", "Paused"),
|
|
88
|
+
archived: d("workspacePagesV2.projects.archived", "Archived")
|
|
89
|
+
}, D = h(e.updatedAt, n, g);
|
|
90
|
+
return /* @__PURE__ */ P(A, {
|
|
91
|
+
media: /* @__PURE__ */ P(O, {
|
|
92
|
+
size: "md",
|
|
93
|
+
className: S === "active" ? void 0 : "bg-bg-sunken text-text-secondary",
|
|
94
|
+
children: /* @__PURE__ */ P(x, { "aria-hidden": "true" })
|
|
95
|
+
}),
|
|
96
|
+
title: e.name,
|
|
97
|
+
onOpen: i,
|
|
98
|
+
subtitle: t ? d("workspacePagesV2.projects.createdBy", "Created by {{name}}", { name: t }) : void 0,
|
|
99
|
+
menu: T,
|
|
100
|
+
menuLabel: d("workspacePagesV2.projects.actionsFor", "Actions for {{name}}", { name: e.name }),
|
|
101
|
+
description: e.description?.trim() || void 0,
|
|
102
|
+
footer: /* @__PURE__ */ P(j, {
|
|
103
|
+
status: p[S],
|
|
104
|
+
children: E[S]
|
|
105
|
+
}),
|
|
106
|
+
actions: D ? /* @__PURE__ */ P("span", {
|
|
107
|
+
className: "text-xs text-text-secondary",
|
|
108
|
+
children: d("workspacePagesV2.projects.changed", "Changed {{when}}", { when: D })
|
|
109
|
+
}) : void 0
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function U() {
|
|
113
|
+
let a = c(), o = ue(), { basePath: s = "/workspaces", workspaceId: f, authToken: p, organizationId: h } = e(), { withCurrentSearch: y } = i(), { workspaceId: b } = L(), x = b || f;
|
|
114
|
+
r("workspaces.projects", {
|
|
115
|
+
workspaceId: x,
|
|
116
|
+
requireParams: !0
|
|
117
|
+
});
|
|
118
|
+
let { openCreateProjectDialog: S, isCreateProjectDialogOpen: w } = t(), { canCreateProject: T, canUpdateProject: O, canArchiveProject: A, canDeleteProject: j, isLoading: N } = n(), I = l(), [V] = v(() => /* @__PURE__ */ new Date()), [U, W] = v(null), [G, de] = v(null), K = le({
|
|
119
|
+
filters: ["status"],
|
|
120
|
+
sorts: ["recent", "name"],
|
|
121
|
+
url: R()
|
|
122
|
+
}), q = _(() => (I.data ?? []).filter((e) => !x || e.workspaceId === x), [I.data, x]), fe = _(() => [...new Set(q.map((e) => e.creatorId).filter(Boolean))].map((e) => ({
|
|
123
|
+
actorId: e,
|
|
124
|
+
actorType: "user"
|
|
125
|
+
})), [q]), J = B(fe, {
|
|
126
|
+
authToken: p || void 0,
|
|
127
|
+
orgId: h,
|
|
128
|
+
workspaceId: x
|
|
129
|
+
}), Y = g((e) => {
|
|
130
|
+
let t = J[e.creatorId];
|
|
131
|
+
return t?.resolved ? t.displayName : null;
|
|
132
|
+
}, [J]), X = _(() => ({
|
|
133
|
+
id: "status",
|
|
134
|
+
label: a("workspacePagesV2.projects.statusFilter", "Status"),
|
|
135
|
+
allLabel: a("workspacePagesV2.common.any", "Any"),
|
|
136
|
+
options: [
|
|
137
|
+
{
|
|
138
|
+
value: "active",
|
|
139
|
+
label: a("workspacePagesV2.projects.active", "Active")
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: "paused",
|
|
143
|
+
label: a("workspacePagesV2.projects.paused", "Paused")
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
value: "archived",
|
|
147
|
+
label: a("workspacePagesV2.projects.archived", "Archived")
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
getValue: (e) => m(e)
|
|
151
|
+
}), [a]), Z = _(() => [{
|
|
152
|
+
value: "recent",
|
|
153
|
+
label: a("workspacePagesV2.projects.sortRecent", "Recently changed"),
|
|
154
|
+
compare: (e, t) => t.updatedAt.localeCompare(e.updatedAt)
|
|
155
|
+
}, {
|
|
156
|
+
value: "name",
|
|
157
|
+
label: a("workspacePagesV2.common.sortName", "Name A–Z"),
|
|
158
|
+
compare: (e, t) => e.name.localeCompare(t.name)
|
|
159
|
+
}], [a]), Q = _(() => ({
|
|
160
|
+
text: (e) => `${e.name} ${e.key} ${e.description ?? ""} ${Y(e) ?? ""}`,
|
|
161
|
+
filters: [X]
|
|
162
|
+
}), [Y, X]), $ = ce(oe(q, K, Q), K.sort, Z), pe = (e) => o(y(`${s}/${e.workspaceId}/projects/${e.id}`)), me = {
|
|
163
|
+
canUpdate: O,
|
|
164
|
+
canArchive: A,
|
|
165
|
+
canDelete: j
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ F(M, { children: [
|
|
168
|
+
/* @__PURE__ */ P(z, {
|
|
169
|
+
variant: "compact",
|
|
170
|
+
title: a("workspacePagesV2.projects.title", "Projects"),
|
|
171
|
+
description: a("workspacePagesV2.projects.purpose", "Groups of workflows and people inside this workspace."),
|
|
172
|
+
back: {
|
|
173
|
+
label: a("workspacePagesV2.workspaces.title", "Workspaces & invites"),
|
|
174
|
+
to: y(`${s}/list`),
|
|
175
|
+
phoneOnly: !0
|
|
176
|
+
},
|
|
177
|
+
primary: /* @__PURE__ */ P(ne, {
|
|
178
|
+
locked: !N && !T,
|
|
179
|
+
reason: a("workspacePagesV2.projects.createLocked", "Making projects is for workspace admins and managers. Ask an owner of this workspace."),
|
|
180
|
+
icon: C,
|
|
181
|
+
onClick: () => S(),
|
|
182
|
+
children: a("workspacePagesV2.projects.new", "New project")
|
|
183
|
+
})
|
|
184
|
+
}),
|
|
185
|
+
G ? /* @__PURE__ */ P(re, {
|
|
186
|
+
tone: "bad",
|
|
187
|
+
role: "alert",
|
|
188
|
+
children: G
|
|
189
|
+
}) : null,
|
|
190
|
+
/* @__PURE__ */ P(k, {
|
|
191
|
+
list: K,
|
|
192
|
+
count: $.length,
|
|
193
|
+
loading: I.isPending,
|
|
194
|
+
error: I.error,
|
|
195
|
+
onRetry: () => void I.refetch(),
|
|
196
|
+
errorTitle: a("workspacePagesV2.projects.loadFailed", "Couldn’t load the projects"),
|
|
197
|
+
errorDetails: I.error instanceof Error ? I.error.message : void 0,
|
|
198
|
+
summary: $.length === 1 ? a("workspacePagesV2.projects.countOne", "1 project") : a("workspacePagesV2.projects.count", "{{count}} projects", { count: $.length }),
|
|
199
|
+
toolbar: /* @__PURE__ */ P(te, {
|
|
200
|
+
list: K,
|
|
201
|
+
searchPlaceholder: a("workspacePagesV2.projects.search", "Search projects"),
|
|
202
|
+
filters: [{
|
|
203
|
+
...X,
|
|
204
|
+
options: ae(q, X, K, Q)
|
|
205
|
+
}],
|
|
206
|
+
sorts: Z
|
|
207
|
+
}),
|
|
208
|
+
pager: /* @__PURE__ */ P(ee, {
|
|
209
|
+
list: K,
|
|
210
|
+
total: $.length
|
|
211
|
+
}),
|
|
212
|
+
empty: /* @__PURE__ */ P(D, {
|
|
213
|
+
illustration: "box",
|
|
214
|
+
title: a("workspacePagesV2.projects.emptyTitle", "No projects yet"),
|
|
215
|
+
description: a("workspacePagesV2.projects.emptyDescription", "A project keeps a set of workflows and the people who work on them together, with its own access."),
|
|
216
|
+
action: T ? /* @__PURE__ */ F(E, {
|
|
217
|
+
type: "button",
|
|
218
|
+
onClick: () => S(),
|
|
219
|
+
children: [/* @__PURE__ */ P(C, { "aria-hidden": "true" }), a("workspacePagesV2.projects.new", "New project")]
|
|
220
|
+
}) : void 0
|
|
221
|
+
}),
|
|
222
|
+
children: /* @__PURE__ */ P(ie, { children: se($, K.page, K.pageSize).map((e) => /* @__PURE__ */ P(H, {
|
|
223
|
+
project: e,
|
|
224
|
+
creator: Y(e),
|
|
225
|
+
now: V,
|
|
226
|
+
permissions: me,
|
|
227
|
+
onOpen: () => pe(e),
|
|
228
|
+
onRename: () => W(e),
|
|
229
|
+
onError: de
|
|
230
|
+
}, e.id)) })
|
|
231
|
+
}),
|
|
232
|
+
w ? /* @__PURE__ */ P(u, { workspaceId: x }) : null,
|
|
233
|
+
U ? /* @__PURE__ */ P(d, {
|
|
234
|
+
project: U,
|
|
235
|
+
open: !0,
|
|
236
|
+
onOpenChange: (e) => {
|
|
237
|
+
e || W(null);
|
|
238
|
+
}
|
|
239
|
+
}) : null
|
|
240
|
+
] });
|
|
241
|
+
}
|
|
242
|
+
export { U as ProjectsPageV2 };
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
|
|
2
|
+
import { useMyWorkspaces as t } from "../../hooks/useWorkspaces.js";
|
|
3
|
+
import { useAllMyWorkspaces as n } from "../../hooks/v2/useWorkspacePagesV2Data.js";
|
|
4
|
+
import { commitWorkspaceSelection as r, useOpenWorkspace as i } from "../../hooks/useOpenWorkspace.js";
|
|
5
|
+
import { useWorkspacePermissions as a } from "../../hooks/useWorkspacePermissions.js";
|
|
6
|
+
import { useWorkspacesPageView as o } from "../../hooks/useWorkspacesPageView.js";
|
|
7
|
+
import { useScopedNavigation as s } from "../../hooks/useScopedNavigation.js";
|
|
8
|
+
import { useTr as c } from "../../hooks/useTr.js";
|
|
9
|
+
import { InvitePeopleDialog as l } from "./InvitePeopleDialog.js";
|
|
10
|
+
import { relativeTime as u } from "./relativeTime.js";
|
|
11
|
+
import { useCallback as d, useMemo as f, useState as p } from "react";
|
|
12
|
+
import { ArrowRightLeft as m, Building2 as h, Mail as g, Plus as _, Settings as v, SquareArrowOutUpRight as y, UserPlus as b } from "lucide-react";
|
|
13
|
+
import { Button as x, EmptyState as S, EntityAvatar as C, ListPager as w, ListToolbar as T, ListView as E, LockedButton as D, RichCard as O, RichCardGrid as k, StatusChip as A, WorkspacePage as j, filterList as M, pageSlice as N, useListState as P } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { useActiveContext as F, usePermissions as I } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
15
|
+
import { jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
16
|
+
import { useI18n as z } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
17
|
+
import { useNavigate as B, useSearchParams as V } from "react-router";
|
|
18
|
+
import { useQueryClient as H } from "@tanstack/react-query";
|
|
19
|
+
import { PageHeader as U, Tabs as W } from "@burdenoff/fe-libs/chrome";
|
|
20
|
+
var G = [
|
|
21
|
+
"q",
|
|
22
|
+
"page",
|
|
23
|
+
"inv_q",
|
|
24
|
+
"inv_page",
|
|
25
|
+
"inv_join"
|
|
26
|
+
];
|
|
27
|
+
function K(e, t) {
|
|
28
|
+
switch (e?.toUpperCase()) {
|
|
29
|
+
case "PERSONAL": return t("workspacePagesV2.workspaces.typePersonal", "Personal workspace");
|
|
30
|
+
case "ENTERPRISE": return t("workspacePagesV2.workspaces.typeEnterprise", "Enterprise workspace");
|
|
31
|
+
default: return t("workspacePagesV2.workspaces.typeTeam", "Team workspace");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function q({ workspace: e, current: t, yourRole: n, now: r, onOpen: i, onSwitch: a, onSettings: o }) {
|
|
35
|
+
let s = c(), { locale: l } = z(), d = u(e.createdAt, r, l), f = [{
|
|
36
|
+
id: "open",
|
|
37
|
+
label: s("workspacePagesV2.workspaces.openDetails", "Open details"),
|
|
38
|
+
icon: y,
|
|
39
|
+
onSelect: i
|
|
40
|
+
}, t ? {
|
|
41
|
+
id: "settings",
|
|
42
|
+
label: s("workspacePagesV2.workspaces.settings", "Settings"),
|
|
43
|
+
icon: v,
|
|
44
|
+
onSelect: o
|
|
45
|
+
} : {
|
|
46
|
+
id: "switch",
|
|
47
|
+
label: s("workspacePagesV2.workspaces.switch", "Switch to it"),
|
|
48
|
+
icon: m,
|
|
49
|
+
onSelect: a
|
|
50
|
+
}];
|
|
51
|
+
return /* @__PURE__ */ L(O, {
|
|
52
|
+
media: /* @__PURE__ */ L(C, {
|
|
53
|
+
name: e.name,
|
|
54
|
+
kind: "team",
|
|
55
|
+
size: 40
|
|
56
|
+
}),
|
|
57
|
+
title: e.name,
|
|
58
|
+
onOpen: i,
|
|
59
|
+
subtitle: t && n ? s("workspacePagesV2.workspaces.yourRole", "Your role: {{role}}", { role: n }) : K(e.type, s),
|
|
60
|
+
menu: f,
|
|
61
|
+
menuLabel: s("workspacePagesV2.workspaces.actionsFor", "Actions for {{name}}", { name: e.name }),
|
|
62
|
+
details: [{
|
|
63
|
+
label: s("workspacePagesV2.workspaces.people", "People"),
|
|
64
|
+
value: typeof e.memberCount == "number" ? e.memberCount : "—"
|
|
65
|
+
}, {
|
|
66
|
+
label: s("workspacePagesV2.workspaces.created", "Created"),
|
|
67
|
+
value: d ?? "—"
|
|
68
|
+
}],
|
|
69
|
+
footer: t ? /* @__PURE__ */ L(A, {
|
|
70
|
+
status: "accent",
|
|
71
|
+
children: s("workspacePagesV2.workspaces.youAreHere", "You’re here")
|
|
72
|
+
}) : e.status === "SUSPENDED" ? /* @__PURE__ */ L(A, {
|
|
73
|
+
status: "warn",
|
|
74
|
+
children: s("workspacePagesV2.workspaces.suspended", "Suspended")
|
|
75
|
+
}) : /* @__PURE__ */ L(A, {
|
|
76
|
+
status: "ok",
|
|
77
|
+
children: s("workspacePagesV2.workspaces.active", "Active")
|
|
78
|
+
}),
|
|
79
|
+
actions: t ? /* @__PURE__ */ R(x, {
|
|
80
|
+
type: "button",
|
|
81
|
+
size: "sm",
|
|
82
|
+
variant: "outline",
|
|
83
|
+
onClick: o,
|
|
84
|
+
children: [/* @__PURE__ */ L(v, { "aria-hidden": "true" }), s("workspacePagesV2.workspaces.settings", "Settings")]
|
|
85
|
+
}) : /* @__PURE__ */ L(x, {
|
|
86
|
+
type: "button",
|
|
87
|
+
size: "sm",
|
|
88
|
+
variant: "outline",
|
|
89
|
+
onClick: a,
|
|
90
|
+
children: s("workspacePagesV2.workspaces.switch", "Switch to it")
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function J() {
|
|
95
|
+
let [e] = V(), r = !!e.get("q")?.trim(), i = t({
|
|
96
|
+
limit: 12,
|
|
97
|
+
offset: 0
|
|
98
|
+
}), a = P({
|
|
99
|
+
url: V(),
|
|
100
|
+
pageSize: 12,
|
|
101
|
+
total: r ? void 0 : i.data?.total
|
|
102
|
+
}), o = t({
|
|
103
|
+
limit: a.pageSize,
|
|
104
|
+
offset: a.offset
|
|
105
|
+
}), s = n(r), c = f(() => ({ text: (e) => e.name }), []);
|
|
106
|
+
if (r) {
|
|
107
|
+
let e = M(s.data ?? [], a, c);
|
|
108
|
+
return {
|
|
109
|
+
list: a,
|
|
110
|
+
searching: r,
|
|
111
|
+
source: s,
|
|
112
|
+
count: e.length,
|
|
113
|
+
items: N(e, a.page, a.pageSize)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
list: a,
|
|
118
|
+
searching: r,
|
|
119
|
+
source: o,
|
|
120
|
+
count: o.data?.total ?? i.data?.total ?? 0,
|
|
121
|
+
items: o.data?.items ?? []
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function Y({ onCreate: e, only: t = !1 }) {
|
|
125
|
+
let n = c();
|
|
126
|
+
return /* @__PURE__ */ L(S, {
|
|
127
|
+
size: t ? "panel" : void 0,
|
|
128
|
+
illustration: "places",
|
|
129
|
+
title: t ? n("workspacePagesV2.workspaces.onlyOneTitle", "This is your only workspace") : n("workspacePagesV2.workspaces.emptyTitle", "No workspaces yet"),
|
|
130
|
+
description: t ? n("workspacePagesV2.workspaces.onlyOneDescription", "Make another one for a client, a team or a test. Each workspace has its own people, projects and saved values.") : n("workspacePagesV2.workspaces.emptyDescription", "Make a workspace for a client, a team or a test. Each one has its own people, projects and saved values."),
|
|
131
|
+
action: e ? /* @__PURE__ */ R(x, {
|
|
132
|
+
type: "button",
|
|
133
|
+
variant: t ? "outline" : "default",
|
|
134
|
+
onClick: e,
|
|
135
|
+
children: [/* @__PURE__ */ L(_, { "aria-hidden": "true" }), n("workspacePagesV2.workspaces.new", "New workspace")]
|
|
136
|
+
}) : void 0
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function X({ onCreate: t, canCreate: n }) {
|
|
140
|
+
let a = c(), o = B(), { basePath: l = "/workspaces", workspaceId: u } = e(), { withCurrentSearch: f } = s(), m = i(), { setOrganization: h, setWorkspace: g, setProject: _, setTenant: v } = F(), { permissions: y } = I(), [b] = p(() => /* @__PURE__ */ new Date()), { list: x, searching: S, source: C, count: D, items: O } = J(), A = n ? t : void 0, j = d((e) => r({
|
|
141
|
+
setOrganization: h,
|
|
142
|
+
setWorkspace: g,
|
|
143
|
+
setProject: _,
|
|
144
|
+
setTenant: v
|
|
145
|
+
}, e), [
|
|
146
|
+
h,
|
|
147
|
+
_,
|
|
148
|
+
v,
|
|
149
|
+
g
|
|
150
|
+
]);
|
|
151
|
+
return /* @__PURE__ */ R(E, {
|
|
152
|
+
list: x,
|
|
153
|
+
count: D,
|
|
154
|
+
loading: C.isPending && !C.data,
|
|
155
|
+
error: C.error,
|
|
156
|
+
onRetry: () => void C.refetch(),
|
|
157
|
+
errorTitle: a("workspacePagesV2.workspaces.loadFailed", "Couldn’t load your workspaces"),
|
|
158
|
+
errorDetails: C.error?.message,
|
|
159
|
+
summary: D === 1 ? a("workspacePagesV2.workspaces.countOne", "1 workspace") : a("workspacePagesV2.workspaces.count", "{{count}} workspaces", { count: D }),
|
|
160
|
+
toolbar: /* @__PURE__ */ L(T, {
|
|
161
|
+
list: x,
|
|
162
|
+
searchPlaceholder: a("workspacePagesV2.workspaces.search", "Search workspaces")
|
|
163
|
+
}),
|
|
164
|
+
pager: /* @__PURE__ */ L(w, {
|
|
165
|
+
list: x,
|
|
166
|
+
total: D
|
|
167
|
+
}),
|
|
168
|
+
empty: /* @__PURE__ */ L(Y, { onCreate: A }),
|
|
169
|
+
children: [/* @__PURE__ */ L(k, { children: O.map((e) => /* @__PURE__ */ L(q, {
|
|
170
|
+
workspace: e,
|
|
171
|
+
current: e.id === u,
|
|
172
|
+
yourRole: y?.roles?.[0] ?? null,
|
|
173
|
+
now: b,
|
|
174
|
+
onOpen: () => m(e),
|
|
175
|
+
onSwitch: () => j(e),
|
|
176
|
+
onSettings: () => o(f(`${l}/${e.id}/settings`))
|
|
177
|
+
}, e.id)) }), D === 1 && !S ? /* @__PURE__ */ L(Y, {
|
|
178
|
+
onCreate: A,
|
|
179
|
+
only: !0
|
|
180
|
+
}) : null]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function Z() {
|
|
184
|
+
o("workspaces.list");
|
|
185
|
+
let n = c(), r = B(), i = H(), { basePath: u = "/workspaces", workspaceId: f, invitesForYou: p } = e(), { withCurrentSearch: m } = s(), { canInviteMember: v, canCreateWorkspace: y, isLoading: x } = a(), [S, C] = V(), w = S.get("tab") === "invites" && p ? "invites" : "workspaces", T = S.get("dialog") === "invite", E = t({
|
|
186
|
+
limit: 12,
|
|
187
|
+
offset: 0
|
|
188
|
+
}).data?.total, O = d((e) => {
|
|
189
|
+
let t = new URLSearchParams(S);
|
|
190
|
+
e(t), C(t, { replace: !0 });
|
|
191
|
+
}, [S, C]), k = (e) => O((t) => {
|
|
192
|
+
for (let e of G) t.delete(e);
|
|
193
|
+
e === "invites" ? t.set("tab", "invites") : t.delete("tab");
|
|
194
|
+
}), A = () => O((e) => e.set("dialog", "invite")), M = () => O((e) => e.delete("dialog")), N = () => r(m(`${u}/new`)), P = d(() => {
|
|
195
|
+
i.invalidateQueries({ queryKey: ["myWorkspaces"] });
|
|
196
|
+
}, [i]);
|
|
197
|
+
return /* @__PURE__ */ R(j, { children: [
|
|
198
|
+
/* @__PURE__ */ L(U, {
|
|
199
|
+
variant: "compact",
|
|
200
|
+
title: n("workspacePagesV2.workspaces.title", "Workspaces & invites"),
|
|
201
|
+
description: n("workspacePagesV2.workspaces.purpose", "The workspaces you belong to, and invites for you to join others."),
|
|
202
|
+
secondary: /* @__PURE__ */ L(D, {
|
|
203
|
+
variant: "outline",
|
|
204
|
+
locked: !x && !v,
|
|
205
|
+
reason: n("workspacePagesV2.members.inviteLocked", "Inviting people is for workspace admins and managers. Ask an owner of this workspace."),
|
|
206
|
+
icon: b,
|
|
207
|
+
onClick: A,
|
|
208
|
+
disabled: !f,
|
|
209
|
+
children: n("workspacePagesV2.members.invite", "Invite people")
|
|
210
|
+
}),
|
|
211
|
+
primary: /* @__PURE__ */ L(D, {
|
|
212
|
+
locked: !x && !y,
|
|
213
|
+
reason: n("workspacePagesV2.workspaces.createLocked", "Making workspaces is for organization admins. Ask an owner of your organization."),
|
|
214
|
+
icon: _,
|
|
215
|
+
onClick: N,
|
|
216
|
+
children: n("workspacePagesV2.workspaces.new", "New workspace")
|
|
217
|
+
})
|
|
218
|
+
}),
|
|
219
|
+
p ? /* @__PURE__ */ L(W, {
|
|
220
|
+
variant: "check",
|
|
221
|
+
ariaLabel: n("workspacePagesV2.workspaces.tabsLabel", "Workspaces & invites"),
|
|
222
|
+
activeTabId: w,
|
|
223
|
+
onTabChange: k,
|
|
224
|
+
items: [{
|
|
225
|
+
id: "workspaces",
|
|
226
|
+
label: n("workspacePagesV2.workspaces.tabWorkspaces", "Workspaces"),
|
|
227
|
+
icon: /* @__PURE__ */ L(h, { "aria-hidden": "true" }),
|
|
228
|
+
badge: E
|
|
229
|
+
}, {
|
|
230
|
+
id: "invites",
|
|
231
|
+
label: n("workspacePagesV2.workspaces.tabInvites", "Invites for you"),
|
|
232
|
+
icon: /* @__PURE__ */ L(g, { "aria-hidden": "true" }),
|
|
233
|
+
badge: p.count
|
|
234
|
+
}]
|
|
235
|
+
}) : null,
|
|
236
|
+
w === "invites" && p ? p.render({ onWorkspaceJoined: P }) : /* @__PURE__ */ L(X, {
|
|
237
|
+
onCreate: N,
|
|
238
|
+
canCreate: y
|
|
239
|
+
}),
|
|
240
|
+
f ? /* @__PURE__ */ L(l, {
|
|
241
|
+
open: T && v,
|
|
242
|
+
onOpenChange: (e) => e ? A() : M(),
|
|
243
|
+
workspaceId: f
|
|
244
|
+
}) : null
|
|
245
|
+
] });
|
|
246
|
+
}
|
|
247
|
+
export { Z as WorkspacesPageV2 };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ActivityTone } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
/** What the page needs from one activity row. */
|
|
3
|
+
export interface ActivityRow {
|
|
4
|
+
id: string;
|
|
5
|
+
action: string;
|
|
6
|
+
category?: string | null;
|
|
7
|
+
resourceType?: string | null;
|
|
8
|
+
resourceId?: string | null;
|
|
9
|
+
userId: string;
|
|
10
|
+
description?: string | null;
|
|
11
|
+
details?: Record<string, unknown> | null;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
}
|
|
14
|
+
export type Translate = (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
15
|
+
/** The one "who" every service actor is grouped under. */
|
|
16
|
+
export declare const SYSTEM_ACTOR_KEY = "system";
|
|
17
|
+
/** How many of the newest events the page reads (the service's cap for this query). */
|
|
18
|
+
export declare const ACTIVITY_WINDOW = 200;
|
|
19
|
+
/** The "Show" filter's choices. */
|
|
20
|
+
export type ActivityShow = 'problems' | 'access' | 'people';
|
|
21
|
+
export interface ActivitySentence {
|
|
22
|
+
id: string;
|
|
23
|
+
at: string;
|
|
24
|
+
/** `SYSTEM_ACTOR_KEY` for services, else the user's id (the "Who" filter's value). */
|
|
25
|
+
actorKey: string;
|
|
26
|
+
actorKind: 'person' | 'service';
|
|
27
|
+
/** What the sentence reads as: "started", "tried to start". */
|
|
28
|
+
verb: string;
|
|
29
|
+
/** "a workflow"; empty when the verb says it all ("signed in"). */
|
|
30
|
+
object: string;
|
|
31
|
+
/** The "Area" filter's value and its words. */
|
|
32
|
+
areaKey: string;
|
|
33
|
+
area: string;
|
|
34
|
+
tone: ActivityTone;
|
|
35
|
+
failed: boolean;
|
|
36
|
+
/** The "Show" filter's values for this row. */
|
|
37
|
+
show: ActivityShow[];
|
|
38
|
+
}
|
|
39
|
+
/** True for a row a service wrote as itself (a schedule, a trigger), not a person. */
|
|
40
|
+
export declare function isServiceActor(row: Pick<ActivityRow, 'userId' | 'details'>): boolean;
|
|
41
|
+
/** The mutation field names a backstop row records (or the one an older plugin recorded). */
|
|
42
|
+
export declare function mutationFieldNames(row: ActivityRow): string[];
|
|
43
|
+
/** "startWorkflowRun" → ["start", "workflow", "run"]. */
|
|
44
|
+
export declare function splitWords(name: string): string[];
|
|
45
|
+
/** "a workflow", "an invitation", "files" (a plural takes no article). */
|
|
46
|
+
export declare function withArticle(words: readonly string[], tr: Translate): string;
|
|
47
|
+
/** One row as the log reads it. */
|
|
48
|
+
export declare function toActivitySentence(row: ActivityRow, tr: Translate): ActivitySentence;
|
|
49
|
+
/** The rows, newest first (the service orders them, but a merged page must not trust it). */
|
|
50
|
+
export declare function toActivitySentences(rows: readonly ActivityRow[], tr: Translate): ActivitySentence[];
|