@burdenoff/microfe-workspaces 2026.1120.1 → 2026.1121.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/WorkspacesRoutes.js +83 -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 +171 -2
- package/dist/generated/wspace-operations.js +1088 -52
- package/dist/generated/wspace-types.d.ts +193797 -41883
- 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/pages/MembersListPage.js +101 -100
- package/dist/pages/ProjectMembersPage.js +116 -115
- package/dist/pages/ProjectsListPage.js +233 -232
- 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 +382 -0
- package/dist/translations/en.js +382 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/utils/nativeBridge.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
|
|
2
|
+
import { useWorkspacePermissions as t } from "../../hooks/useWorkspacePermissions.js";
|
|
3
|
+
import { useWorkspacesPageView as n } from "../../hooks/useWorkspacesPageView.js";
|
|
4
|
+
import { useTr as r } from "../../hooks/useTr.js";
|
|
5
|
+
import { useAllWorkspaceInvitations as i, useAllWorkspaceMembers as a } from "../../hooks/v2/useWorkspacePagesV2Data.js";
|
|
6
|
+
import { NAVIGATION_V2_PEOPLE_ACCESS_PATH as o } from "../../constants/navigationV2.js";
|
|
7
|
+
import { invitationState as s, memberStatusTab as c, memberTabOf as l } from "./memberRows.js";
|
|
8
|
+
import { InvitedTab as u } from "./InvitedTab.js";
|
|
9
|
+
import { InvitePeopleDialog as d } from "./InvitePeopleDialog.js";
|
|
10
|
+
import { PeopleTab as f } from "./PeopleTab.js";
|
|
11
|
+
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
12
|
+
import { CircleX as g, Clock as _, UserCheck as v, UserPlus as y } from "lucide-react";
|
|
13
|
+
import { LockedButton as b, LockedState as x, WorkspacePage as S } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
15
|
+
import { useParams as T, useSearchParams as E } from "react-router";
|
|
16
|
+
import { PageHeader as D, Tabs as O } from "@burdenoff/fe-libs/chrome";
|
|
17
|
+
// src/pages/v2/MembersPage.tsx
|
|
18
|
+
var k = [
|
|
19
|
+
"q",
|
|
20
|
+
"sort",
|
|
21
|
+
"page",
|
|
22
|
+
"role",
|
|
23
|
+
"status"
|
|
24
|
+
];
|
|
25
|
+
function A() {
|
|
26
|
+
let A = r(), { workspaceId: j } = e(), { workspaceId: M } = T(), N = M || j;
|
|
27
|
+
n("workspaces.members", {
|
|
28
|
+
workspaceId: N,
|
|
29
|
+
requireParams: !0
|
|
30
|
+
});
|
|
31
|
+
let [P, F] = E(), I = l(P.get("tab")), L = P.get("dialog") === "invite" || P.get("invite") === "true", { canListMembers: R, canInviteMember: z, canRemoveMember: B, isLoading: V } = t(), H = a(N), U = i(N, z || R), [W] = h(() => /* @__PURE__ */ new Date()), G = m(() => {
|
|
32
|
+
let e = H.data ?? [];
|
|
33
|
+
return {
|
|
34
|
+
active: e.filter((e) => c(e.status) === "active").length,
|
|
35
|
+
suspended: e.filter((e) => c(e.status) === "suspended").length,
|
|
36
|
+
invited: (U.data ?? []).filter((e) => s(e, W) !== null).length
|
|
37
|
+
};
|
|
38
|
+
}, [
|
|
39
|
+
U.data,
|
|
40
|
+
H.data,
|
|
41
|
+
W
|
|
42
|
+
]), K = p((e) => {
|
|
43
|
+
let t = new URLSearchParams(P);
|
|
44
|
+
e(t), F(t, { replace: !0 });
|
|
45
|
+
}, [P, F]), q = (e) => K((t) => {
|
|
46
|
+
for (let e of k) t.delete(e);
|
|
47
|
+
e === "active" ? t.delete("tab") : t.set("tab", e);
|
|
48
|
+
}), J = () => K((e) => e.set("dialog", "invite")), Y = () => K((e) => {
|
|
49
|
+
e.delete("dialog"), e.delete("invite");
|
|
50
|
+
}), X = /* @__PURE__ */ C(D, {
|
|
51
|
+
variant: "compact",
|
|
52
|
+
title: A("workspacePagesV2.members.title", "Members"),
|
|
53
|
+
description: A("workspacePagesV2.members.purpose", "Everyone in this workspace: their role, and when they joined."),
|
|
54
|
+
back: {
|
|
55
|
+
label: A("workspacePagesV2.members.back", "People & access"),
|
|
56
|
+
to: o,
|
|
57
|
+
phoneOnly: !0
|
|
58
|
+
},
|
|
59
|
+
primary: /* @__PURE__ */ C(b, {
|
|
60
|
+
locked: !V && !z,
|
|
61
|
+
reason: A("workspacePagesV2.members.inviteLocked", "Inviting people is for workspace admins and managers. Ask an owner of this workspace."),
|
|
62
|
+
icon: y,
|
|
63
|
+
onClick: J,
|
|
64
|
+
disabled: !N,
|
|
65
|
+
children: A("workspacePagesV2.members.invite", "Invite people")
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
if (!V && !R && !z) return /* @__PURE__ */ w(S, { children: [X, /* @__PURE__ */ C(x, {
|
|
69
|
+
title: A("workspacePagesV2.members.lockedTitle", "Members is for people with access"),
|
|
70
|
+
description: A("workspacePagesV2.members.lockedDescription", "It lists everyone in this workspace and their role. Ask an owner of this workspace for access.")
|
|
71
|
+
})] });
|
|
72
|
+
let Z = [
|
|
73
|
+
{
|
|
74
|
+
id: "active",
|
|
75
|
+
label: A("workspacePagesV2.members.tabActive", "Active"),
|
|
76
|
+
icon: /* @__PURE__ */ C(v, { "aria-hidden": "true" }),
|
|
77
|
+
badge: H.data ? G.active : void 0
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "invited",
|
|
81
|
+
label: A("workspacePagesV2.members.tabInvited", "Invited"),
|
|
82
|
+
icon: /* @__PURE__ */ C(_, { "aria-hidden": "true" }),
|
|
83
|
+
badge: U.data ? G.invited : void 0
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "suspended",
|
|
87
|
+
label: A("workspacePagesV2.members.tabSuspended", "Suspended"),
|
|
88
|
+
icon: /* @__PURE__ */ C(g, { "aria-hidden": "true" }),
|
|
89
|
+
badge: H.data ? G.suspended : void 0
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
93
|
+
X,
|
|
94
|
+
/* @__PURE__ */ C(O, {
|
|
95
|
+
variant: "check",
|
|
96
|
+
ariaLabel: A("workspacePagesV2.members.tabsLabel", "Members"),
|
|
97
|
+
activeTabId: I,
|
|
98
|
+
onTabChange: q,
|
|
99
|
+
items: Z
|
|
100
|
+
}),
|
|
101
|
+
I === "invited" ? /* @__PURE__ */ C(u, {
|
|
102
|
+
workspaceId: N,
|
|
103
|
+
query: U,
|
|
104
|
+
canInvite: z,
|
|
105
|
+
onInvite: J
|
|
106
|
+
}) : /* @__PURE__ */ C(f, {
|
|
107
|
+
tab: I,
|
|
108
|
+
workspaceId: N,
|
|
109
|
+
canRemove: B,
|
|
110
|
+
canInvite: z,
|
|
111
|
+
onInvite: J
|
|
112
|
+
}, I),
|
|
113
|
+
N ? /* @__PURE__ */ C(d, {
|
|
114
|
+
open: L && z,
|
|
115
|
+
onOpenChange: (e) => e ? J() : Y(),
|
|
116
|
+
workspaceId: N
|
|
117
|
+
}) : null
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
export { A as MembersPageV2 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface MemberRow {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
email: string | null;
|
|
6
|
+
avatarUrl: string | null;
|
|
7
|
+
role: string;
|
|
8
|
+
joinedAt: string;
|
|
9
|
+
isYou: boolean;
|
|
10
|
+
}
|
|
11
|
+
type PeopleTabKind = 'active' | 'suspended';
|
|
12
|
+
export interface PeopleTabProps {
|
|
13
|
+
tab: PeopleTabKind;
|
|
14
|
+
workspaceId: string | undefined;
|
|
15
|
+
canRemove: boolean;
|
|
16
|
+
canInvite: boolean;
|
|
17
|
+
onInvite: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function PeopleTab({ tab, workspaceId, canRemove, canInvite, onInvite }: PeopleTabProps): import('react').JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
|
|
2
|
+
import { useRemoveUserFromWorkspace as t } from "../../hooks/useMemberMutations.js";
|
|
3
|
+
import { useTr as n } from "../../hooks/useTr.js";
|
|
4
|
+
import { useAllWorkspaceMembers as r, useWorkspaceActorRoles as i } from "../../hooks/v2/useWorkspacePagesV2Data.js";
|
|
5
|
+
import { nativeImpact as a } from "../../utils/nativeBridge.js";
|
|
6
|
+
import { memberIdentity as o, memberRoleText as s, memberStatusTab as c } from "./memberRows.js";
|
|
7
|
+
import { relativeTime as l } from "./relativeTime.js";
|
|
8
|
+
import { useCallback as u, useMemo as d, useState as f } from "react";
|
|
9
|
+
import { UserMinus as p, UserPlus as m } from "lucide-react";
|
|
10
|
+
import { ActionMenu as h, BulkBar as g, Button as _, DataRows as v, EmptyState as y, EntityAvatar as b, ListPager as x, ListToolbar as S, ListView as C, Notice as w, countFilterOptions as T, filterList as E, pageSlice as D, sortList as O, useConfirm as k, useListState as A } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
12
|
+
import { useI18n as P } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
13
|
+
import { useSearchParams as F } from "react-router";
|
|
14
|
+
import { useActorProfiles as I } from "@burdenoff/fe-libs/shared";
|
|
15
|
+
// src/pages/v2/PeopleTab.tsx
|
|
16
|
+
function L(t, r, a) {
|
|
17
|
+
let l = n(), { authToken: u, organizationId: f, currentUser: p } = e(), m = i(a), h = d(() => t.map((e) => ({
|
|
18
|
+
actorId: e.userId,
|
|
19
|
+
actorType: "user"
|
|
20
|
+
})), [t]), g = I(h, {
|
|
21
|
+
authToken: u || void 0,
|
|
22
|
+
orgId: f,
|
|
23
|
+
workspaceId: a
|
|
24
|
+
});
|
|
25
|
+
return d(() => t.filter((e) => c(e.status) === r).map((e) => {
|
|
26
|
+
let t = o(e, g[e.userId], l);
|
|
27
|
+
return {
|
|
28
|
+
id: e.id,
|
|
29
|
+
userId: e.userId,
|
|
30
|
+
name: t.name,
|
|
31
|
+
email: t.email,
|
|
32
|
+
avatarUrl: t.avatarUrl,
|
|
33
|
+
role: s(m.data?.[e.userId], e.role, l),
|
|
34
|
+
joinedAt: e.createdAt,
|
|
35
|
+
isYou: e.userId === p?.id
|
|
36
|
+
};
|
|
37
|
+
}), [
|
|
38
|
+
p?.id,
|
|
39
|
+
t,
|
|
40
|
+
g,
|
|
41
|
+
m.data,
|
|
42
|
+
r,
|
|
43
|
+
l
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
function R(e) {
|
|
47
|
+
let t = n(), r = A({
|
|
48
|
+
filters: ["role"],
|
|
49
|
+
sorts: ["name", "joined"],
|
|
50
|
+
url: F()
|
|
51
|
+
}), i = d(() => ({
|
|
52
|
+
id: "role",
|
|
53
|
+
label: t("workspacePagesV2.members.roleFilter", "Role"),
|
|
54
|
+
allLabel: t("workspacePagesV2.common.any", "Any"),
|
|
55
|
+
options: [...new Set(e.map((e) => e.role))].sort((e, t) => e.localeCompare(t)).map((e) => ({
|
|
56
|
+
value: e,
|
|
57
|
+
label: e
|
|
58
|
+
})),
|
|
59
|
+
getValue: (e) => e.role
|
|
60
|
+
}), [e, t]), a = d(() => [{
|
|
61
|
+
value: "name",
|
|
62
|
+
label: t("workspacePagesV2.common.sortName", "Name A–Z"),
|
|
63
|
+
compare: (e, t) => e.name.localeCompare(t.name)
|
|
64
|
+
}, {
|
|
65
|
+
value: "joined",
|
|
66
|
+
label: t("workspacePagesV2.members.sortJoined", "Newest first"),
|
|
67
|
+
compare: (e, t) => t.joinedAt.localeCompare(e.joinedAt)
|
|
68
|
+
}], [t]), o = d(() => ({
|
|
69
|
+
text: (e) => `${e.name} ${e.email ?? ""} ${e.role}`,
|
|
70
|
+
filters: [i]
|
|
71
|
+
}), [i]);
|
|
72
|
+
return {
|
|
73
|
+
list: r,
|
|
74
|
+
roleFilter: i,
|
|
75
|
+
sorts: a,
|
|
76
|
+
config: o,
|
|
77
|
+
matched: O(E(e, r, o), r.sort, a)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function z(e, t) {
|
|
81
|
+
let n = e.length === 1 ? e[0] : void 0;
|
|
82
|
+
return {
|
|
83
|
+
title: n ? t("workspacePagesV2.members.removeOneTitle", "Remove {{name}} from this workspace?", { name: n.name }) : t("workspacePagesV2.members.removeManyTitle", "Remove {{count}} people from this workspace?", { count: e.length }),
|
|
84
|
+
description: t("workspacePagesV2.members.removeDescription", "They lose access to its projects and data straight away."),
|
|
85
|
+
consequences: [t("workspacePagesV2.members.removeKeepsOrganization", "They stay in the organization"), t("workspacePagesV2.members.removeCanReinvite", "You can invite them again later")],
|
|
86
|
+
tone: "danger",
|
|
87
|
+
confirmLabel: n ? t("workspacePagesV2.members.removeOne", "Remove") : t("workspacePagesV2.members.removeMany", "Remove {{count}} people", { count: e.length })
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function B(e) {
|
|
91
|
+
let r = n(), i = k(), { mutateAsync: o, isPending: s } = t(e), [c, l] = f(null);
|
|
92
|
+
return {
|
|
93
|
+
remove: u(async (e, t) => {
|
|
94
|
+
if (e.length === 0 || (a("medium"), !await i(z(e, r)))) return;
|
|
95
|
+
l(null);
|
|
96
|
+
let n = await Promise.allSettled(e.map((e) => o(e.userId))), s = new Set(e.filter((e, t) => n[t]?.status === "rejected").map((e) => e.id));
|
|
97
|
+
if (t(new Set(e.filter((e) => !s.has(e.id)).map((e) => e.id))), s.size === 0) return;
|
|
98
|
+
let c = n.find((e) => e.status === "rejected"), u = c?.status === "rejected" && c.reason instanceof Error ? c.reason.message : "";
|
|
99
|
+
l(r("workspacePagesV2.members.removeFailed", "Couldn’t remove {{names}}. {{reason}}", {
|
|
100
|
+
names: e.filter((e) => s.has(e.id)).map((e) => e.name).join(", "),
|
|
101
|
+
reason: u
|
|
102
|
+
}).trim());
|
|
103
|
+
}, [
|
|
104
|
+
i,
|
|
105
|
+
o,
|
|
106
|
+
r
|
|
107
|
+
]),
|
|
108
|
+
removing: s,
|
|
109
|
+
failure: c
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function V({ onInvite: e, panel: t }) {
|
|
113
|
+
let r = n();
|
|
114
|
+
return /* @__PURE__ */ M(y, {
|
|
115
|
+
size: t ? "panel" : void 0,
|
|
116
|
+
illustration: "people",
|
|
117
|
+
title: r("workspacePagesV2.members.emptyTitle", "It’s just you here"),
|
|
118
|
+
description: r("workspacePagesV2.members.emptyDescription", "Invite the people you work with. They get the role you pick and show up here once they accept."),
|
|
119
|
+
action: e ? /* @__PURE__ */ N(_, {
|
|
120
|
+
type: "button",
|
|
121
|
+
variant: t ? "outline" : "default",
|
|
122
|
+
onClick: e,
|
|
123
|
+
children: [/* @__PURE__ */ M(m, { "aria-hidden": "true" }), r("workspacePagesV2.members.invite", "Invite people")]
|
|
124
|
+
}) : void 0
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function H() {
|
|
128
|
+
let e = n();
|
|
129
|
+
return /* @__PURE__ */ M(y, {
|
|
130
|
+
kind: "all-done",
|
|
131
|
+
illustration: "people",
|
|
132
|
+
title: e("workspacePagesV2.members.noSuspendedTitle", "No one is suspended"),
|
|
133
|
+
description: e("workspacePagesV2.members.noSuspendedDescription", "Suspended people keep their history but can’t sign in to this workspace.")
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function U({ row: e, canRemove: t, onRemove: r }) {
|
|
137
|
+
let i = n();
|
|
138
|
+
return e.isYou ? null : /* @__PURE__ */ M(h, {
|
|
139
|
+
label: i("workspacePagesV2.members.actionsFor", "Actions for {{name}}", { name: e.name }),
|
|
140
|
+
items: [{
|
|
141
|
+
id: "remove",
|
|
142
|
+
label: i("workspacePagesV2.members.removeFromWorkspace", "Remove from workspace…"),
|
|
143
|
+
icon: p,
|
|
144
|
+
danger: !0,
|
|
145
|
+
locked: !t,
|
|
146
|
+
lockedReason: i("workspacePagesV2.members.removeLocked", "Only workspace admins can remove people."),
|
|
147
|
+
onSelect: () => r(e)
|
|
148
|
+
}]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function W({ count: e, removing: t, onClear: r, onRemove: i }) {
|
|
152
|
+
let a = n();
|
|
153
|
+
return /* @__PURE__ */ M(g, {
|
|
154
|
+
count: e,
|
|
155
|
+
label: e === 1 ? a("workspacePagesV2.members.selectedOne", "1 person selected") : a("workspacePagesV2.members.selected", "{{count}} people selected", { count: e }),
|
|
156
|
+
onClear: r,
|
|
157
|
+
clearLabel: a("workspacePagesV2.common.clearSelection", "Clear selection"),
|
|
158
|
+
actions: /* @__PURE__ */ N(_, {
|
|
159
|
+
type: "button",
|
|
160
|
+
size: "sm",
|
|
161
|
+
variant: "outline",
|
|
162
|
+
disabled: t,
|
|
163
|
+
onClick: i,
|
|
164
|
+
children: [/* @__PURE__ */ M(p, { "aria-hidden": "true" }), a("workspacePagesV2.members.removeFromWorkspace", "Remove from workspace…")]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function G({ tab: e, workspaceId: t, canRemove: i, canInvite: a, onInvite: o }) {
|
|
169
|
+
let s = n(), { locale: c } = P(), u = r(t), d = L(u.data ?? [], e, t), { list: p, roleFilter: m, sorts: h, config: g, matched: _ } = R(d), { remove: y, removing: E, failure: O } = B(t), [k, A] = f([]), [F] = f(() => /* @__PURE__ */ new Date()), I = new Set(k), z = d.filter((e) => I.has(e.id)), G = i && e === "active", K = a ? o : void 0, q = e === "active" && d.length === 1 && d[0]?.isYou === !0 && !p.narrowed, J = (e) => A((t) => t.filter((t) => !e.has(t)));
|
|
170
|
+
return /* @__PURE__ */ N(j, { children: [
|
|
171
|
+
O ? /* @__PURE__ */ M(w, {
|
|
172
|
+
tone: "bad",
|
|
173
|
+
role: "alert",
|
|
174
|
+
children: O
|
|
175
|
+
}) : null,
|
|
176
|
+
/* @__PURE__ */ M(C, {
|
|
177
|
+
list: p,
|
|
178
|
+
count: _.length,
|
|
179
|
+
loading: u.isPending && !!t,
|
|
180
|
+
error: u.error,
|
|
181
|
+
onRetry: () => void u.refetch(),
|
|
182
|
+
errorTitle: s("workspacePagesV2.members.loadFailed", "Couldn’t load the members"),
|
|
183
|
+
errorDetails: u.error?.message,
|
|
184
|
+
summary: _.length === 1 ? s("workspacePagesV2.members.countOne", "1 person") : s("workspacePagesV2.members.count", "{{count}} people", { count: _.length }),
|
|
185
|
+
toolbar: /* @__PURE__ */ M(S, {
|
|
186
|
+
list: p,
|
|
187
|
+
searchPlaceholder: s("workspacePagesV2.members.search", "Search people"),
|
|
188
|
+
filters: [{
|
|
189
|
+
...m,
|
|
190
|
+
options: T(d, m, p, g)
|
|
191
|
+
}],
|
|
192
|
+
sorts: h
|
|
193
|
+
}),
|
|
194
|
+
bulk: G ? /* @__PURE__ */ M(W, {
|
|
195
|
+
count: z.length,
|
|
196
|
+
removing: E,
|
|
197
|
+
onClear: () => A([]),
|
|
198
|
+
onRemove: () => void y(z, J)
|
|
199
|
+
}) : void 0,
|
|
200
|
+
pager: /* @__PURE__ */ M(x, {
|
|
201
|
+
list: p,
|
|
202
|
+
total: _.length
|
|
203
|
+
}),
|
|
204
|
+
empty: e === "suspended" ? /* @__PURE__ */ M(H, {}) : /* @__PURE__ */ M(V, { onInvite: K }),
|
|
205
|
+
children: /* @__PURE__ */ M(v, {
|
|
206
|
+
label: s("workspacePagesV2.members.tableLabel", "Members"),
|
|
207
|
+
items: D(_, p.page, p.pageSize),
|
|
208
|
+
getId: (e) => e.id,
|
|
209
|
+
selection: G ? {
|
|
210
|
+
selected: k,
|
|
211
|
+
onChange: A,
|
|
212
|
+
canSelect: (e) => !e.isYou,
|
|
213
|
+
rowLabel: (e) => s("workspacePagesV2.members.selectPerson", "Select {{name}}", { name: e.name }),
|
|
214
|
+
allLabel: s("workspacePagesV2.common.selectPage", "Select everyone on this page")
|
|
215
|
+
} : void 0,
|
|
216
|
+
lead: {
|
|
217
|
+
header: s("workspacePagesV2.members.person", "Person"),
|
|
218
|
+
media: (e) => /* @__PURE__ */ M(b, {
|
|
219
|
+
name: e.name,
|
|
220
|
+
src: e.avatarUrl
|
|
221
|
+
}),
|
|
222
|
+
title: (e) => e.isYou ? s("workspacePagesV2.members.you", "{{name}} (you)", { name: e.name }) : e.name,
|
|
223
|
+
subtitle: (e) => e.email ?? void 0
|
|
224
|
+
},
|
|
225
|
+
columns: [{
|
|
226
|
+
id: "role",
|
|
227
|
+
header: s("workspacePagesV2.members.role", "Role"),
|
|
228
|
+
width: "200px",
|
|
229
|
+
cell: (e) => /* @__PURE__ */ M("span", {
|
|
230
|
+
className: "font-medium text-text-primary",
|
|
231
|
+
children: e.role
|
|
232
|
+
})
|
|
233
|
+
}, {
|
|
234
|
+
id: "joined",
|
|
235
|
+
header: s("workspacePagesV2.members.joined", "Joined"),
|
|
236
|
+
width: "140px",
|
|
237
|
+
cell: (e) => l(e.joinedAt, F, c) ?? "—"
|
|
238
|
+
}],
|
|
239
|
+
actionsWidth: "44px",
|
|
240
|
+
actions: (e) => /* @__PURE__ */ M(U, {
|
|
241
|
+
row: e,
|
|
242
|
+
canRemove: i,
|
|
243
|
+
onRemove: (e) => void y([e], J)
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
}),
|
|
247
|
+
q && K ? /* @__PURE__ */ M(V, {
|
|
248
|
+
onInvite: K,
|
|
249
|
+
panel: !0
|
|
250
|
+
}) : null
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
253
|
+
export { G as PeopleTab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ProjectsPageV2(): import('react').JSX.Element;
|
|
@@ -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 };
|