@nivaro/react 0.3.111 → 0.3.112
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +170 -2
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3097 -2972
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
- package/dist/shared/components/cbv/column-totals.js +66 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +345 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1529 -1492
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -6,22 +6,23 @@ import { toast as V } from "sonner";
|
|
|
6
6
|
import { useNivaroClient as z, useItemEditAuth as ve, ParentDraftContext as Ne } from "../../context.js";
|
|
7
7
|
import { get as M, del as ke, put as we } from "../../lib/commands.js";
|
|
8
8
|
import { isEmptyValue as K, cascadeParents as Se } from "../../lib/personal-defaults.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { queryKeys as Ce } from "../../lib/query-keys.js";
|
|
10
|
+
import { userErrorMessage as qe } from "../../lib/safe-error.js";
|
|
11
|
+
import { titleCase as H, cn as $, formatDate as Pe } from "../../lib/utils.js";
|
|
12
|
+
import { FieldRenderer as Te } from "../item-edit/FieldRenderer.js";
|
|
13
|
+
import { getCascadeFilters as ae, buildCascadeFilter as Ee } from "../item-edit/helpers.js";
|
|
14
|
+
import { M2MStagingContext as Fe } from "../item-edit/M2MStagingContext.js";
|
|
14
15
|
import { PERSONAL_DEFAULT_GHOST_BUTTON as Y } from "../item-edit/PersonalDefaultPill.js";
|
|
15
|
-
import { pickedCollection as
|
|
16
|
-
import { personalDefaultsKey as
|
|
16
|
+
import { pickedCollection as Me } from "../item-edit/personal-default-checks.js";
|
|
17
|
+
import { personalDefaultsKey as $e } from "../item-edit/usePersonalDefaults.js";
|
|
17
18
|
import { Skeleton as U } from "../ui/skeleton.js";
|
|
18
|
-
import { describeValue as W, loadDefaultLabels as
|
|
19
|
-
import { SectionCard as
|
|
19
|
+
import { describeValue as W, loadDefaultLabels as _e, labelKey as De } from "./my-defaults-labels.js";
|
|
20
|
+
import { SectionCard as Ke, EmptyLine as Re, Pill as Le, ConfirmButton as Ue } from "./primitives.js";
|
|
20
21
|
const B = { fields: [], relations: [], label: "", ready: !1 };
|
|
21
|
-
function
|
|
22
|
+
function Ae(a) {
|
|
22
23
|
const e = z(), n = O({
|
|
23
24
|
queries: a.map((l) => ({
|
|
24
|
-
queryKey:
|
|
25
|
+
queryKey: Ce.fieldConfig(l, null),
|
|
25
26
|
queryFn: () => e.request(M(`/field-config/${l}`)).then((c) => c.data ?? []),
|
|
26
27
|
staleTime: 6e4
|
|
27
28
|
}))
|
|
@@ -54,7 +55,7 @@ function T(a, e) {
|
|
|
54
55
|
const n = a.fields.find((f) => f.field === e);
|
|
55
56
|
return (i = n == null ? void 0 : n.label) != null && i.trim() ? n.label : H(e);
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function Qe(a, e) {
|
|
58
59
|
const n = Object.keys(e.context ?? {}).filter((l) => !K(e.context[l])), i = new Map(a.fields.map((l) => [l.field, l])), d = Se(
|
|
59
60
|
e.field,
|
|
60
61
|
(l) => {
|
|
@@ -72,7 +73,7 @@ function Z(a, e) {
|
|
|
72
73
|
const n = [];
|
|
73
74
|
let i = 0;
|
|
74
75
|
for (const f of a.ids) {
|
|
75
|
-
const d =
|
|
76
|
+
const d = De(a.target, f);
|
|
76
77
|
e.map.has(d) ? n.push(e.map.get(d) ?? "Untitled record") : i++;
|
|
77
78
|
}
|
|
78
79
|
return n.length === 0 ? { text: "No longer available", state: "gone" } : (i && n.push(`${i} no longer available`), { text: n.join(", "), state: "ok" });
|
|
@@ -80,9 +81,9 @@ function Z(a, e) {
|
|
|
80
81
|
function ne(a) {
|
|
81
82
|
var i, f;
|
|
82
83
|
const e = a, n = ((f = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : f.error) ?? (e == null ? void 0 : e.error);
|
|
83
|
-
return typeof n == "string" && n.trim() ? n :
|
|
84
|
+
return typeof n == "string" && n.trim() ? n : qe(a, "Could not save");
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function ct({ userId: a, name: e }) {
|
|
86
87
|
const n = z(), i = me(), f = ve(), d = !!a && String(a).toUpperCase() !== String(f.userId).toUpperCase(), l = !d || f.isAdmin, c = d ? `/field-defaults/users/${encodeURIComponent(String(a))}` : "/field-defaults/mine", u = d ? String(a) : "me", k = ["field-defaults-card", u], {
|
|
87
88
|
data: x,
|
|
88
89
|
isPending: g,
|
|
@@ -103,7 +104,7 @@ function ot({ userId: a, name: e }) {
|
|
|
103
104
|
const t = new Set((x ?? []).map((r) => r.collection));
|
|
104
105
|
for (const r of p ?? []) t.add(r.collection);
|
|
105
106
|
return [...t];
|
|
106
|
-
}, [x, p]), h =
|
|
107
|
+
}, [x, p]), h = Ae(w), P = w.every((t) => {
|
|
107
108
|
var r;
|
|
108
109
|
return (r = h.get(t)) == null ? void 0 : r.ready;
|
|
109
110
|
}), C = E(() => {
|
|
@@ -113,7 +114,7 @@ function ot({ userId: a, name: e }) {
|
|
|
113
114
|
const N = h.get(r.collection) ?? B, q = (m) => N.fields.find((F) => F.field === m);
|
|
114
115
|
t.set(String(r.id), {
|
|
115
116
|
value: W(q(r.field), N.relations, r.collection, r.value),
|
|
116
|
-
context:
|
|
117
|
+
context: Qe(N, r).map((m) => [
|
|
117
118
|
m,
|
|
118
119
|
W(q(m), N.relations, r.collection, r.context[m])
|
|
119
120
|
])
|
|
@@ -132,7 +133,7 @@ function ot({ userId: a, name: e }) {
|
|
|
132
133
|
isError: G
|
|
133
134
|
} = I({
|
|
134
135
|
queryKey: ["field-defaults-card-labels", oe],
|
|
135
|
-
queryFn: () =>
|
|
136
|
+
queryFn: () => _e(
|
|
136
137
|
n,
|
|
137
138
|
R,
|
|
138
139
|
(t) => i.fetchQuery({
|
|
@@ -150,7 +151,7 @@ function ot({ userId: a, name: e }) {
|
|
|
150
151
|
loading: R.size > 0 && !G && (!P || ce),
|
|
151
152
|
failed: G
|
|
152
153
|
}, A = (t) => {
|
|
153
|
-
i.invalidateQueries({ queryKey: k }), !d && t && i.invalidateQueries({ queryKey:
|
|
154
|
+
i.invalidateQueries({ queryKey: k }), !d && t && i.invalidateQueries({ queryKey: $e(t) });
|
|
154
155
|
}, Q = te({
|
|
155
156
|
mutationFn: (t) => n.request(ke(`${c}/${t.id}`)),
|
|
156
157
|
onSuccess: (t, r) => {
|
|
@@ -177,7 +178,7 @@ function ot({ userId: a, name: e }) {
|
|
|
177
178
|
};
|
|
178
179
|
}).sort((t, r) => t.label.localeCompare(r.label)), L = (e == null ? void 0 : e.trim()) || "This person";
|
|
179
180
|
return /* @__PURE__ */ o(
|
|
180
|
-
|
|
181
|
+
Ke,
|
|
181
182
|
{
|
|
182
183
|
icon: /* @__PURE__ */ s(pe, { className: "h-4 w-4" }),
|
|
183
184
|
title: d ? "Personal defaults" : "My defaults",
|
|
@@ -188,7 +189,7 @@ function ot({ userId: a, name: e }) {
|
|
|
188
189
|
/* @__PURE__ */ s(U, { className: "h-3.5 w-24" }),
|
|
189
190
|
/* @__PURE__ */ s(U, { className: "h-3.5 w-40" })
|
|
190
191
|
] }, t)) }) : y ? /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
191
|
-
/* @__PURE__ */ s(
|
|
192
|
+
/* @__PURE__ */ s(Re, { children: "Could not load the saved defaults." }),
|
|
192
193
|
/* @__PURE__ */ s(
|
|
193
194
|
"button",
|
|
194
195
|
{
|
|
@@ -237,7 +238,7 @@ function ot({ userId: a, name: e }) {
|
|
|
237
238
|
(x ?? []).filter((m) => m.collection === t.collection).map((m) => {
|
|
238
239
|
var F;
|
|
239
240
|
return /* @__PURE__ */ s(
|
|
240
|
-
|
|
241
|
+
je,
|
|
241
242
|
{
|
|
242
243
|
row: m,
|
|
243
244
|
meta: h.get(m.collection) ?? B,
|
|
@@ -252,7 +253,7 @@ function ot({ userId: a, name: e }) {
|
|
|
252
253
|
);
|
|
253
254
|
}),
|
|
254
255
|
N.map((m) => /* @__PURE__ */ s(
|
|
255
|
-
|
|
256
|
+
Oe,
|
|
256
257
|
{
|
|
257
258
|
collection: t.collection,
|
|
258
259
|
field: m,
|
|
@@ -277,7 +278,7 @@ function ot({ userId: a, name: e }) {
|
|
|
277
278
|
);
|
|
278
279
|
}
|
|
279
280
|
const le = 'input:not([type=hidden]), textarea, [role=combobox], button, [tabindex]:not([tabindex="-1"])', ee = "No form you can be given offers a personal default for this field now, so it is not used. Clear it, or ask an admin to turn it back on.";
|
|
280
|
-
function
|
|
281
|
+
function je({
|
|
281
282
|
row: a,
|
|
282
283
|
meta: e,
|
|
283
284
|
parts: n,
|
|
@@ -323,7 +324,7 @@ function Qe({
|
|
|
323
324
|
),
|
|
324
325
|
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
325
326
|
u && v ? /* @__PURE__ */ s(
|
|
326
|
-
|
|
327
|
+
Ie,
|
|
327
328
|
{
|
|
328
329
|
row: a,
|
|
329
330
|
field: v,
|
|
@@ -355,10 +356,10 @@ function Qe({
|
|
|
355
356
|
!u && /* @__PURE__ */ o("span", { children: [
|
|
356
357
|
a.updated_by ? "Set by an admin" : "Saved",
|
|
357
358
|
" ",
|
|
358
|
-
|
|
359
|
+
Pe(a.updated_at)
|
|
359
360
|
] }),
|
|
360
361
|
b && /* @__PURE__ */ o("span", { "data-tip": ee, children: [
|
|
361
|
-
/* @__PURE__ */ s(
|
|
362
|
+
/* @__PURE__ */ s(Le, { tone: "amber", testId: "stale", children: /* @__PURE__ */ s("span", { "data-default-stale": !0, children: "No longer on any form" }) }),
|
|
362
363
|
/* @__PURE__ */ o("span", { className: "sr-only", children: [
|
|
363
364
|
". ",
|
|
364
365
|
ee
|
|
@@ -385,7 +386,7 @@ function Qe({
|
|
|
385
386
|
}
|
|
386
387
|
),
|
|
387
388
|
/* @__PURE__ */ s(
|
|
388
|
-
|
|
389
|
+
Ue,
|
|
389
390
|
{
|
|
390
391
|
onConfirm: l,
|
|
391
392
|
disabled: c,
|
|
@@ -414,7 +415,7 @@ function se({
|
|
|
414
415
|
onChange: d
|
|
415
416
|
}) {
|
|
416
417
|
var b;
|
|
417
|
-
const l = E(() => ({ ...e, readonly: !1, hidden: !1 }), [e]), c = ((b =
|
|
418
|
+
const l = E(() => ({ ...e, readonly: !1, hidden: !1 }), [e]), c = ((b = Me(n, a, e.field)) == null ? void 0 : b.kind) === "m2m", u = E(
|
|
418
419
|
() => Array.isArray(f) ? f : K(f) ? [] : [f],
|
|
419
420
|
[f]
|
|
420
421
|
), k = E(
|
|
@@ -430,13 +431,13 @@ function se({
|
|
|
430
431
|
} : null,
|
|
431
432
|
[c, u, d]
|
|
432
433
|
), x = E(
|
|
433
|
-
() =>
|
|
434
|
+
() => Ee({
|
|
434
435
|
rules: ae(e.dependency_config),
|
|
435
436
|
parentValue: (v) => K(i[v]) ? null : i[v]
|
|
436
437
|
}).filter,
|
|
437
438
|
[e.dependency_config, i]
|
|
438
439
|
), g = E(() => ({ collection: a, draft: { ...i } }), [a, i]), y = /* @__PURE__ */ s(
|
|
439
|
-
|
|
440
|
+
Te,
|
|
440
441
|
{
|
|
441
442
|
field: l,
|
|
442
443
|
value: c ? void 0 : f,
|
|
@@ -447,7 +448,7 @@ function se({
|
|
|
447
448
|
cascadeFilter: x
|
|
448
449
|
}
|
|
449
450
|
);
|
|
450
|
-
return /* @__PURE__ */ s(Ne.Provider, { value: g, children: k ? /* @__PURE__ */ s(
|
|
451
|
+
return /* @__PURE__ */ s(Ne.Provider, { value: g, children: k ? /* @__PURE__ */ s(Fe.Provider, { value: k, children: y }) : y });
|
|
451
452
|
}
|
|
452
453
|
function re({
|
|
453
454
|
canSave: a,
|
|
@@ -486,7 +487,7 @@ function ie(a, e) {
|
|
|
486
487
|
onError: (l) => f(ne(l))
|
|
487
488
|
}), error: i };
|
|
488
489
|
}
|
|
489
|
-
function
|
|
490
|
+
function Ie({
|
|
490
491
|
row: a,
|
|
491
492
|
field: e,
|
|
492
493
|
relations: n,
|
|
@@ -551,7 +552,7 @@ function je({
|
|
|
551
552
|
}
|
|
552
553
|
);
|
|
553
554
|
}
|
|
554
|
-
function
|
|
555
|
+
function Oe({
|
|
555
556
|
collection: a,
|
|
556
557
|
field: e,
|
|
557
558
|
meta: n,
|
|
@@ -669,5 +670,5 @@ function Ie({
|
|
|
669
670
|
);
|
|
670
671
|
}
|
|
671
672
|
export {
|
|
672
|
-
|
|
673
|
+
ct as MyDefaultsCard
|
|
673
674
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { BellOff as
|
|
2
|
+
import { BellOff as N, Building2 as _, Mail as p, Phone as $, MapPin as I, Clock as O, Video as C, MessageSquare as P, Eye as j } from "lucide-react";
|
|
3
3
|
import { useState as B } from "react";
|
|
4
4
|
import { toast as D } from "sonner";
|
|
5
|
-
import { presenceWord as
|
|
6
|
-
import { cn as
|
|
5
|
+
import { presenceWord as M, stuckText as v } from "../../lib/presence-state.js";
|
|
6
|
+
import { cn as R, formatRelative as S } from "../../lib/utils.js";
|
|
7
7
|
import { canViewAs as T, viewAs as V } from "../../lib/view-as.js";
|
|
8
|
-
import { canOpenDm as
|
|
9
|
-
import { UserAvatar as
|
|
8
|
+
import { canOpenDm as A, openDmWith as U } from "../chat/chat-core.js";
|
|
9
|
+
import { UserAvatar as W } from "../UserAvatar.js";
|
|
10
10
|
import { BestTimeChip as E } from "./BestTime.js";
|
|
11
11
|
import { MailSuppressedPill as L } from "./MailSuppressedPill.js";
|
|
12
12
|
import { NotifyButton as q } from "./PersonExtras.js";
|
|
@@ -14,10 +14,10 @@ import { personInitials as H, Pill as o, PersonChip as z } from "./primitives.js
|
|
|
14
14
|
import { usePersonPresence as F } from "./usePersonPresence.js";
|
|
15
15
|
function oe({
|
|
16
16
|
profile: e,
|
|
17
|
-
isAdmin:
|
|
17
|
+
isAdmin: i
|
|
18
18
|
}) {
|
|
19
|
-
var f,
|
|
20
|
-
const r = e.presence.online,
|
|
19
|
+
var f, h, x, b, g;
|
|
20
|
+
const r = e.presence.online, n = M(e.presence), s = n === "away", d = n === "idle", l = r && n === "online" ? e.presence.stuck ?? null : null, { page: m } = F(r ? e.id : null), k = e.status === "active" ? "green" : e.status === "suspended" ? "red" : "neutral", u = e.ooo_end ? new Date(e.ooo_end).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : null, w = A();
|
|
21
21
|
return /* @__PURE__ */ t(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
@@ -26,7 +26,7 @@ function oe({
|
|
|
26
26
|
children: /* @__PURE__ */ a("div", { className: "flex flex-wrap items-start gap-x-5 gap-y-4 p-5", children: [
|
|
27
27
|
/* @__PURE__ */ a("div", { className: "relative shrink-0", children: [
|
|
28
28
|
/* @__PURE__ */ t(
|
|
29
|
-
|
|
29
|
+
W,
|
|
30
30
|
{
|
|
31
31
|
userId: e.id,
|
|
32
32
|
alt: e.name,
|
|
@@ -37,12 +37,12 @@ function oe({
|
|
|
37
37
|
/* @__PURE__ */ t(
|
|
38
38
|
"span",
|
|
39
39
|
{
|
|
40
|
-
"data-person-presence": r ?
|
|
41
|
-
className:
|
|
40
|
+
"data-person-presence": r ? s ? "away" : d ? "idle" : l ? "stuck" : "online" : "offline",
|
|
41
|
+
className: R(
|
|
42
42
|
"absolute bottom-0.5 right-0.5 h-3.5 w-3.5 rounded-full border-2 border-white dark:border-card",
|
|
43
|
-
r ?
|
|
43
|
+
r ? s ? "border-amber-400 bg-white dark:bg-card" : d ? "bg-amber-400" : l ? "bg-orange-500" : "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
|
|
44
44
|
),
|
|
45
|
-
title: r ?
|
|
45
|
+
title: r ? s ? "Away" : d ? `Idle · ${e.presence.idle_minutes}m` : l ? `Online · ${v(l)}` : "Online now" : "Offline"
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
48
|
e.presence.dnd && /* @__PURE__ */ t(
|
|
@@ -51,7 +51,7 @@ function oe({
|
|
|
51
51
|
"data-person-dnd": !0,
|
|
52
52
|
"data-tip": "Do not disturb",
|
|
53
53
|
className: "absolute -left-0.5 -top-0.5 flex h-[18px] w-[18px] items-center justify-center rounded-full border-2 border-white bg-red-500 text-white dark:border-card",
|
|
54
|
-
children: /* @__PURE__ */ t(
|
|
54
|
+
children: /* @__PURE__ */ t(N, { className: "h-2.5 w-2.5", strokeWidth: 2.5 })
|
|
55
55
|
}
|
|
56
56
|
)
|
|
57
57
|
] }),
|
|
@@ -65,9 +65,9 @@ function oe({
|
|
|
65
65
|
"Out of office",
|
|
66
66
|
u ? ` until ${u}` : ""
|
|
67
67
|
] }),
|
|
68
|
-
/* @__PURE__ */ t(L, { email: e.email, canClear:
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
/* @__PURE__ */ t(L, { email: e.email, canClear: i }),
|
|
69
|
+
i && ((h = e.admin) == null ? void 0 : h.account_kind) && /* @__PURE__ */ t(o, { tone: "violet", testId: "account-kind", children: e.admin.account_kind }),
|
|
70
|
+
i && (((x = e.admin) == null ? void 0 : x.directory_status) === "missing" || ((b = e.admin) == null ? void 0 : b.directory_status) === "disabled") && /* @__PURE__ */ t(o, { tone: "red", testId: "directory", children: e.admin.directory_status === "missing" ? "Not in the directory" : "Disabled in the directory" })
|
|
71
71
|
] }),
|
|
72
72
|
e.custom_status && /* @__PURE__ */ a(
|
|
73
73
|
"p",
|
|
@@ -81,8 +81,8 @@ function oe({
|
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
83
|
(e.title || e.department || e.company) && /* @__PURE__ */ a("p", { className: "mt-0.5 flex flex-wrap items-center gap-x-1.5 text-[13px] text-slate-500 dark:text-slate-400", children: [
|
|
84
|
-
[e.title, e.department, (e.company, null)].filter((c) => !!c).map((c,
|
|
85
|
-
|
|
84
|
+
[e.title, e.department, (e.company, null)].filter((c) => !!c).map((c, y) => /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
85
|
+
y > 0 && /* @__PURE__ */ t("span", { "aria-hidden": !0, children: "·" }),
|
|
86
86
|
c
|
|
87
87
|
] }, c)),
|
|
88
88
|
e.company && /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
@@ -123,7 +123,7 @@ function oe({
|
|
|
123
123
|
] }),
|
|
124
124
|
/* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", "data-person-last-seen": !0, children: [
|
|
125
125
|
/* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
|
|
126
|
-
r ?
|
|
126
|
+
r ? s ? "Away" : d ? `Online · idle ${e.presence.idle_minutes}m` : l ? `Online · ${v(l)}` : "Online now" : e.last_access ? `Last active ${S(e.last_access)}` : "Never signed in",
|
|
127
127
|
r && m ? /* @__PURE__ */ a("span", { "data-person-page": !0, children: [
|
|
128
128
|
" · on ",
|
|
129
129
|
m
|
|
@@ -155,8 +155,8 @@ function oe({
|
|
|
155
155
|
) : null
|
|
156
156
|
] }),
|
|
157
157
|
/* @__PURE__ */ a("div", { className: "flex shrink-0 flex-wrap items-center gap-2 self-start", "data-person-actions": !0, children: [
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
i && /* @__PURE__ */ t(q, { profile: e }),
|
|
159
|
+
i && T() && e.status === "active" && !((g = e.admin) != null && g.is_redacted) && /* @__PURE__ */ t(G, { profile: e }),
|
|
160
160
|
/* @__PURE__ */ a(
|
|
161
161
|
"a",
|
|
162
162
|
{
|
|
@@ -168,12 +168,12 @@ function oe({
|
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
|
|
171
|
+
w && /* @__PURE__ */ a(
|
|
172
172
|
"button",
|
|
173
173
|
{
|
|
174
174
|
type: "button",
|
|
175
175
|
"data-person-message": !0,
|
|
176
|
-
onClick: () =>
|
|
176
|
+
onClick: () => U(e.id, e.name),
|
|
177
177
|
className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-600 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:border-border dark:text-slate-300 dark:hover:bg-muted",
|
|
178
178
|
children: [
|
|
179
179
|
/* @__PURE__ */ t(P, { className: "h-3.5 w-3.5" }),
|
|
@@ -200,20 +200,20 @@ function oe({
|
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
function G({ profile: e }) {
|
|
203
|
-
const [
|
|
203
|
+
const [i, r] = B(!1), n = e.first_name ?? e.name;
|
|
204
204
|
return /* @__PURE__ */ a(
|
|
205
205
|
"button",
|
|
206
206
|
{
|
|
207
207
|
type: "button",
|
|
208
208
|
"data-person-view-as": !0,
|
|
209
|
-
disabled:
|
|
210
|
-
"data-tip": `
|
|
209
|
+
disabled: i,
|
|
210
|
+
"data-tip": `Opens this page as ${n}, exactly as ${n} sees it. Anything you change is done as ${n}; admins can see it was you.`,
|
|
211
211
|
onClick: async () => {
|
|
212
212
|
r(!0);
|
|
213
213
|
try {
|
|
214
214
|
await V({ id: e.id, name: e.name });
|
|
215
|
-
} catch (
|
|
216
|
-
D.error((
|
|
215
|
+
} catch (s) {
|
|
216
|
+
D.error((s == null ? void 0 : s.message) || `Could not open the app as ${n}`);
|
|
217
217
|
} finally {
|
|
218
218
|
r(!1);
|
|
219
219
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as b } from "react";
|
|
3
|
-
import { useItemEditAuth as
|
|
4
|
-
import { cn as
|
|
3
|
+
import { useItemEditAuth as _ } from "../../context.js";
|
|
4
|
+
import { cn as l } from "../../lib/utils.js";
|
|
5
5
|
import { PermissionSummaryCard as I } from "../access/PermissionSummary.js";
|
|
6
|
-
import { Tabs as
|
|
6
|
+
import { Tabs as S, TabsList as A, TabsTrigger as P, TabsContent as i } from "../ui/tabs.js";
|
|
7
7
|
import { DayTimelineCard as T } from "./DayTimeline.js";
|
|
8
8
|
import { DelegationCard as D } from "./DelegationCard.js";
|
|
9
9
|
import { MyDefaultsCard as U } from "./MyDefaultsCard.js";
|
|
@@ -19,23 +19,24 @@ import { PersonHeader as $ } from "./PersonHeader.js";
|
|
|
19
19
|
import { AboutCard as ee, PeopleCard as re, AvailabilityCard as ae, ResponsibilitiesCard as de } from "./PersonOverview.js";
|
|
20
20
|
import { PersonWeekCard as se } from "./PersonWeek.js";
|
|
21
21
|
import { SignedInDevices as te } from "./SignedInDevices.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
22
|
+
import { SlowScreensCard as ie } from "./SlowScreensCard.js";
|
|
23
|
+
import { usePersonProfile as oe, useInvalidatePerson as ne } from "./types.js";
|
|
24
|
+
import { ActivityFeedCard as le } from "./ActivityFeedCard.js";
|
|
25
|
+
function Oe({
|
|
25
26
|
userId: o,
|
|
26
|
-
className:
|
|
27
|
+
className: c,
|
|
27
28
|
initialTab: h = "overview"
|
|
28
29
|
}) {
|
|
29
30
|
var v, g, f;
|
|
30
|
-
const t =
|
|
31
|
-
if (y || !e && !x) return /* @__PURE__ */ r(
|
|
31
|
+
const t = _(), s = !!(t != null && t.isAdmin), { data: e, isLoading: y, isError: x } = oe(o), N = ne(o), [p, C] = b(h), [n, k] = b("feed");
|
|
32
|
+
if (y || !e && !x) return /* @__PURE__ */ r(ce, { className: c });
|
|
32
33
|
if (!e)
|
|
33
34
|
return /* @__PURE__ */ a(
|
|
34
35
|
"div",
|
|
35
36
|
{
|
|
36
|
-
className:
|
|
37
|
+
className: l(
|
|
37
38
|
"rounded-lg border border-slate-200 bg-white p-8 text-center dark:border-border dark:bg-card",
|
|
38
|
-
|
|
39
|
+
c
|
|
39
40
|
),
|
|
40
41
|
"data-person-missing": !0,
|
|
41
42
|
children: [
|
|
@@ -44,7 +45,7 @@ function Fe({
|
|
|
44
45
|
]
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
|
-
const
|
|
48
|
+
const w = !!(t != null && t.userId) && !!((v = e.manager) != null && v.id) && String(e.manager.id).toUpperCase() === String(t.userId).toUpperCase(), u = /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
48
49
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
49
50
|
/* @__PURE__ */ r(ee, { profile: e, isAdmin: s }),
|
|
50
51
|
/* @__PURE__ */ r(X, { profile: e }),
|
|
@@ -81,15 +82,15 @@ function Fe({
|
|
|
81
82
|
}
|
|
82
83
|
) : /* @__PURE__ */ r(ae, { profile: e }),
|
|
83
84
|
/* @__PURE__ */ r(de, { profile: e, isAdmin: s }),
|
|
84
|
-
(s ||
|
|
85
|
+
(s || w) && /* @__PURE__ */ r(se, { profile: e })
|
|
85
86
|
] })
|
|
86
87
|
] });
|
|
87
|
-
return /* @__PURE__ */ a("div", { className:
|
|
88
|
+
return /* @__PURE__ */ a("div", { className: l("flex flex-col gap-4", c), "data-nvr-person": e.id, children: [
|
|
88
89
|
/* @__PURE__ */ r($, { profile: e, isAdmin: s }),
|
|
89
90
|
s && /* @__PURE__ */ r(F, { profile: e }),
|
|
90
|
-
s ? /* @__PURE__ */ a(
|
|
91
|
+
s ? /* @__PURE__ */ a(S, { value: p, onValueChange: (d) => C(d), children: [
|
|
91
92
|
/* @__PURE__ */ r(
|
|
92
|
-
|
|
93
|
+
A,
|
|
93
94
|
{
|
|
94
95
|
className: "h-9 w-full justify-start gap-1 rounded-lg border border-slate-200 bg-white p-1 dark:border-border dark:bg-card",
|
|
95
96
|
"data-person-tabs": !0,
|
|
@@ -111,7 +112,7 @@ function Fe({
|
|
|
111
112
|
))
|
|
112
113
|
}
|
|
113
114
|
),
|
|
114
|
-
/* @__PURE__ */ r(i, { value: "overview", className: "mt-4 focus-visible:outline-none", children:
|
|
115
|
+
/* @__PURE__ */ r(i, { value: "overview", className: "mt-4 focus-visible:outline-none", children: u }),
|
|
115
116
|
/* @__PURE__ */ r(i, { value: "access", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
116
117
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
117
118
|
/* @__PURE__ */ r(M, { profile: e }),
|
|
@@ -138,17 +139,18 @@ function Fe({
|
|
|
138
139
|
/* @__PURE__ */ r("legend", { className: "sr-only", children: "Activity view" }),
|
|
139
140
|
[
|
|
140
141
|
["feed", "Feed"],
|
|
141
|
-
["day", "Day"]
|
|
142
|
+
["day", "Day"],
|
|
143
|
+
["speed", "Slow screens"]
|
|
142
144
|
].map(([d, m]) => /* @__PURE__ */ r(
|
|
143
145
|
"button",
|
|
144
146
|
{
|
|
145
147
|
type: "button",
|
|
146
|
-
"aria-pressed":
|
|
148
|
+
"aria-pressed": n === d,
|
|
147
149
|
"data-person-activity-view": d,
|
|
148
150
|
onClick: () => k(d),
|
|
149
|
-
className:
|
|
151
|
+
className: l(
|
|
150
152
|
"h-6 rounded-md px-3 text-[11.5px] font-medium",
|
|
151
|
-
|
|
153
|
+
n === d ? "bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
|
|
152
154
|
),
|
|
153
155
|
children: m
|
|
154
156
|
},
|
|
@@ -157,10 +159,10 @@ function Fe({
|
|
|
157
159
|
]
|
|
158
160
|
}
|
|
159
161
|
),
|
|
160
|
-
|
|
162
|
+
n === "day" && s ? /* @__PURE__ */ r(T, { userId: e.id }) : n === "speed" && s ? /* @__PURE__ */ r(ie, { userId: e.id, name: e.first_name ?? e.name }) : /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
161
163
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
162
164
|
/* @__PURE__ */ r(R, { userId: e.id }),
|
|
163
|
-
/* @__PURE__ */ r(
|
|
165
|
+
/* @__PURE__ */ r(le, { userId: e.id })
|
|
164
166
|
] }),
|
|
165
167
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
166
168
|
/* @__PURE__ */ r(V, { profile: e }),
|
|
@@ -168,7 +170,7 @@ function Fe({
|
|
|
168
170
|
] })
|
|
169
171
|
] })
|
|
170
172
|
] }),
|
|
171
|
-
/* @__PURE__ */ r(i, { value: "did", className: "mt-4 focus-visible:outline-none", children:
|
|
173
|
+
/* @__PURE__ */ r(i, { value: "did", className: "mt-4 focus-visible:outline-none", children: p === "did" && /* @__PURE__ */ r(Q, { userId: e.id, name: e.first_name ?? e.name }) }),
|
|
172
174
|
/* @__PURE__ */ r(i, { value: "tools", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
173
175
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
174
176
|
/* @__PURE__ */ r(H, { profile: e }),
|
|
@@ -181,11 +183,11 @@ function Fe({
|
|
|
181
183
|
/* @__PURE__ */ r(U, { userId: e.id, name: e.first_name ?? e.name })
|
|
182
184
|
] })
|
|
183
185
|
] }) })
|
|
184
|
-
] }) :
|
|
186
|
+
] }) : u
|
|
185
187
|
] });
|
|
186
188
|
}
|
|
187
|
-
function
|
|
188
|
-
return /* @__PURE__ */ a("div", { className:
|
|
189
|
+
function ce({ className: o }) {
|
|
190
|
+
return /* @__PURE__ */ a("div", { className: l("flex animate-pulse flex-col gap-4", o), "aria-busy": "true", children: [
|
|
189
191
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-5 rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
|
|
190
192
|
/* @__PURE__ */ r("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
|
|
191
193
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-2.5", children: [
|
|
@@ -201,5 +203,5 @@ function le({ className: o }) {
|
|
|
201
203
|
] });
|
|
202
204
|
}
|
|
203
205
|
export {
|
|
204
|
-
|
|
206
|
+
Oe as PersonProfile
|
|
205
207
|
};
|