Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- web/dist-embed/index.html +0 -0
- web/src/customer-grid/ColumnMenu.tsx +354 -311
- web/src/customer-grid/CustomerGrid.tsx +104 -6
- web/src/customer-grid/iconShapes.ts +1 -1
- web/src/customer-grid/useGridSelection.ts +42 -13
- web/src/index.css +161 -27
- web/src/shell/Shell.tsx +69 -6
web/dist-embed/index.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/ColumnMenu.tsx
CHANGED
|
@@ -60,19 +60,27 @@ interface ColumnMenuProps {
|
|
| 60 |
extra?: { formula?: string; max?: number; scope?: FieldScope }
|
| 61 |
) => void;
|
| 62 |
/**
|
| 63 |
-
* Wave-6 item 2
|
| 64 |
-
* type
|
| 65 |
-
* converted β unreadable cells show blank, disclosed in the
|
| 66 |
-
* the
|
|
|
|
| 67 |
*/
|
| 68 |
onRetype?: (
|
| 69 |
type: FieldType,
|
| 70 |
options?: string[],
|
| 71 |
-
extra?: { formula?: string; max?: number }
|
| 72 |
) => void;
|
| 73 |
/** Wave-6 item 5 β rename this created field (ordinary field_upsert with a new label).
|
| 74 |
* Supplied for creatable strata only. */
|
| 75 |
onRename?: (label: string) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
/** Wave-6 item 4 β open straight into the create form at this position (the header "+"
|
| 77 |
* passes "end"). Cancel then CLOSES rather than falling back to the action list. */
|
| 78 |
initialPosition?: CreatePosition;
|
|
@@ -259,12 +267,16 @@ function MenuLabel({ icon, text }: { icon: ReactNode; text: string }) {
|
|
| 259 |
}
|
| 260 |
|
| 261 |
/**
|
| 262 |
-
* The menu's panes (wave-5 item 2). The NOTE editor and
|
| 263 |
-
* the menu body; each
|
| 264 |
-
* permissions and format editors and wave-6's RENAME. One overlay, one pane at a time;
|
| 265 |
* "menu" is the action list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
*/
|
| 267 |
-
type MenuPane = "menu" | "note" | "
|
| 268 |
|
| 269 |
/**
|
| 270 |
* How each creatable type reads in the menu. DERIVED from CREATABLE_TYPES rather than listed
|
|
@@ -306,15 +318,22 @@ function TypePicker({
|
|
| 306 |
value,
|
| 307 |
onPick,
|
| 308 |
offerMeasure,
|
|
|
|
| 309 |
}: {
|
| 310 |
value: CreateKind;
|
| 311 |
onPick: (k: CreateKind) => void;
|
| 312 |
offerMeasure: boolean;
|
|
|
|
|
|
|
|
|
|
| 313 |
}) {
|
| 314 |
const [q, setQ] = useState("");
|
| 315 |
const needle = q.trim().toLowerCase();
|
|
|
|
|
|
|
|
|
|
| 316 |
const rows: { value: CreateKind; label: string }[] = [
|
| 317 |
-
...
|
| 318 |
...(offerMeasure
|
| 319 |
? [{ value: "measure" as CreateKind, label: "Formula measure (over a period)" }]
|
| 320 |
: []),
|
|
@@ -381,14 +400,11 @@ function TypePicker({
|
|
| 381 |
* (keys are slugs), so the prefix cannot collide with one. */
|
| 382 |
const NEW_PREFIX = "new:";
|
| 383 |
|
| 384 |
-
/** Wave-6 item 2 β the dropdown's RETYPE entries (created fields only). Same colon rule. */
|
| 385 |
-
const RETYPE_PREFIX = "retype:";
|
| 386 |
-
|
| 387 |
/**
|
| 388 |
-
* The types a created field may be retyped TO
|
| 389 |
-
* and `created_time` are a DIFFERENT stratum
|
| 390 |
-
* an overlay column into one is not a retype,
|
| 391 |
-
* `custom_` overlay defs only.
|
| 392 |
*/
|
| 393 |
const RETYPE_TYPES = CREATABLE_TYPES.filter(
|
| 394 |
(t) => t !== "formula" && t !== "created_time"
|
|
@@ -577,6 +593,7 @@ export default function ColumnMenu({
|
|
| 577 |
onCreateAndSwap,
|
| 578 |
onRetype,
|
| 579 |
onRename,
|
|
|
|
| 580 |
initialPosition,
|
| 581 |
scopeChoice = false,
|
| 582 |
pinnedTo = false,
|
|
@@ -634,23 +651,24 @@ export default function ColumnMenu({
|
|
| 634 |
const [fmtDraft, setFmtDraft] = useState<FieldFormat>(() => ({ ...(field.format ?? {}) }));
|
| 635 |
/** Item 9c β the create forms' Scope draft. 'cohort' is the DEFAULT per the contract. */
|
| 636 |
const [scopeDraft, setScopeDraft] = useState<FieldScope>("cohort");
|
| 637 |
-
/**
|
|
|
|
| 638 |
const [renameDraft, setRenameDraft] = useState(field.label);
|
| 639 |
-
/**
|
| 640 |
-
* retyped to multi select keeps its choices), star
|
|
|
|
|
|
|
| 641 |
const [retypeOptionText, setRetypeOptionText] = useState(
|
| 642 |
() => choiceOptions(field).join("\n") || "Not started\nIn progress\nBlocked\nDone"
|
| 643 |
);
|
| 644 |
const [retypeMaxValue, setRetypeMaxValue] = useState(() => ratingMax(field));
|
|
|
|
|
|
|
|
|
|
| 645 |
|
| 646 |
const swapToNewType = swapTo.startsWith(NEW_PREFIX)
|
| 647 |
? (swapTo.slice(NEW_PREFIX.length) as FieldType)
|
| 648 |
: null;
|
| 649 |
-
/** Item 2 β the swap pane's type half targets a RETYPE when the caller supplied one. */
|
| 650 |
-
const retypeTo =
|
| 651 |
-
onRetype && swapTo.startsWith(RETYPE_PREFIX)
|
| 652 |
-
? (swapTo.slice(RETYPE_PREFIX.length) as FieldType)
|
| 653 |
-
: null;
|
| 654 |
|
| 655 |
// A multiselect cell is a comma-JOINED set, so a comma cannot occur inside one choice β
|
| 656 |
// stripped at the source rather than warned about, the same way parseOptions collapses
|
|
@@ -661,9 +679,8 @@ export default function ColumnMenu({
|
|
| 661 |
const swapNewOptions = swapToNewType
|
| 662 |
? parseOptions(cleanOptionText(swapOptionText, swapToNewType))
|
| 663 |
: [];
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
: [];
|
| 667 |
|
| 668 |
// Wave-5 item 9, amended 2026-07-31 (owner item 2) β live formula validation for BOTH
|
| 669 |
// create surfaces. Refs may now name OTHER formula fields (evaluation is topological);
|
|
@@ -765,20 +782,57 @@ export default function ColumnMenu({
|
|
| 765 |
onClose();
|
| 766 |
};
|
| 767 |
|
| 768 |
-
//
|
| 769 |
-
//
|
| 770 |
-
//
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
onClose();
|
| 783 |
};
|
| 784 |
|
|
@@ -972,49 +1026,126 @@ export default function ColumnMenu({
|
|
| 972 |
);
|
| 973 |
}
|
| 974 |
|
| 975 |
-
// ------------------------------------------------------------
|
| 976 |
-
|
| 977 |
-
|
|
|
|
|
|
|
| 978 |
return (
|
| 979 |
<AnchoredOverlay
|
| 980 |
anchor={state.anchor}
|
| 981 |
className="cg-column-menu"
|
| 982 |
onDismiss={onClose}
|
| 983 |
role="dialog"
|
| 984 |
-
ariaLabel={`
|
| 985 |
initialFocus="[data-overlay-autofocus]"
|
| 986 |
dataKind="column-menu"
|
| 987 |
>
|
| 988 |
-
<PaneHead title="
|
| 989 |
<div className="cg-column-create">
|
| 990 |
-
|
| 991 |
-
<
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1004 |
/>
|
| 1005 |
-
|
| 1006 |
-
<div className="cg-field-hint">
|
| 1007 |
-
Saved views, filters and values follow the field β only its name changes.
|
| 1008 |
-
</div>
|
| 1009 |
<div className="cg-form-actions">
|
| 1010 |
<button
|
| 1011 |
type="button"
|
| 1012 |
className="cg-btn cg-btn--primary"
|
| 1013 |
-
disabled={!
|
| 1014 |
-
onClick={
|
| 1015 |
-
onRename?.(cleanRename);
|
| 1016 |
-
onClose();
|
| 1017 |
-
}}
|
| 1018 |
>
|
| 1019 |
Save
|
| 1020 |
</button>
|
|
@@ -1022,6 +1153,140 @@ export default function ColumnMenu({
|
|
| 1022 |
Back
|
| 1023 |
</button>
|
| 1024 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1025 |
</div>
|
| 1026 |
</AnchoredOverlay>
|
| 1027 |
);
|
|
@@ -1252,224 +1517,6 @@ export default function ColumnMenu({
|
|
| 1252 |
);
|
| 1253 |
}
|
| 1254 |
|
| 1255 |
-
// ------------------------------------------------------------------ SWAP pane (item 2)
|
| 1256 |
-
if (pane === "swap") {
|
| 1257 |
-
return (
|
| 1258 |
-
<AnchoredOverlay
|
| 1259 |
-
anchor={state.anchor}
|
| 1260 |
-
className="cg-column-menu"
|
| 1261 |
-
onDismiss={onClose}
|
| 1262 |
-
role="dialog"
|
| 1263 |
-
ariaLabel={`Change field ${field.label}`}
|
| 1264 |
-
initialFocus="[data-overlay-autofocus]"
|
| 1265 |
-
dataKind="column-menu"
|
| 1266 |
-
>
|
| 1267 |
-
<PaneHead title="Change field" sub={`Currently ${field.label}`} onClose={onClose} />
|
| 1268 |
-
<div className="cg-column-swap">
|
| 1269 |
-
<select
|
| 1270 |
-
className="cg-select cg-swap-select"
|
| 1271 |
-
data-overlay-autofocus
|
| 1272 |
-
value={swapTo}
|
| 1273 |
-
aria-label="Change this column to another field"
|
| 1274 |
-
onChange={(event) => setSwapTo(event.target.value)}
|
| 1275 |
-
>
|
| 1276 |
-
<option value="">Choose a fieldβ¦</option>
|
| 1277 |
-
{presetSwap.length > 0 && (
|
| 1278 |
-
<optgroup label="Pre-set fields">
|
| 1279 |
-
{presetSwap.map((f) => (
|
| 1280 |
-
<option key={f.key} value={f.key}>
|
| 1281 |
-
{f.label}
|
| 1282 |
-
</option>
|
| 1283 |
-
))}
|
| 1284 |
-
</optgroup>
|
| 1285 |
-
)}
|
| 1286 |
-
{yourSwap.length > 0 && (
|
| 1287 |
-
<optgroup label="Your fields">
|
| 1288 |
-
{yourSwap.map((f) => (
|
| 1289 |
-
<option key={f.key} value={f.key}>
|
| 1290 |
-
{f.label}
|
| 1291 |
-
</option>
|
| 1292 |
-
))}
|
| 1293 |
-
</optgroup>
|
| 1294 |
-
)}
|
| 1295 |
-
{/* Item 2: on a CREATED field the type half RETYPES IN PLACE β the owner's ask
|
| 1296 |
-
("change field on a field I created must retype that field"), replacing the
|
| 1297 |
-
add-a-new-field route. Other fields keep the create-and-swap flow. */}
|
| 1298 |
-
{onRetype ? (
|
| 1299 |
-
<optgroup label="Change field type">
|
| 1300 |
-
{RETYPE_TYPES.map((t) => (
|
| 1301 |
-
<option key={t} value={RETYPE_PREFIX + t}>
|
| 1302 |
-
{TYPE_LABELS[t]}
|
| 1303 |
-
</option>
|
| 1304 |
-
))}
|
| 1305 |
-
</optgroup>
|
| 1306 |
-
) : (
|
| 1307 |
-
<optgroup label="New field">
|
| 1308 |
-
{FIELD_TYPES.map((t) => (
|
| 1309 |
-
<option key={t.value} value={NEW_PREFIX + t.value}>
|
| 1310 |
-
{t.label}
|
| 1311 |
-
</option>
|
| 1312 |
-
))}
|
| 1313 |
-
</optgroup>
|
| 1314 |
-
)}
|
| 1315 |
-
</select>
|
| 1316 |
-
{!swapToNewType && !retypeTo && (
|
| 1317 |
-
<button
|
| 1318 |
-
type="button"
|
| 1319 |
-
className="cg-btn cg-btn--primary"
|
| 1320 |
-
disabled={!swapTo}
|
| 1321 |
-
onClick={() => {
|
| 1322 |
-
onChangeField(swapTo);
|
| 1323 |
-
onClose();
|
| 1324 |
-
}}
|
| 1325 |
-
>
|
| 1326 |
-
Change
|
| 1327 |
-
</button>
|
| 1328 |
-
)}
|
| 1329 |
-
<div className="cg-field-hint">
|
| 1330 |
-
The current field is hidden, not lost β find it under Fields.
|
| 1331 |
-
</div>
|
| 1332 |
-
</div>
|
| 1333 |
-
{/* Item 2 β the RETYPE form: same key, same name, same values; only the type (and
|
| 1334 |
-
its choices/stars) changes. Values are never converted β that is stated, not
|
| 1335 |
-
hidden. */}
|
| 1336 |
-
{retypeTo && (
|
| 1337 |
-
<div className="cg-column-create cg-swap-create">
|
| 1338 |
-
<div className="cg-field-hint">
|
| 1339 |
-
{retypeTo === field.type
|
| 1340 |
-
? `${field.label} is already a ${TYPE_LABELS[retypeTo].toLowerCase()} field.`
|
| 1341 |
-
: `Changes ${field.label} into a ${TYPE_LABELS[retypeTo].toLowerCase()} ` +
|
| 1342 |
-
"field, keeping its name and its values as entered. Cells that cannot be " +
|
| 1343 |
-
"read in the new type show blank."}
|
| 1344 |
-
</div>
|
| 1345 |
-
{retypeTo === "rating" && (
|
| 1346 |
-
<label>
|
| 1347 |
-
<span>Number of stars</span>
|
| 1348 |
-
<input
|
| 1349 |
-
className="cg-input cg-rating-max"
|
| 1350 |
-
type="number"
|
| 1351 |
-
min={2}
|
| 1352 |
-
max={10}
|
| 1353 |
-
value={retypeMaxValue}
|
| 1354 |
-
aria-label="Number of stars"
|
| 1355 |
-
onChange={(event) => {
|
| 1356 |
-
const n = Math.round(Number(event.target.value));
|
| 1357 |
-
setRetypeMaxValue(
|
| 1358 |
-
Number.isFinite(n) ? Math.max(2, Math.min(10, n)) : 5
|
| 1359 |
-
);
|
| 1360 |
-
}}
|
| 1361 |
-
/>
|
| 1362 |
-
</label>
|
| 1363 |
-
)}
|
| 1364 |
-
{needsOptions(retypeTo) && (
|
| 1365 |
-
<label>
|
| 1366 |
-
<span>Choices β one per line</span>
|
| 1367 |
-
<textarea
|
| 1368 |
-
className="cg-input cg-option-editor"
|
| 1369 |
-
rows={4}
|
| 1370 |
-
value={retypeOptionText}
|
| 1371 |
-
placeholder={"Not started\nIn progress\nDone"}
|
| 1372 |
-
onChange={(event) => setRetypeOptionText(event.target.value)}
|
| 1373 |
-
/>
|
| 1374 |
-
<span className="cg-field-hint">
|
| 1375 |
-
{retypeOptions.length} choice{retypeOptions.length === 1 ? "" : "s"}. A
|
| 1376 |
-
choice list is required before the change can apply.
|
| 1377 |
-
{retypeTo === "multiselect" && " Commas inside a choice are not supported."}
|
| 1378 |
-
</span>
|
| 1379 |
-
</label>
|
| 1380 |
-
)}
|
| 1381 |
-
<div className="cg-form-actions">
|
| 1382 |
-
<button
|
| 1383 |
-
type="button"
|
| 1384 |
-
className="cg-btn cg-btn--primary"
|
| 1385 |
-
disabled={!canRetype}
|
| 1386 |
-
onClick={applyRetype}
|
| 1387 |
-
>
|
| 1388 |
-
Change type
|
| 1389 |
-
</button>
|
| 1390 |
-
<button type="button" className="cg-btn" onClick={() => setSwapTo("")}>
|
| 1391 |
-
Cancel
|
| 1392 |
-
</button>
|
| 1393 |
-
</div>
|
| 1394 |
-
</div>
|
| 1395 |
-
)}
|
| 1396 |
-
{/* The "New field" half: name it (and give it choices/its formula/its stars when the
|
| 1397 |
-
type needs them), then create-and-swap in one motion. */}
|
| 1398 |
-
{swapToNewType && (
|
| 1399 |
-
<div className="cg-column-create cg-swap-create">
|
| 1400 |
-
<label>
|
| 1401 |
-
<span>New {TYPE_LABELS[swapToNewType].toLowerCase()} field</span>
|
| 1402 |
-
<input
|
| 1403 |
-
className="cg-input"
|
| 1404 |
-
autoFocus
|
| 1405 |
-
value={swapLabel}
|
| 1406 |
-
placeholder="Field name"
|
| 1407 |
-
onChange={(event) => setSwapLabel(event.target.value)}
|
| 1408 |
-
onKeyDown={(event) => event.key === "Enter" && createAndSwap()}
|
| 1409 |
-
/>
|
| 1410 |
-
</label>
|
| 1411 |
-
<ExtraTypeEditor
|
| 1412 |
-
kind={swapToNewType}
|
| 1413 |
-
fields={fields}
|
| 1414 |
-
formulaText={swapFormulaText}
|
| 1415 |
-
onFormulaText={setSwapFormulaText}
|
| 1416 |
-
formulaError={swapFormulaCheck.ok ? null : swapFormulaCheck.error ?? null}
|
| 1417 |
-
maxValue={swapMaxValue}
|
| 1418 |
-
onMaxValue={setSwapMaxValue}
|
| 1419 |
-
idPrefix="cg-swap"
|
| 1420 |
-
/>
|
| 1421 |
-
{needsOptions(swapToNewType) && (
|
| 1422 |
-
<label>
|
| 1423 |
-
<span>Choices β one per line</span>
|
| 1424 |
-
<textarea
|
| 1425 |
-
className="cg-input cg-option-editor"
|
| 1426 |
-
rows={4}
|
| 1427 |
-
value={swapOptionText}
|
| 1428 |
-
placeholder={"Not started\nIn progress\nDone"}
|
| 1429 |
-
onChange={(event) => setSwapOptionText(event.target.value)}
|
| 1430 |
-
/>
|
| 1431 |
-
<span className="cg-field-hint">
|
| 1432 |
-
{swapNewOptions.length} choice{swapNewOptions.length === 1 ? "" : "s"}.
|
| 1433 |
-
{swapToNewType === "multiselect" && " Commas inside a choice are not supported."}
|
| 1434 |
-
</span>
|
| 1435 |
-
</label>
|
| 1436 |
-
)}
|
| 1437 |
-
{swapToNewType === "user" && (
|
| 1438 |
-
<div className="cg-field-hint">
|
| 1439 |
-
{userOptions.length
|
| 1440 |
-
? `${userOptions.length} people can be assigned.`
|
| 1441 |
-
: "No user list was supplied by the host yet."}
|
| 1442 |
-
</div>
|
| 1443 |
-
)}
|
| 1444 |
-
{scopeChoice && <ScopeControl value={scopeDraft} onValue={setScopeDraft} />}
|
| 1445 |
-
<div className="cg-form-actions">
|
| 1446 |
-
<button
|
| 1447 |
-
type="button"
|
| 1448 |
-
className="cg-btn cg-btn--primary"
|
| 1449 |
-
disabled={!canCreateSwap}
|
| 1450 |
-
onClick={createAndSwap}
|
| 1451 |
-
>
|
| 1452 |
-
Create and change
|
| 1453 |
-
</button>
|
| 1454 |
-
<button
|
| 1455 |
-
type="button"
|
| 1456 |
-
className="cg-btn"
|
| 1457 |
-
onClick={() => setSwapTo("")}
|
| 1458 |
-
>
|
| 1459 |
-
Cancel
|
| 1460 |
-
</button>
|
| 1461 |
-
</div>
|
| 1462 |
-
</div>
|
| 1463 |
-
)}
|
| 1464 |
-
<div className="cg-form-actions">
|
| 1465 |
-
<button type="button" className="cg-btn" onClick={() => setPane("menu")}>
|
| 1466 |
-
Back
|
| 1467 |
-
</button>
|
| 1468 |
-
</div>
|
| 1469 |
-
</AnchoredOverlay>
|
| 1470 |
-
);
|
| 1471 |
-
}
|
| 1472 |
-
|
| 1473 |
// ------------------------------------------------------------------ the MENU pane
|
| 1474 |
// Wave-5 items 1/2/3: a flat action list. Editors open their OWN windows (the panes above);
|
| 1475 |
// nothing edits inline here. Conditional entries render IFF they apply to the current view.
|
|
@@ -1523,15 +1570,26 @@ export default function ColumnMenu({
|
|
| 1523 |
an icon on EVERY action. Presentation only β every handler and event is the one it
|
| 1524 |
was before; entries not in Airtable's list slot into the nearest sensible group. */}
|
| 1525 |
<div className="cg-column-actions">
|
| 1526 |
-
{/*
|
| 1527 |
-
|
| 1528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1529 |
{onDuplicate && (
|
| 1530 |
-
<button type="button"
|
| 1531 |
<MenuLabel icon={MenuIcons.duplicate} text="Duplicate field" />
|
| 1532 |
</button>
|
| 1533 |
)}
|
| 1534 |
-
<button type="button"
|
| 1535 |
<MenuLabel icon={MenuIcons.insertLeft} text="Insert field left" />
|
| 1536 |
</button>
|
| 1537 |
<button type="button" onClick={() => setPosition("right")}>
|
|
@@ -1543,19 +1601,9 @@ export default function ColumnMenu({
|
|
| 1543 |
|
| 1544 |
<div className="cg-menu-sep" role="separator" aria-hidden />
|
| 1545 |
|
| 1546 |
-
{/* Group 2 β the
|
| 1547 |
-
|
| 1548 |
-
|
| 1549 |
-
<button
|
| 1550 |
-
type="button"
|
| 1551 |
-
onClick={() => {
|
| 1552 |
-
setRenameDraft(field.label);
|
| 1553 |
-
setPane("rename");
|
| 1554 |
-
}}
|
| 1555 |
-
>
|
| 1556 |
-
<MenuLabel icon={MenuIcons.rename} text="Rename field" />
|
| 1557 |
-
</button>
|
| 1558 |
-
)}
|
| 1559 |
<button type="button" onClick={() => setPane("note")}>
|
| 1560 |
<MenuLabel icon={MenuIcons.description} text="Edit field description" />
|
| 1561 |
</button>
|
|
@@ -1569,11 +1617,6 @@ export default function ColumnMenu({
|
|
| 1569 |
<MenuLabel icon={MenuIcons.format} text="Field format" />
|
| 1570 |
</button>
|
| 1571 |
)}
|
| 1572 |
-
{!locked && swapOptions.length > 0 && (
|
| 1573 |
-
<button type="button" onClick={() => setPane("swap")}>
|
| 1574 |
-
<MenuLabel icon={MenuIcons.swap} text="Change field" />
|
| 1575 |
-
</button>
|
| 1576 |
-
)}
|
| 1577 |
|
| 1578 |
<div className="cg-menu-sep" role="separator" aria-hidden />
|
| 1579 |
|
|
|
|
| 60 |
extra?: { formula?: string; max?: number; scope?: FieldScope }
|
| 61 |
) => void;
|
| 62 |
/**
|
| 63 |
+
* Wave-6 item 2, re-homed by owner item 8 (2026-07-31): supplied for CREATED (`custom_`)
|
| 64 |
+
* fields only β the EDIT FIELD pane's type picker RETYPES THIS FIELD IN PLACE (same key,
|
| 65 |
+
* new type/options; values never converted β unreadable cells show blank, disclosed in the
|
| 66 |
+
* pane). `extra.label` rides along when the name changed in the same save, so rename+retype
|
| 67 |
+
* is ONE upsert β two sequential emits would each read the stale def and revert the other.
|
| 68 |
*/
|
| 69 |
onRetype?: (
|
| 70 |
type: FieldType,
|
| 71 |
options?: string[],
|
| 72 |
+
extra?: { formula?: string; max?: number; label?: string }
|
| 73 |
) => void;
|
| 74 |
/** Wave-6 item 5 β rename this created field (ordinary field_upsert with a new label).
|
| 75 |
* Supplied for creatable strata only. */
|
| 76 |
onRename?: (label: string) => void;
|
| 77 |
+
/**
|
| 78 |
+
* Owner item 8 (2026-07-31) β edit a FORMULA field's source in place (the Edit-field pane's
|
| 79 |
+
* per-type editor for the formula type, validated with the field itself as selfKey so a
|
| 80 |
+
* cycle is refused at authoring). `label` rides along exactly like onRetype's β one upsert.
|
| 81 |
+
* Supplied for created formula fields only.
|
| 82 |
+
*/
|
| 83 |
+
onFormula?: (formula: string, label?: string) => void;
|
| 84 |
/** Wave-6 item 4 β open straight into the create form at this position (the header "+"
|
| 85 |
* passes "end"). Cancel then CLOSES rather than falling back to the action list. */
|
| 86 |
initialPosition?: CreatePosition;
|
|
|
|
| 267 |
}
|
| 268 |
|
| 269 |
/**
|
| 270 |
+
* The menu's panes (wave-5 item 2). The NOTE editor and the editors used to render inline in
|
| 271 |
+
* the menu body; each opens its OWN dedicated window. One overlay, one pane at a time;
|
|
|
|
| 272 |
* "menu" is the action list.
|
| 273 |
+
*
|
| 274 |
+
* Owner item 8 (2026-07-31): "edit" ABSORBS the former "rename" and "swap" panes β one
|
| 275 |
+
* Airtable-grade Edit-field window owning the field's name, its type (with the per-type
|
| 276 |
+
* choices/stars/formula config), and the Change-field control that swaps the column to show
|
| 277 |
+
* another field.
|
| 278 |
*/
|
| 279 |
+
type MenuPane = "menu" | "note" | "edit" | "permissions" | "format";
|
| 280 |
|
| 281 |
/**
|
| 282 |
* How each creatable type reads in the menu. DERIVED from CREATABLE_TYPES rather than listed
|
|
|
|
| 318 |
value,
|
| 319 |
onPick,
|
| 320 |
offerMeasure,
|
| 321 |
+
only,
|
| 322 |
}: {
|
| 323 |
value: CreateKind;
|
| 324 |
onPick: (k: CreateKind) => void;
|
| 325 |
offerMeasure: boolean;
|
| 326 |
+
/** Restrict the list (the Edit-field pane passes RETYPE_TYPES β the overlay-editable
|
| 327 |
+
* strata a created field may become). Absent = every creatable type. */
|
| 328 |
+
only?: readonly FieldType[];
|
| 329 |
}) {
|
| 330 |
const [q, setQ] = useState("");
|
| 331 |
const needle = q.trim().toLowerCase();
|
| 332 |
+
const base = only
|
| 333 |
+
? FIELD_TYPES.filter((r) => (only as readonly string[]).includes(r.value))
|
| 334 |
+
: FIELD_TYPES;
|
| 335 |
const rows: { value: CreateKind; label: string }[] = [
|
| 336 |
+
...base,
|
| 337 |
...(offerMeasure
|
| 338 |
? [{ value: "measure" as CreateKind, label: "Formula measure (over a period)" }]
|
| 339 |
: []),
|
|
|
|
| 400 |
* (keys are slugs), so the prefix cannot collide with one. */
|
| 401 |
const NEW_PREFIX = "new:";
|
| 402 |
|
|
|
|
|
|
|
|
|
|
| 403 |
/**
|
| 404 |
+
* The types a created field may be retyped TO (the Edit-field pane's type picker): the
|
| 405 |
+
* overlay-editable strata only. `formula` and `created_time` are a DIFFERENT stratum
|
| 406 |
+
* (source 'odoo', host-computed shape) β turning an overlay column into one is not a retype,
|
| 407 |
+
* and the host accepts in-place rebuilds on `custom_` overlay defs only.
|
| 408 |
*/
|
| 409 |
const RETYPE_TYPES = CREATABLE_TYPES.filter(
|
| 410 |
(t) => t !== "formula" && t !== "created_time"
|
|
|
|
| 593 |
onCreateAndSwap,
|
| 594 |
onRetype,
|
| 595 |
onRename,
|
| 596 |
+
onFormula,
|
| 597 |
initialPosition,
|
| 598 |
scopeChoice = false,
|
| 599 |
pinnedTo = false,
|
|
|
|
| 651 |
const [fmtDraft, setFmtDraft] = useState<FieldFormat>(() => ({ ...(field.format ?? {}) }));
|
| 652 |
/** Item 9c β the create forms' Scope draft. 'cohort' is the DEFAULT per the contract. */
|
| 653 |
const [scopeDraft, setScopeDraft] = useState<FieldScope>("cohort");
|
| 654 |
+
/** The Edit pane's NAME draft, seeded from the current label (wave-6 item 5's rename,
|
| 655 |
+
* re-homed into the Edit-field pane by owner item 8). */
|
| 656 |
const [renameDraft, setRenameDraft] = useState(field.label);
|
| 657 |
+
/** Owner item 8 β the Edit pane's TYPE draft plus the per-type config drafts: options
|
| 658 |
+
* prefilled from the field (a select retyped to multi select keeps its choices), star
|
| 659 |
+
* count from the field's own max, formula source from the field's own source. */
|
| 660 |
+
const [editType, setEditType] = useState<FieldType>(field.type);
|
| 661 |
const [retypeOptionText, setRetypeOptionText] = useState(
|
| 662 |
() => choiceOptions(field).join("\n") || "Not started\nIn progress\nBlocked\nDone"
|
| 663 |
);
|
| 664 |
const [retypeMaxValue, setRetypeMaxValue] = useState(() => ratingMax(field));
|
| 665 |
+
const [editFormulaText, setEditFormulaText] = useState(() =>
|
| 666 |
+
typeof field.formula === "string" ? field.formula : ""
|
| 667 |
+
);
|
| 668 |
|
| 669 |
const swapToNewType = swapTo.startsWith(NEW_PREFIX)
|
| 670 |
? (swapTo.slice(NEW_PREFIX.length) as FieldType)
|
| 671 |
: null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
|
| 673 |
// A multiselect cell is a comma-JOINED set, so a comma cannot occur inside one choice β
|
| 674 |
// stripped at the source rather than warned about, the same way parseOptions collapses
|
|
|
|
| 679 |
const swapNewOptions = swapToNewType
|
| 680 |
? parseOptions(cleanOptionText(swapOptionText, swapToNewType))
|
| 681 |
: [];
|
| 682 |
+
/** Owner item 8 β the Edit pane's parsed choices for the drafted type. */
|
| 683 |
+
const editOptions = parseOptions(cleanOptionText(retypeOptionText, editType));
|
|
|
|
| 684 |
|
| 685 |
// Wave-5 item 9, amended 2026-07-31 (owner item 2) β live formula validation for BOTH
|
| 686 |
// create surfaces. Refs may now name OTHER formula fields (evaluation is topological);
|
|
|
|
| 782 |
onClose();
|
| 783 |
};
|
| 784 |
|
| 785 |
+
// ------------------------------------------------------- owner item 8: Edit-field dirties
|
| 786 |
+
// ONE Save applies whatever changed β name, type, choices, stars, formula source β and it
|
| 787 |
+
// must leave as ONE upsert when several changed together: sequential emits each read the
|
| 788 |
+
// stale def and the second reverts the first (label rides extra.label / onFormula's label).
|
| 789 |
+
const cleanRename = renameDraft.trim();
|
| 790 |
+
const editNameDirty = !!onRename && cleanRename !== "" && cleanRename !== field.label;
|
| 791 |
+
const editOptionsChanged =
|
| 792 |
+
needsOptions(editType) &&
|
| 793 |
+
editOptions.join("\n") !== choiceOptions(field).join("\n");
|
| 794 |
+
const editStarsChanged = editType === "rating" && retypeMaxValue !== ratingMax(field);
|
| 795 |
+
/** The type half was touched: a different type, or the SAME type with edited choices/stars
|
| 796 |
+
* (the owner's named case β "change the list of the single selections"). */
|
| 797 |
+
const editRetypeTouched =
|
| 798 |
+
onRetype != null &&
|
| 799 |
+
(editType !== field.type || editOptionsChanged || editStarsChanged);
|
| 800 |
+
const editRetypeValid = !needsOptions(editType) || editOptions.length > 0;
|
| 801 |
+
const editFormulaCheck = useMemo(
|
| 802 |
+
() =>
|
| 803 |
+
editFormulaText.trim() === ""
|
| 804 |
+
? { ok: false, error: "Type a formula", refs: [] as string[] }
|
| 805 |
+
: validateFormula(editFormulaText, knownKeys, formulaSources, field.key),
|
| 806 |
+
[editFormulaText, knownKeys, formulaSources, field.key]
|
| 807 |
+
);
|
| 808 |
+
const editFormulaTouched =
|
| 809 |
+
!!onFormula &&
|
| 810 |
+
field.type === "formula" &&
|
| 811 |
+
editFormulaText.trim() !==
|
| 812 |
+
(typeof field.formula === "string" ? field.formula.trim() : "");
|
| 813 |
+
// A touched-but-invalid half BLOCKS the whole save β otherwise Save would apply the name
|
| 814 |
+
// and silently drop the half-finished type change beside it.
|
| 815 |
+
const editBlocked =
|
| 816 |
+
(editRetypeTouched && !editRetypeValid) ||
|
| 817 |
+
(editFormulaTouched && !editFormulaCheck.ok);
|
| 818 |
+
const canSaveEdit =
|
| 819 |
+
!editBlocked && (editNameDirty || editRetypeTouched || editFormulaTouched);
|
| 820 |
+
const applyEdit = () => {
|
| 821 |
+
if (!canSaveEdit) return;
|
| 822 |
+
if (editRetypeTouched && onRetype) {
|
| 823 |
+
onRetype(
|
| 824 |
+
editType,
|
| 825 |
+
needsOptions(editType) ? editOptions : undefined,
|
| 826 |
+
{
|
| 827 |
+
...(editType === "rating" ? { max: retypeMaxValue } : {}),
|
| 828 |
+
...(editNameDirty ? { label: cleanRename } : {}),
|
| 829 |
+
}
|
| 830 |
+
);
|
| 831 |
+
} else if (editFormulaTouched && onFormula) {
|
| 832 |
+
onFormula(editFormulaText.trim(), editNameDirty ? cleanRename : undefined);
|
| 833 |
+
} else if (editNameDirty && onRename) {
|
| 834 |
+
onRename(cleanRename);
|
| 835 |
+
}
|
| 836 |
onClose();
|
| 837 |
};
|
| 838 |
|
|
|
|
| 1026 |
);
|
| 1027 |
}
|
| 1028 |
|
| 1029 |
+
// ------------------------------------------------------------ EDIT FIELD pane (item 8)
|
| 1030 |
+
// Owner item 8 (2026-07-31): ONE window owning the field's identity β name, type (with the
|
| 1031 |
+
// per-type choices/stars/formula editors), and the Change-field control. Absorbs the former
|
| 1032 |
+
// Rename and Change-field panes.
|
| 1033 |
+
if (pane === "edit") {
|
| 1034 |
return (
|
| 1035 |
<AnchoredOverlay
|
| 1036 |
anchor={state.anchor}
|
| 1037 |
className="cg-column-menu"
|
| 1038 |
onDismiss={onClose}
|
| 1039 |
role="dialog"
|
| 1040 |
+
ariaLabel={`Edit field ${field.label}`}
|
| 1041 |
initialFocus="[data-overlay-autofocus]"
|
| 1042 |
dataKind="column-menu"
|
| 1043 |
>
|
| 1044 |
+
<PaneHead title="Edit field" sub={typeLine} onClose={onClose} />
|
| 1045 |
<div className="cg-column-create">
|
| 1046 |
+
{onRename ? (
|
| 1047 |
+
<label>
|
| 1048 |
+
<span>Name</span>
|
| 1049 |
+
<input
|
| 1050 |
+
className="cg-input"
|
| 1051 |
+
autoFocus
|
| 1052 |
+
data-overlay-autofocus
|
| 1053 |
+
value={renameDraft}
|
| 1054 |
+
onChange={(event) => setRenameDraft(event.target.value)}
|
| 1055 |
+
onKeyDown={(event) => event.key === "Enter" && applyEdit()}
|
| 1056 |
+
/>
|
| 1057 |
+
</label>
|
| 1058 |
+
) : (
|
| 1059 |
+
<label>
|
| 1060 |
+
<span>Name</span>
|
| 1061 |
+
<input
|
| 1062 |
+
className="cg-input"
|
| 1063 |
+
value={field.label}
|
| 1064 |
+
disabled
|
| 1065 |
+
aria-label="Field name (read-only)"
|
| 1066 |
+
/>
|
| 1067 |
+
<span className="cg-field-hint">
|
| 1068 |
+
A source field keeps its name and type from the data source.
|
| 1069 |
+
</span>
|
| 1070 |
+
</label>
|
| 1071 |
+
)}
|
| 1072 |
+
{onRetype && (
|
| 1073 |
+
<>
|
| 1074 |
+
<div className="cg-type-block">
|
| 1075 |
+
<span className="cg-type-title">Field type</span>
|
| 1076 |
+
{/* The same find-box-over-icon-listbox the create pane wears (owner item 8 of
|
| 1077 |
+
the PREVIOUS wave) β one control for "pick a type" everywhere. */}
|
| 1078 |
+
<TypePicker
|
| 1079 |
+
value={editType}
|
| 1080 |
+
onPick={(k) => setEditType(k as FieldType)}
|
| 1081 |
+
offerMeasure={false}
|
| 1082 |
+
only={RETYPE_TYPES}
|
| 1083 |
+
/>
|
| 1084 |
+
</div>
|
| 1085 |
+
{editType === "rating" && (
|
| 1086 |
+
<label>
|
| 1087 |
+
<span>Number of stars</span>
|
| 1088 |
+
<input
|
| 1089 |
+
className="cg-input cg-rating-max"
|
| 1090 |
+
type="number"
|
| 1091 |
+
min={2}
|
| 1092 |
+
max={10}
|
| 1093 |
+
value={retypeMaxValue}
|
| 1094 |
+
aria-label="Number of stars"
|
| 1095 |
+
onChange={(event) => {
|
| 1096 |
+
const n = Math.round(Number(event.target.value));
|
| 1097 |
+
setRetypeMaxValue(
|
| 1098 |
+
Number.isFinite(n) ? Math.max(2, Math.min(10, n)) : 5
|
| 1099 |
+
);
|
| 1100 |
+
}}
|
| 1101 |
+
/>
|
| 1102 |
+
</label>
|
| 1103 |
+
)}
|
| 1104 |
+
{needsOptions(editType) && (
|
| 1105 |
+
<label>
|
| 1106 |
+
<span>Choices β one per line</span>
|
| 1107 |
+
<textarea
|
| 1108 |
+
className="cg-input cg-option-editor"
|
| 1109 |
+
rows={4}
|
| 1110 |
+
value={retypeOptionText}
|
| 1111 |
+
placeholder={"Not started\nIn progress\nDone"}
|
| 1112 |
+
onChange={(event) => setRetypeOptionText(event.target.value)}
|
| 1113 |
+
/>
|
| 1114 |
+
<span className="cg-field-hint">
|
| 1115 |
+
{editOptions.length} choice{editOptions.length === 1 ? "" : "s"}.
|
| 1116 |
+
Removing a choice blanks the cells that used it.
|
| 1117 |
+
{editType === "multiselect" &&
|
| 1118 |
+
" Commas inside a choice are not supported."}
|
| 1119 |
+
</span>
|
| 1120 |
+
</label>
|
| 1121 |
+
)}
|
| 1122 |
+
{editType !== field.type && (
|
| 1123 |
+
<div className="cg-field-hint">
|
| 1124 |
+
Changes {field.label} into a {TYPE_LABELS[editType].toLowerCase()} field,
|
| 1125 |
+
keeping its name and its values as entered. Cells that cannot be read in
|
| 1126 |
+
the new type show blank.
|
| 1127 |
+
</div>
|
| 1128 |
+
)}
|
| 1129 |
+
</>
|
| 1130 |
+
)}
|
| 1131 |
+
{!onRetype && field.type === "formula" && onFormula && (
|
| 1132 |
+
<ExtraTypeEditor
|
| 1133 |
+
kind="formula"
|
| 1134 |
+
fields={fields}
|
| 1135 |
+
formulaText={editFormulaText}
|
| 1136 |
+
onFormulaText={setEditFormulaText}
|
| 1137 |
+
formulaError={editFormulaCheck.ok ? null : editFormulaCheck.error ?? null}
|
| 1138 |
+
maxValue={retypeMaxValue}
|
| 1139 |
+
onMaxValue={setRetypeMaxValue}
|
| 1140 |
+
idPrefix="cg-edit"
|
| 1141 |
/>
|
| 1142 |
+
)}
|
|
|
|
|
|
|
|
|
|
| 1143 |
<div className="cg-form-actions">
|
| 1144 |
<button
|
| 1145 |
type="button"
|
| 1146 |
className="cg-btn cg-btn--primary"
|
| 1147 |
+
disabled={!canSaveEdit}
|
| 1148 |
+
onClick={applyEdit}
|
|
|
|
|
|
|
|
|
|
| 1149 |
>
|
| 1150 |
Save
|
| 1151 |
</button>
|
|
|
|
| 1153 |
Back
|
| 1154 |
</button>
|
| 1155 |
</div>
|
| 1156 |
+
{/* -------- Change field (owner item 9, folded in here by owner item 8) -------- */}
|
| 1157 |
+
{!locked && swapOptions.length > 0 && (
|
| 1158 |
+
<div className="cg-edit-swap">
|
| 1159 |
+
<span className="cg-type-title">Change field</span>
|
| 1160 |
+
<div className="cg-field-hint">
|
| 1161 |
+
Show a different field in this column β the current one is hidden, not lost.
|
| 1162 |
+
</div>
|
| 1163 |
+
<div className="cg-column-swap">
|
| 1164 |
+
<select
|
| 1165 |
+
className="cg-select cg-swap-select"
|
| 1166 |
+
// Focus falls here when the pane has no editable Name (a read-only source
|
| 1167 |
+
// field): the swap select is then the pane's first live control.
|
| 1168 |
+
data-overlay-autofocus={onRename ? undefined : true}
|
| 1169 |
+
value={swapTo}
|
| 1170 |
+
aria-label="Change this column to another field"
|
| 1171 |
+
onChange={(event) => setSwapTo(event.target.value)}
|
| 1172 |
+
>
|
| 1173 |
+
<option value="">Choose a fieldβ¦</option>
|
| 1174 |
+
{presetSwap.length > 0 && (
|
| 1175 |
+
<optgroup label="Pre-set fields">
|
| 1176 |
+
{presetSwap.map((f) => (
|
| 1177 |
+
<option key={f.key} value={f.key}>
|
| 1178 |
+
{f.label}
|
| 1179 |
+
</option>
|
| 1180 |
+
))}
|
| 1181 |
+
</optgroup>
|
| 1182 |
+
)}
|
| 1183 |
+
{yourSwap.length > 0 && (
|
| 1184 |
+
<optgroup label="Your fields">
|
| 1185 |
+
{yourSwap.map((f) => (
|
| 1186 |
+
<option key={f.key} value={f.key}>
|
| 1187 |
+
{f.label}
|
| 1188 |
+
</option>
|
| 1189 |
+
))}
|
| 1190 |
+
</optgroup>
|
| 1191 |
+
)}
|
| 1192 |
+
<optgroup label="New field">
|
| 1193 |
+
{FIELD_TYPES.map((t) => (
|
| 1194 |
+
<option key={t.value} value={NEW_PREFIX + t.value}>
|
| 1195 |
+
{t.label}
|
| 1196 |
+
</option>
|
| 1197 |
+
))}
|
| 1198 |
+
</optgroup>
|
| 1199 |
+
</select>
|
| 1200 |
+
{!swapToNewType && (
|
| 1201 |
+
<button
|
| 1202 |
+
type="button"
|
| 1203 |
+
className="cg-btn cg-btn--primary"
|
| 1204 |
+
disabled={!swapTo}
|
| 1205 |
+
onClick={() => {
|
| 1206 |
+
onChangeField(swapTo);
|
| 1207 |
+
onClose();
|
| 1208 |
+
}}
|
| 1209 |
+
>
|
| 1210 |
+
Change
|
| 1211 |
+
</button>
|
| 1212 |
+
)}
|
| 1213 |
+
</div>
|
| 1214 |
+
{/* The "New field" half: name it (and give it choices/its formula/its stars
|
| 1215 |
+
when the type needs them), then create-and-swap in one motion. */}
|
| 1216 |
+
{swapToNewType && (
|
| 1217 |
+
<div className="cg-column-create cg-swap-create">
|
| 1218 |
+
<label>
|
| 1219 |
+
<span>New {TYPE_LABELS[swapToNewType].toLowerCase()} field</span>
|
| 1220 |
+
<input
|
| 1221 |
+
className="cg-input"
|
| 1222 |
+
autoFocus
|
| 1223 |
+
value={swapLabel}
|
| 1224 |
+
placeholder="Field name"
|
| 1225 |
+
onChange={(event) => setSwapLabel(event.target.value)}
|
| 1226 |
+
onKeyDown={(event) => event.key === "Enter" && createAndSwap()}
|
| 1227 |
+
/>
|
| 1228 |
+
</label>
|
| 1229 |
+
<ExtraTypeEditor
|
| 1230 |
+
kind={swapToNewType}
|
| 1231 |
+
fields={fields}
|
| 1232 |
+
formulaText={swapFormulaText}
|
| 1233 |
+
onFormulaText={setSwapFormulaText}
|
| 1234 |
+
formulaError={
|
| 1235 |
+
swapFormulaCheck.ok ? null : swapFormulaCheck.error ?? null
|
| 1236 |
+
}
|
| 1237 |
+
maxValue={swapMaxValue}
|
| 1238 |
+
onMaxValue={setSwapMaxValue}
|
| 1239 |
+
idPrefix="cg-swap"
|
| 1240 |
+
/>
|
| 1241 |
+
{needsOptions(swapToNewType) && (
|
| 1242 |
+
<label>
|
| 1243 |
+
<span>Choices β one per line</span>
|
| 1244 |
+
<textarea
|
| 1245 |
+
className="cg-input cg-option-editor"
|
| 1246 |
+
rows={4}
|
| 1247 |
+
value={swapOptionText}
|
| 1248 |
+
placeholder={"Not started\nIn progress\nDone"}
|
| 1249 |
+
onChange={(event) => setSwapOptionText(event.target.value)}
|
| 1250 |
+
/>
|
| 1251 |
+
<span className="cg-field-hint">
|
| 1252 |
+
{swapNewOptions.length} choice
|
| 1253 |
+
{swapNewOptions.length === 1 ? "" : "s"}.
|
| 1254 |
+
{swapToNewType === "multiselect" &&
|
| 1255 |
+
" Commas inside a choice are not supported."}
|
| 1256 |
+
</span>
|
| 1257 |
+
</label>
|
| 1258 |
+
)}
|
| 1259 |
+
{swapToNewType === "user" && (
|
| 1260 |
+
<div className="cg-field-hint">
|
| 1261 |
+
{userOptions.length
|
| 1262 |
+
? `${userOptions.length} people can be assigned.`
|
| 1263 |
+
: "No user list was supplied by the host yet."}
|
| 1264 |
+
</div>
|
| 1265 |
+
)}
|
| 1266 |
+
{scopeChoice && (
|
| 1267 |
+
<ScopeControl value={scopeDraft} onValue={setScopeDraft} />
|
| 1268 |
+
)}
|
| 1269 |
+
<div className="cg-form-actions">
|
| 1270 |
+
<button
|
| 1271 |
+
type="button"
|
| 1272 |
+
className="cg-btn cg-btn--primary"
|
| 1273 |
+
disabled={!canCreateSwap}
|
| 1274 |
+
onClick={createAndSwap}
|
| 1275 |
+
>
|
| 1276 |
+
Create and change
|
| 1277 |
+
</button>
|
| 1278 |
+
<button
|
| 1279 |
+
type="button"
|
| 1280 |
+
className="cg-btn"
|
| 1281 |
+
onClick={() => setSwapTo("")}
|
| 1282 |
+
>
|
| 1283 |
+
Cancel
|
| 1284 |
+
</button>
|
| 1285 |
+
</div>
|
| 1286 |
+
</div>
|
| 1287 |
+
)}
|
| 1288 |
+
</div>
|
| 1289 |
+
)}
|
| 1290 |
</div>
|
| 1291 |
</AnchoredOverlay>
|
| 1292 |
);
|
|
|
|
| 1517 |
);
|
| 1518 |
}
|
| 1519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1520 |
// ------------------------------------------------------------------ the MENU pane
|
| 1521 |
// Wave-5 items 1/2/3: a flat action list. Editors open their OWN windows (the panes above);
|
| 1522 |
// nothing edits inline here. Conditional entries render IFF they apply to the current view.
|
|
|
|
| 1570 |
an icon on EVERY action. Presentation only β every handler and event is the one it
|
| 1571 |
was before; entries not in Airtable's list slot into the nearest sensible group. */}
|
| 1572 |
<div className="cg-column-actions">
|
| 1573 |
+
{/* Owner item 8 (2026-07-31) β EDIT FIELD sits at the very top, above Duplicate:
|
| 1574 |
+
the one window for the field's name, type (with per-type choices/stars/formula)
|
| 1575 |
+
and the Change-field control. Offered on EVERY field β what a read-only field
|
| 1576 |
+
cannot change, the pane says honestly instead of hiding the door. */}
|
| 1577 |
+
<button type="button" data-overlay-autofocus onClick={() => {
|
| 1578 |
+
setRenameDraft(field.label);
|
| 1579 |
+
setPane("edit");
|
| 1580 |
+
}}>
|
| 1581 |
+
<MenuLabel icon={MenuIcons.rename} text="Edit field" />
|
| 1582 |
+
</button>
|
| 1583 |
+
|
| 1584 |
+
<div className="cg-menu-sep" role="separator" aria-hidden />
|
| 1585 |
+
|
| 1586 |
+
{/* Group 1 β Duplicate Β· Insert left Β· Insert right (+ Add at end, same family). */}
|
| 1587 |
{onDuplicate && (
|
| 1588 |
+
<button type="button" onClick={() => { onDuplicate(); onClose(); }}>
|
| 1589 |
<MenuLabel icon={MenuIcons.duplicate} text="Duplicate field" />
|
| 1590 |
</button>
|
| 1591 |
)}
|
| 1592 |
+
<button type="button" onClick={() => setPosition("left")}>
|
| 1593 |
<MenuLabel icon={MenuIcons.insertLeft} text="Insert field left" />
|
| 1594 |
</button>
|
| 1595 |
<button type="button" onClick={() => setPosition("right")}>
|
|
|
|
| 1601 |
|
| 1602 |
<div className="cg-menu-sep" role="separator" aria-hidden />
|
| 1603 |
|
| 1604 |
+
{/* Group 2 β the rest of the def-editing family: description Β· permissions Β· format.
|
| 1605 |
+
Rename and Change field live INSIDE Edit field now (owner item 8) β their old
|
| 1606 |
+
rows are gone, not duplicated. */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1607 |
<button type="button" onClick={() => setPane("note")}>
|
| 1608 |
<MenuLabel icon={MenuIcons.description} text="Edit field description" />
|
| 1609 |
</button>
|
|
|
|
| 1617 |
<MenuLabel icon={MenuIcons.format} text="Field format" />
|
| 1618 |
</button>
|
| 1619 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1620 |
|
| 1621 |
<div className="cg-menu-sep" role="separator" aria-hidden />
|
| 1622 |
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import {
|
|
|
|
| 2 |
useCallback,
|
| 3 |
useEffect,
|
| 4 |
useLayoutEffect,
|
|
@@ -288,8 +289,15 @@ function buildOverlayField(
|
|
| 288 |
}
|
| 289 |
|
| 290 |
/** The surface this grid draws. `cohort` is the same table over hand-curated SETS β the server
|
| 291 |
-
* confirms it by stamping `workspace.cohortMode`, which is the only thing the body below reads.
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
const {
|
| 294 |
fields: payloadFields,
|
| 295 |
rawRows,
|
|
@@ -1082,6 +1090,10 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1082 |
if (row.kind === "data" && field && canEditField(field)
|
| 1083 |
&& (isPickType(field.type) || field.type === "rating")) {
|
| 1084 |
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1085 |
const b = event.bounds;
|
| 1086 |
setPicker({
|
| 1087 |
pid: row.record.pid,
|
|
@@ -1131,7 +1143,8 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1131 |
// open a record; the hover Expand button below is its replacement, and half of this
|
| 1132 |
// change is a table whose records cannot be opened at all.
|
| 1133 |
},
|
| 1134 |
-
[displayRows, visibleCols, fieldByKey, canEditField, overlayEdits, lockedKey, togglePid
|
|
|
|
| 1135 |
);
|
| 1136 |
/**
|
| 1137 |
* Double-click / Enter. KEPT as a door to the record on purpose (owner item 17 names the
|
|
@@ -1236,6 +1249,34 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1236 |
event.preventDefault();
|
| 1237 |
event.stopPropagation();
|
| 1238 |
event.cancel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1239 |
const dir = event.shiftKey ? -1 : 1;
|
| 1240 |
let row = cur[1] + dir;
|
| 1241 |
while (row >= 0 && row < displayRows.length && displayRows[row]?.kind !== "data")
|
|
@@ -1270,7 +1311,8 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1270 |
height: 36,
|
| 1271 |
});
|
| 1272 |
},
|
| 1273 |
-
[gridSelection.current, openHeaderMenu, displayRows, setActiveCell
|
|
|
|
| 1274 |
);
|
| 1275 |
|
| 1276 |
const persistView = useCallback((view: SavedView) => {
|
|
@@ -1911,7 +1953,9 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1911 |
key: string,
|
| 1912 |
type: FieldType,
|
| 1913 |
options?: string[],
|
| 1914 |
-
|
|
|
|
|
|
|
| 1915 |
) => {
|
| 1916 |
const old = fieldByKey.get(key);
|
| 1917 |
if (!old?.custom || old.source !== "overlay") return;
|
|
@@ -1921,7 +1965,7 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 1921 |
old.format && ((numberFam(old.type) && numberFam(type)) || old.type === type);
|
| 1922 |
const next: Field = {
|
| 1923 |
key,
|
| 1924 |
-
label: old.label,
|
| 1925 |
type,
|
| 1926 |
source: "overlay",
|
| 1927 |
default: old.default,
|
|
@@ -2332,6 +2376,15 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 2332 |
// (item 5). Single select/user keep pick-and-close.
|
| 2333 |
const pickerMulti = pickerField?.type === "multiselect";
|
| 2334 |
const pickerParts = pickerMulti ? splitMulti(pickerValue) : [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2335 |
|
| 2336 |
return (
|
| 2337 |
// `data-today` is the TENANT'S day, exactly as the payload delivered it. It is here so the
|
|
@@ -2932,6 +2985,18 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 2932 |
? (label) => saveField({ ...menuField, label })
|
| 2933 |
: undefined
|
| 2934 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2935 |
onPeriod={
|
| 2936 |
menuField.measure
|
| 2937 |
? (w) => changeMeasurePeriod(menuField.key, w)
|
|
@@ -3182,6 +3247,28 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 3182 |
ariaLabel={`Choose ${pickerField.label}`}
|
| 3183 |
onDismiss={closePicker}
|
| 3184 |
dataKind="cell-picker"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3185 |
>
|
| 3186 |
<div className="cg-pop-title">{pickerField.label}</div>
|
| 3187 |
{/* Wave-5 item 11 β a RATING cell's picker is the star row itself. */}
|
|
@@ -3199,6 +3286,11 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 3199 |
className="cg-star-btn"
|
| 3200 |
role="radio"
|
| 3201 |
aria-checked={Number(pickerValue) === n}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3202 |
aria-label={`${n} star${n === 1 ? "" : "s"}`}
|
| 3203 |
onClick={() => {
|
| 3204 |
patchOverlay(picker.pid, { [pickerField.key]: String(n) });
|
|
@@ -3230,6 +3322,7 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 3230 |
role="option"
|
| 3231 |
aria-selected={on}
|
| 3232 |
key={choice}
|
|
|
|
| 3233 |
className={"cg-pick-row" + (on ? " is-on" : "")}
|
| 3234 |
onClick={() => {
|
| 3235 |
if (pickerMulti) {
|
|
@@ -3273,6 +3366,9 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 3273 |
<button
|
| 3274 |
type="button"
|
| 3275 |
className="cg-pick-row cg-pick-clear"
|
|
|
|
|
|
|
|
|
|
| 3276 |
onClick={() => {
|
| 3277 |
patchOverlay(picker.pid, { [pickerField.key]: "" });
|
| 3278 |
closePicker();
|
|
@@ -3347,3 +3443,5 @@ export default function CustomerGrid({ scope = "customer" }: { scope?: SurfaceSc
|
|
| 3347 |
</div>
|
| 3348 |
);
|
| 3349 |
}
|
|
|
|
|
|
|
|
|
| 1 |
import {
|
| 2 |
+
memo,
|
| 3 |
useCallback,
|
| 4 |
useEffect,
|
| 5 |
useLayoutEffect,
|
|
|
|
| 289 |
}
|
| 290 |
|
| 291 |
/** The surface this grid draws. `cohort` is the same table over hand-curated SETS β the server
|
| 292 |
+
* confirms it by stamping `workspace.cohortMode`, which is the only thing the body below reads.
|
| 293 |
+
*
|
| 294 |
+
* MEMOIZED (owner item 1, 2026-07-31): the shell re-renders on every chrome state flip β nav
|
| 295 |
+
* collapse, toast, settings β and an unmemoized grid re-rendered its whole 3,400-line tree
|
| 296 |
+
* each time. Measured cost: 200ms-5s of main-thread block, which ate the 240ms rail-fold
|
| 297 |
+
* transition whole (the fold froze, then SNAPPED β the exact "static" the owner named). The
|
| 298 |
+
* props surface is one stable string, so memo makes chrome state changes free; the grid still
|
| 299 |
+
* re-renders for its own state (edits, resize) and remounts on route change via `key`. */
|
| 300 |
+
function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
|
| 301 |
const {
|
| 302 |
fields: payloadFields,
|
| 303 |
rawRows,
|
|
|
|
| 1090 |
if (row.kind === "data" && field && canEditField(field)
|
| 1091 |
&& (isPickType(field.type) || field.type === "rating")) {
|
| 1092 |
event.preventDefault();
|
| 1093 |
+
// Item 6 (2026-07-31) β the click also LANDS the active cell here (preventDefault
|
| 1094 |
+
// stops glide from committing it), so pick β Enter walks on down the column exactly
|
| 1095 |
+
// like a typed edit does.
|
| 1096 |
+
setActiveCell(cell[0], cell[1]);
|
| 1097 |
const b = event.bounds;
|
| 1098 |
setPicker({
|
| 1099 |
pid: row.record.pid,
|
|
|
|
| 1143 |
// open a record; the hover Expand button below is its replacement, and half of this
|
| 1144 |
// change is a table whose records cannot be opened at all.
|
| 1145 |
},
|
| 1146 |
+
[displayRows, visibleCols, fieldByKey, canEditField, overlayEdits, lockedKey, togglePid,
|
| 1147 |
+
setActiveCell]
|
| 1148 |
);
|
| 1149 |
/**
|
| 1150 |
* Double-click / Enter. KEPT as a door to the record on purpose (owner item 17 names the
|
|
|
|
| 1249 |
event.preventDefault();
|
| 1250 |
event.stopPropagation();
|
| 1251 |
event.cancel();
|
| 1252 |
+
// Owner item 6 (2026-07-31) β Enter on a PICKED cell (select / multi select /
|
| 1253 |
+
// assignee / rating) opens its picker: the keyboard door the mouse click already
|
| 1254 |
+
// had. glide's text overlay cannot serve these types (validateCell refuses them),
|
| 1255 |
+
// so without this the keyboard run down a column dead-ends at every picked field.
|
| 1256 |
+
// Shift+Enter stays pure navigation, so walking UP past picked cells still works.
|
| 1257 |
+
const curRow = displayRows[cur[1]];
|
| 1258 |
+
const curColumn = visibleCols[cur[0]];
|
| 1259 |
+
const curField = curColumn ? fieldByKey.get(curColumn.id!) : undefined;
|
| 1260 |
+
if (
|
| 1261 |
+
!event.shiftKey &&
|
| 1262 |
+
curRow?.kind === "data" &&
|
| 1263 |
+
curField &&
|
| 1264 |
+
canEditField(curField) &&
|
| 1265 |
+
(isPickType(curField.type) || curField.type === "rating")
|
| 1266 |
+
) {
|
| 1267 |
+
const b = gridRef.current?.getBounds(cur[0], cur[1]);
|
| 1268 |
+
if (b) {
|
| 1269 |
+
setPicker({
|
| 1270 |
+
pid: curRow.record.pid,
|
| 1271 |
+
fieldKey: curField.key,
|
| 1272 |
+
anchor: {
|
| 1273 |
+
left: b.x, top: b.y, right: b.x + b.width, bottom: b.y + b.height,
|
| 1274 |
+
width: b.width, height: b.height,
|
| 1275 |
+
},
|
| 1276 |
+
});
|
| 1277 |
+
return;
|
| 1278 |
+
}
|
| 1279 |
+
}
|
| 1280 |
const dir = event.shiftKey ? -1 : 1;
|
| 1281 |
let row = cur[1] + dir;
|
| 1282 |
while (row >= 0 && row < displayRows.length && displayRows[row]?.kind !== "data")
|
|
|
|
| 1311 |
height: 36,
|
| 1312 |
});
|
| 1313 |
},
|
| 1314 |
+
[gridSelection.current, openHeaderMenu, displayRows, setActiveCell,
|
| 1315 |
+
visibleCols, fieldByKey, canEditField]
|
| 1316 |
);
|
| 1317 |
|
| 1318 |
const persistView = useCallback((view: SavedView) => {
|
|
|
|
| 1953 |
key: string,
|
| 1954 |
type: FieldType,
|
| 1955 |
options?: string[],
|
| 1956 |
+
// `label` (owner item 8): rename+retype leave the Edit pane as ONE upsert β two
|
| 1957 |
+
// sequential emits would each read the stale def and revert the other.
|
| 1958 |
+
extra?: { formula?: string; max?: number; label?: string }
|
| 1959 |
) => {
|
| 1960 |
const old = fieldByKey.get(key);
|
| 1961 |
if (!old?.custom || old.source !== "overlay") return;
|
|
|
|
| 1965 |
old.format && ((numberFam(old.type) && numberFam(type)) || old.type === type);
|
| 1966 |
const next: Field = {
|
| 1967 |
key,
|
| 1968 |
+
label: extra?.label?.trim() || old.label,
|
| 1969 |
type,
|
| 1970 |
source: "overlay",
|
| 1971 |
default: old.default,
|
|
|
|
| 2376 |
// (item 5). Single select/user keep pick-and-close.
|
| 2377 |
const pickerMulti = pickerField?.type === "multiselect";
|
| 2378 |
const pickerParts = pickerMulti ? splitMulti(pickerValue) : [];
|
| 2379 |
+
/** Item 6 β which choice receives focus when the picker opens: the current value where it
|
| 2380 |
+
* still exists in the list, else the first choice. Keyboard-only editing starts HERE. */
|
| 2381 |
+
const pickerFocusChoice = !pickerChoices.length
|
| 2382 |
+
? null
|
| 2383 |
+
: pickerMulti
|
| 2384 |
+
? pickerParts.find((p) => pickerChoices.includes(p)) ?? pickerChoices[0]
|
| 2385 |
+
: pickerChoices.includes(pickerValue)
|
| 2386 |
+
? pickerValue
|
| 2387 |
+
: pickerChoices[0];
|
| 2388 |
|
| 2389 |
return (
|
| 2390 |
// `data-today` is the TENANT'S day, exactly as the payload delivered it. It is here so the
|
|
|
|
| 2985 |
? (label) => saveField({ ...menuField, label })
|
| 2986 |
: undefined
|
| 2987 |
}
|
| 2988 |
+
onFormula={
|
| 2989 |
+
// Owner item 8 β edit a created FORMULA field's source in place; the optional
|
| 2990 |
+
// label rides the SAME upsert (see ColumnMenu's one-upsert rule).
|
| 2991 |
+
menuField.custom && menuField.type === "formula"
|
| 2992 |
+
? (formula, label) =>
|
| 2993 |
+
saveField({
|
| 2994 |
+
...menuField,
|
| 2995 |
+
formula,
|
| 2996 |
+
...(label ? { label } : {}),
|
| 2997 |
+
})
|
| 2998 |
+
: undefined
|
| 2999 |
+
}
|
| 3000 |
onPeriod={
|
| 3001 |
menuField.measure
|
| 3002 |
? (w) => changeMeasurePeriod(menuField.key, w)
|
|
|
|
| 3247 |
ariaLabel={`Choose ${pickerField.label}`}
|
| 3248 |
onDismiss={closePicker}
|
| 3249 |
dataKind="cell-picker"
|
| 3250 |
+
// Owner item 6 (2026-07-31) β the picker is a KEYBOARD surface: it opens focused on
|
| 3251 |
+
// the current choice (fallback: the first), arrows move between choices, Enter picks
|
| 3252 |
+
// (native button activation), Escape closes, and closePicker hands focus back to the
|
| 3253 |
+
// grid so the next Enter keeps walking the column.
|
| 3254 |
+
initialFocus="[data-overlay-autofocus]"
|
| 3255 |
+
onKeyDown={(e) => {
|
| 3256 |
+
const fwd = e.key === "ArrowDown" || e.key === "ArrowRight";
|
| 3257 |
+
const back = e.key === "ArrowUp" || e.key === "ArrowLeft";
|
| 3258 |
+
if (!fwd && !back) return;
|
| 3259 |
+
const items = Array.from(
|
| 3260 |
+
e.currentTarget.querySelectorAll<HTMLButtonElement>(
|
| 3261 |
+
".cg-pick-row, .cg-star-btn"
|
| 3262 |
+
)
|
| 3263 |
+
);
|
| 3264 |
+
if (!items.length) return;
|
| 3265 |
+
e.preventDefault();
|
| 3266 |
+
const at = items.indexOf(document.activeElement as HTMLButtonElement);
|
| 3267 |
+
const next = fwd
|
| 3268 |
+
? (at + 1) % items.length
|
| 3269 |
+
: (at - 1 + items.length) % items.length;
|
| 3270 |
+
items[next]?.focus();
|
| 3271 |
+
}}
|
| 3272 |
>
|
| 3273 |
<div className="cg-pop-title">{pickerField.label}</div>
|
| 3274 |
{/* Wave-5 item 11 β a RATING cell's picker is the star row itself. */}
|
|
|
|
| 3286 |
className="cg-star-btn"
|
| 3287 |
role="radio"
|
| 3288 |
aria-checked={Number(pickerValue) === n}
|
| 3289 |
+
data-overlay-autofocus={
|
| 3290 |
+
Number(pickerValue) === n || (!pickerValue && n === 1)
|
| 3291 |
+
? true
|
| 3292 |
+
: undefined
|
| 3293 |
+
}
|
| 3294 |
aria-label={`${n} star${n === 1 ? "" : "s"}`}
|
| 3295 |
onClick={() => {
|
| 3296 |
patchOverlay(picker.pid, { [pickerField.key]: String(n) });
|
|
|
|
| 3322 |
role="option"
|
| 3323 |
aria-selected={on}
|
| 3324 |
key={choice}
|
| 3325 |
+
data-overlay-autofocus={choice === pickerFocusChoice ? true : undefined}
|
| 3326 |
className={"cg-pick-row" + (on ? " is-on" : "")}
|
| 3327 |
onClick={() => {
|
| 3328 |
if (pickerMulti) {
|
|
|
|
| 3366 |
<button
|
| 3367 |
type="button"
|
| 3368 |
className="cg-pick-row cg-pick-clear"
|
| 3369 |
+
// Fallback focus target for a picker with a value but no choices left
|
| 3370 |
+
// (the querySelector takes the FIRST match, so a real choice row wins).
|
| 3371 |
+
data-overlay-autofocus={pickerChoices.length === 0 ? true : undefined}
|
| 3372 |
onClick={() => {
|
| 3373 |
patchOverlay(picker.pid, { [pickerField.key]: "" });
|
| 3374 |
closePicker();
|
|
|
|
| 3443 |
</div>
|
| 3444 |
);
|
| 3445 |
}
|
| 3446 |
+
|
| 3447 |
+
export default memo(CustomerGrid);
|
web/src/customer-grid/iconShapes.ts
CHANGED
|
@@ -315,7 +315,7 @@ export const MODE_TONE: Record<DisplayMode, FolderTone> = {
|
|
| 315 |
*/
|
| 316 |
export const TYPE_LABELS: Record<FieldType, string> = {
|
| 317 |
text: "Single line text",
|
| 318 |
-
select: "
|
| 319 |
multiselect: "Multi select",
|
| 320 |
user: "Assignee",
|
| 321 |
int: "Number",
|
|
|
|
| 315 |
*/
|
| 316 |
export const TYPE_LABELS: Record<FieldType, string> = {
|
| 317 |
text: "Single line text",
|
| 318 |
+
select: "Single select",
|
| 319 |
multiselect: "Multi select",
|
| 320 |
user: "Assignee",
|
| 321 |
int: "Number",
|
web/src/customer-grid/useGridSelection.ts
CHANGED
|
@@ -15,9 +15,9 @@
|
|
| 15 |
// out-of-range current.cell is a crash class).
|
| 16 |
// ---------------------------------------------------------------------------
|
| 17 |
|
| 18 |
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
| 19 |
import { CompactSelection } from "@glideapps/glide-data-grid";
|
| 20 |
-
import type { GridSelection } from "@glideapps/glide-data-grid";
|
| 21 |
import type { VisibleRow } from "./types";
|
| 22 |
|
| 23 |
export interface GridSelectionApi {
|
|
@@ -47,12 +47,31 @@ export function useGridSelection(
|
|
| 47 |
const [current, setCurrent] = useState<GridSelection["current"] | undefined>(
|
| 48 |
undefined
|
| 49 |
);
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
//
|
| 52 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
useEffect(() => {
|
| 54 |
-
setCurrent(
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
const gridSelection = useMemo<GridSelection>(() => {
|
| 58 |
let rows = CompactSelection.empty();
|
|
@@ -76,6 +95,10 @@ export function useGridSelection(
|
|
| 76 |
const onGridSelectionChange = useCallback(
|
| 77 |
(sel: GridSelection) => {
|
| 78 |
setCurrent(sel.current);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
// Translate the new row index-set back to pids (guard synthetic rows).
|
| 80 |
const pids = new Set<number>();
|
| 81 |
for (const i of sel.rows) {
|
|
@@ -104,17 +127,23 @@ export function useGridSelection(
|
|
| 104 |
});
|
| 105 |
}, []);
|
| 106 |
|
| 107 |
-
const setActiveCell = useCallback(
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
const clearSelection = useCallback(() => {
|
| 116 |
setSelectedPids(new Set());
|
| 117 |
setCurrent(undefined);
|
|
|
|
| 118 |
}, []);
|
| 119 |
|
| 120 |
return { gridSelection, selectedPids, onGridSelectionChange, selectPids, togglePid,
|
|
|
|
| 15 |
// out-of-range current.cell is a crash class).
|
| 16 |
// ---------------------------------------------------------------------------
|
| 17 |
|
| 18 |
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
| 19 |
import { CompactSelection } from "@glideapps/glide-data-grid";
|
| 20 |
+
import type { GridSelection, Item } from "@glideapps/glide-data-grid";
|
| 21 |
import type { VisibleRow } from "./types";
|
| 22 |
|
| 23 |
export interface GridSelectionApi {
|
|
|
|
| 47 |
const [current, setCurrent] = useState<GridSelection["current"] | undefined>(
|
| 48 |
undefined
|
| 49 |
);
|
| 50 |
+
/** The pid under the active cell β the semantic anchor the remap below follows. */
|
| 51 |
+
const currentPidRef = useRef<number | null>(null);
|
| 52 |
|
| 53 |
+
// The active cell FOLLOWS ITS RECORD when the row pipeline re-identifies.
|
| 54 |
+
// β This used to be an unconditional clear "because a re-sort permutes
|
| 55 |
+
// indices" β but visibleRows gets a new identity on EVERY overlay-edit commit
|
| 56 |
+
// too, so the clear wiped the cursor at the exact moment Excel-grade Enter
|
| 57 |
+
// had just moved it down (owner item 4, 2026-07-31: "Enter should go to the
|
| 58 |
+
// next record"). Anchoring by pid keeps the cursor through edits AND gives
|
| 59 |
+
// re-sorts the right behavior for free: the highlight follows the record to
|
| 60 |
+
// its new position; it clears only when the record actually left the view.
|
| 61 |
useEffect(() => {
|
| 62 |
+
setCurrent((cur) => {
|
| 63 |
+
if (!cur) return cur;
|
| 64 |
+
const pid = currentPidRef.current;
|
| 65 |
+
const idx = pid != null ? pidToIndex.get(pid) : undefined;
|
| 66 |
+
if (idx === undefined) return undefined;
|
| 67 |
+
if (idx === cur.cell[1]) return cur;
|
| 68 |
+
return {
|
| 69 |
+
cell: [cur.cell[0], idx] as Item,
|
| 70 |
+
range: { x: cur.cell[0], y: idx, width: 1, height: 1 },
|
| 71 |
+
rangeStack: [],
|
| 72 |
+
};
|
| 73 |
+
});
|
| 74 |
+
}, [visibleRows, pidToIndex]);
|
| 75 |
|
| 76 |
const gridSelection = useMemo<GridSelection>(() => {
|
| 77 |
let rows = CompactSelection.empty();
|
|
|
|
| 95 |
const onGridSelectionChange = useCallback(
|
| 96 |
(sel: GridSelection) => {
|
| 97 |
setCurrent(sel.current);
|
| 98 |
+
// Record the pid under the new active cell β the anchor the remap effect
|
| 99 |
+
// follows across row-pipeline rebuilds.
|
| 100 |
+
const at = sel.current ? visibleRows[sel.current.cell[1]] : undefined;
|
| 101 |
+
currentPidRef.current = at && at.kind === "data" ? at.record.pid : null;
|
| 102 |
// Translate the new row index-set back to pids (guard synthetic rows).
|
| 103 |
const pids = new Set<number>();
|
| 104 |
for (const i of sel.rows) {
|
|
|
|
| 127 |
});
|
| 128 |
}, []);
|
| 129 |
|
| 130 |
+
const setActiveCell = useCallback(
|
| 131 |
+
(col: number, row: number) => {
|
| 132 |
+
const at = visibleRows[row];
|
| 133 |
+
currentPidRef.current = at && at.kind === "data" ? at.record.pid : null;
|
| 134 |
+
setCurrent({
|
| 135 |
+
cell: [col, row],
|
| 136 |
+
range: { x: col, y: row, width: 1, height: 1 },
|
| 137 |
+
rangeStack: [],
|
| 138 |
+
});
|
| 139 |
+
},
|
| 140 |
+
[visibleRows]
|
| 141 |
+
);
|
| 142 |
|
| 143 |
const clearSelection = useCallback(() => {
|
| 144 |
setSelectedPids(new Set());
|
| 145 |
setCurrent(undefined);
|
| 146 |
+
currentPidRef.current = null;
|
| 147 |
}, []);
|
| 148 |
|
| 149 |
return { gridSelection, selectedPids, onGridSelectionChange, selectPids, togglePid,
|
web/src/index.css
CHANGED
|
@@ -107,6 +107,16 @@
|
|
| 107 |
collapsed strip is the item-11 minimize target (both rails fold to it). */
|
| 108 |
--lp-rail-w: 240px;
|
| 109 |
--lp-rail-min: 48px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
--lp-surface: #ffffff;
|
| 111 |
--lp-surface-2: #f7f7f6; /* warm-neutral; was #f4f6f9 (cool) */
|
| 112 |
|
|
@@ -221,13 +231,15 @@ body {
|
|
| 221 |
}
|
| 222 |
|
| 223 |
/* Saved-view rail β the SECOND navigation bar (owner items 10/11/12, 2026-07-31): same
|
| 224 |
-
width as the shell nav, same white surface, same fold-to-strip minimize.
|
|
|
|
|
|
|
| 225 |
.cg-views {
|
| 226 |
flex: 0 0 var(--lp-rail-w);
|
| 227 |
width: var(--lp-rail-w);
|
| 228 |
min-width: var(--lp-rail-w);
|
| 229 |
height: 100%;
|
| 230 |
-
padding:
|
| 231 |
border-right: 1px solid var(--lp-line);
|
| 232 |
background: var(--lp-surface);
|
| 233 |
color: var(--cg-text);
|
|
@@ -235,21 +247,33 @@ body {
|
|
| 235 |
display: flex;
|
| 236 |
flex-direction: column;
|
| 237 |
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
}
|
| 239 |
.cg-views.is-collapsed {
|
| 240 |
flex-basis: var(--lp-rail-min);
|
| 241 |
width: var(--lp-rail-min);
|
| 242 |
min-width: var(--lp-rail-min);
|
| 243 |
-
padding:
|
| 244 |
}
|
| 245 |
.cg-views.is-collapsed > :not(.cg-views-top) {
|
| 246 |
display: none;
|
| 247 |
}
|
|
|
|
|
|
|
|
|
|
| 248 |
.cg-views-top {
|
|
|
|
|
|
|
| 249 |
display: flex;
|
| 250 |
align-items: center;
|
| 251 |
justify-content: flex-end;
|
| 252 |
-
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
.cg-rail-toggle {
|
| 255 |
width: 28px;
|
|
@@ -278,6 +302,9 @@ body {
|
|
| 278 |
position: relative;
|
| 279 |
margin: 0 2px 6px;
|
| 280 |
}
|
|
|
|
|
|
|
|
|
|
| 281 |
.cg-find-view-icon {
|
| 282 |
position: absolute;
|
| 283 |
left: 8px;
|
|
@@ -1013,8 +1040,12 @@ body {
|
|
| 1013 |
color: var(--lp-ink);
|
| 1014 |
}
|
| 1015 |
.cg-pick-row:hover,
|
|
|
|
|
|
|
| 1016 |
.cg-pick-row:focus-visible {
|
| 1017 |
background: #f2f3f6;
|
|
|
|
|
|
|
| 1018 |
}
|
| 1019 |
.cg-pick-row.is-on {
|
| 1020 |
background: #eef2f7;
|
|
@@ -2252,7 +2283,9 @@ body {
|
|
| 2252 |
}
|
| 2253 |
|
| 2254 |
/* WHITE, like the host's `[theme.sidebar]` (owner 2026-07-23: "slick, visible
|
| 2255 |
-
light-grey borders") β the wash belongs to page bodies, not the rail.
|
|
|
|
|
|
|
| 2256 |
.shell-side {
|
| 2257 |
display: flex;
|
| 2258 |
flex-direction: column;
|
|
@@ -2262,16 +2295,24 @@ body {
|
|
| 2262 |
border-right: 1px solid var(--lp-line);
|
| 2263 |
overflow-y: auto;
|
| 2264 |
overflow-x: hidden;
|
|
|
|
|
|
|
|
|
|
| 2265 |
}
|
| 2266 |
|
| 2267 |
-
/*
|
| 2268 |
-
|
| 2269 |
-
|
|
|
|
| 2270 |
.shell-side-head {
|
| 2271 |
display: flex;
|
| 2272 |
align-items: center;
|
| 2273 |
justify-content: space-between;
|
| 2274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2275 |
}
|
| 2276 |
.shell-rail-toggle {
|
| 2277 |
width: 28px;
|
|
@@ -2298,38 +2339,99 @@ body {
|
|
| 2298 |
width: var(--lp-rail-min);
|
| 2299 |
flex-basis: var(--lp-rail-min);
|
| 2300 |
}
|
| 2301 |
-
|
| 2302 |
-
|
| 2303 |
-
|
| 2304 |
-
|
| 2305 |
-
|
| 2306 |
-
.shell-side.is-collapsed .shell-
|
|
|
|
| 2307 |
.shell-side.is-collapsed .lp-wordmark,
|
| 2308 |
.shell-side.is-collapsed .shell-nav-label,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2309 |
.shell-side.is-collapsed .shell-nav-badge,
|
| 2310 |
.shell-side.is-collapsed .shell-nav-open,
|
| 2311 |
.shell-side.is-collapsed .shell-nav-group,
|
| 2312 |
-
.shell-side.is-collapsed .shell-account-who,
|
| 2313 |
.shell-side.is-collapsed .shell-account-dots {
|
| 2314 |
display: none;
|
| 2315 |
}
|
| 2316 |
-
.shell-side.is-collapsed .shell-nav { padding:
|
| 2317 |
.shell-side.is-collapsed .shell-nav-item {
|
| 2318 |
-
|
| 2319 |
-
|
| 2320 |
}
|
| 2321 |
-
.shell-side.is-collapsed .shell-nav-item.is-child { padding-left:
|
|
|
|
| 2322 |
.shell-side.is-collapsed .shell-account {
|
| 2323 |
-
|
| 2324 |
-
|
| 2325 |
}
|
| 2326 |
|
| 2327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2328 |
/* β DELIBERATELY OFF THE TYPE SCALE. The wordmark is BRAND, not UI text: 17px is what the app's
|
| 2329 |
own nav wordmark resolves to (1.02rem against its 17px base), and matching the sibling door
|
| 2330 |
matters more here than sitting on the --lp-fs-* ladder. The mark's 26/44px are geometry for
|
| 2331 |
the same reason. Nothing else in this block is allowed off the scale. */
|
| 2332 |
-
.shell-brand .lp-wordmark {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2333 |
|
| 2334 |
/* (.shell-nav-caption deleted with the "Workflows" label it existed to style β owner item 10.
|
| 2335 |
.shell-signed / .shell-signed-sub deleted with the "Shared password gate" copy they styled β
|
|
@@ -2340,8 +2442,14 @@ body {
|
|
| 2340 |
|
| 2341 |
/* THREE BANDS, the host's own rhythm (wave-10 I11, measured against Omni):
|
| 2342 |
logo Β· the assistant slot Β· the database list β margins between the bands,
|
| 2343 |
-
tight rows inside them.
|
| 2344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2345 |
/* The hairline between the assistant band and the database list β the host
|
| 2346 |
draws the same one under its assist slot. */
|
| 2347 |
.shell-nav-list {
|
|
@@ -2364,6 +2472,9 @@ body {
|
|
| 2364 |
color: var(--lp-ink);
|
| 2365 |
text-decoration: none;
|
| 2366 |
border-radius: var(--lp-r-sm);
|
|
|
|
|
|
|
|
|
|
| 2367 |
}
|
| 2368 |
.shell-nav-item:hover { background: var(--lp-surface-2); }
|
| 2369 |
.shell-nav-item.is-child { padding-left: 30px; }
|
|
@@ -2389,10 +2500,18 @@ body {
|
|
| 2389 |
.shell-nav-icon.is-spark { fill: currentColor; stroke: none; }
|
| 2390 |
.shell-nav-item.is-active .shell-nav-icon { opacity: 1; color: var(--lp-blue-deep); }
|
| 2391 |
|
|
|
|
|
|
|
| 2392 |
.shell-nav-label {
|
|
|
|
|
|
|
|
|
|
| 2393 |
overflow: hidden;
|
| 2394 |
text-overflow: ellipsis;
|
| 2395 |
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
| 2396 |
}
|
| 2397 |
|
| 2398 |
/* The new-tab affordance on a hand-off row: quiet until the row is hovered,
|
|
@@ -2453,6 +2572,7 @@ body {
|
|
| 2453 |
margin-top: auto;
|
| 2454 |
padding: 8px 10px 10px;
|
| 2455 |
border-top: 1px solid var(--lp-line);
|
|
|
|
| 2456 |
}
|
| 2457 |
|
| 2458 |
/* The account corner: ONE line (the host's `_account_css` card) that opens the
|
|
@@ -2473,6 +2593,9 @@ body {
|
|
| 2473 |
border-radius: var(--lp-r-sm);
|
| 2474 |
cursor: pointer;
|
| 2475 |
color: var(--lp-ink);
|
|
|
|
|
|
|
|
|
|
| 2476 |
}
|
| 2477 |
.shell-account:hover { background: var(--lp-surface-2); }
|
| 2478 |
.shell-account:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: -2px; }
|
|
@@ -2490,7 +2613,18 @@ body {
|
|
| 2490 |
font-size: var(--lp-fs-2xs);
|
| 2491 |
font-weight: 600;
|
| 2492 |
}
|
| 2493 |
-
.shell-account-who {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2494 |
.shell-account-name {
|
| 2495 |
font-size: var(--lp-fs-2xs);
|
| 2496 |
font-weight: 600;
|
|
|
|
| 107 |
collapsed strip is the item-11 minimize target (both rails fold to it). */
|
| 108 |
--lp-rail-w: 240px;
|
| 109 |
--lp-rail-min: 48px;
|
| 110 |
+
/* Owner item 5 (2026-07-31): ONE top band across the whole chrome β the shell nav head,
|
| 111 |
+
the views-rail head and the toolbar are all this tall and all close with the same
|
| 112 |
+
hairline, so the page opens on one continuous line instead of three competing tops.
|
| 113 |
+
44px because the toolbar already measures 44px; the rails join it, not vice versa. */
|
| 114 |
+
--lp-rail-head-h: 44px;
|
| 115 |
+
/* Owner item 1 (2026-07-31): the rails FOLD, they do not snap β one duration + easing for
|
| 116 |
+
every property that moves during minimize (width, padding, label max-width), so the
|
| 117 |
+
whole page glides to its final state as one motion. */
|
| 118 |
+
--lp-fold-t: 0.24s;
|
| 119 |
+
--lp-fold-e: cubic-bezier(0.2, 0, 0, 1);
|
| 120 |
--lp-surface: #ffffff;
|
| 121 |
--lp-surface-2: #f7f7f6; /* warm-neutral; was #f4f6f9 (cool) */
|
| 122 |
|
|
|
|
| 231 |
}
|
| 232 |
|
| 233 |
/* Saved-view rail β the SECOND navigation bar (owner items 10/11/12, 2026-07-31): same
|
| 234 |
+
width as the shell nav, same white surface, same fold-to-strip minimize. Item 1: the fold
|
| 235 |
+
ANIMATES β width, basis and padding glide on the shared fold curve, and the grid beside it
|
| 236 |
+
reflows with them. */
|
| 237 |
.cg-views {
|
| 238 |
flex: 0 0 var(--lp-rail-w);
|
| 239 |
width: var(--lp-rail-w);
|
| 240 |
min-width: var(--lp-rail-w);
|
| 241 |
height: 100%;
|
| 242 |
+
padding: 0 8px 10px;
|
| 243 |
border-right: 1px solid var(--lp-line);
|
| 244 |
background: var(--lp-surface);
|
| 245 |
color: var(--cg-text);
|
|
|
|
| 247 |
display: flex;
|
| 248 |
flex-direction: column;
|
| 249 |
overflow: hidden;
|
| 250 |
+
transition:
|
| 251 |
+
width var(--lp-fold-t) var(--lp-fold-e),
|
| 252 |
+
flex-basis var(--lp-fold-t) var(--lp-fold-e),
|
| 253 |
+
min-width var(--lp-fold-t) var(--lp-fold-e),
|
| 254 |
+
padding var(--lp-fold-t) var(--lp-fold-e);
|
| 255 |
}
|
| 256 |
.cg-views.is-collapsed {
|
| 257 |
flex-basis: var(--lp-rail-min);
|
| 258 |
width: var(--lp-rail-min);
|
| 259 |
min-width: var(--lp-rail-min);
|
| 260 |
+
padding: 0 6px 10px;
|
| 261 |
}
|
| 262 |
.cg-views.is-collapsed > :not(.cg-views-top) {
|
| 263 |
display: none;
|
| 264 |
}
|
| 265 |
+
/* Item 5 β the rail's head is the shared top band: same height as the shell head and the
|
| 266 |
+
toolbar, closed by the same hairline. The negative margin bleeds the line to the rail's
|
| 267 |
+
true edges past the container padding (overflow:hidden clips the collapsed overshoot). */
|
| 268 |
.cg-views-top {
|
| 269 |
+
flex: 0 0 var(--lp-rail-head-h);
|
| 270 |
+
height: var(--lp-rail-head-h);
|
| 271 |
display: flex;
|
| 272 |
align-items: center;
|
| 273 |
justify-content: flex-end;
|
| 274 |
+
margin: 0 -8px;
|
| 275 |
+
padding: 0 8px;
|
| 276 |
+
border-bottom: 1px solid var(--lp-line);
|
| 277 |
}
|
| 278 |
.cg-rail-toggle {
|
| 279 |
width: 28px;
|
|
|
|
| 302 |
position: relative;
|
| 303 |
margin: 0 2px 6px;
|
| 304 |
}
|
| 305 |
+
/* Item 5 β first row under the shared band starts on the same rhythm as the shell nav's
|
| 306 |
+
(8px below the hairline on both rails). */
|
| 307 |
+
.cg-create-new { margin-top: 8px; }
|
| 308 |
.cg-find-view-icon {
|
| 309 |
position: absolute;
|
| 310 |
left: 8px;
|
|
|
|
| 1040 |
color: var(--lp-ink);
|
| 1041 |
}
|
| 1042 |
.cg-pick-row:hover,
|
| 1043 |
+
/* Item 6 (2026-07-31) β the picker is keyboard-run now (arrows move focus, Enter picks):
|
| 1044 |
+
the focused row needs a visible ring, not just a wash a hover already uses. */
|
| 1045 |
.cg-pick-row:focus-visible {
|
| 1046 |
background: #f2f3f6;
|
| 1047 |
+
outline: 2px solid var(--lp-blue-deep);
|
| 1048 |
+
outline-offset: -2px;
|
| 1049 |
}
|
| 1050 |
.cg-pick-row.is-on {
|
| 1051 |
background: #eef2f7;
|
|
|
|
| 2283 |
}
|
| 2284 |
|
| 2285 |
/* WHITE, like the host's `[theme.sidebar]` (owner 2026-07-23: "slick, visible
|
| 2286 |
+
light-grey borders") β the wash belongs to page bodies, not the rail.
|
| 2287 |
+
Item 1 (2026-07-31): the fold ANIMATES on the shared curve; the main pane and the views
|
| 2288 |
+
rail beside it reflow with it, so the whole page glides to the final state. */
|
| 2289 |
.shell-side {
|
| 2290 |
display: flex;
|
| 2291 |
flex-direction: column;
|
|
|
|
| 2295 |
border-right: 1px solid var(--lp-line);
|
| 2296 |
overflow-y: auto;
|
| 2297 |
overflow-x: hidden;
|
| 2298 |
+
transition:
|
| 2299 |
+
width var(--lp-fold-t) var(--lp-fold-e),
|
| 2300 |
+
flex-basis var(--lp-fold-t) var(--lp-fold-e);
|
| 2301 |
}
|
| 2302 |
|
| 2303 |
+
/* Item 5 β the rail head IS the shared top band (--lp-rail-head-h + the same hairline the
|
| 2304 |
+
views rail and the toolbar close with). Item 11's minimize control lives in it, beside the
|
| 2305 |
+
brand. Collapsed, the rail is the slim strip: mark, icons, avatar β the toggle goes
|
| 2306 |
+
(item 2: the logo is the way back), labels fold away smoothly. */
|
| 2307 |
.shell-side-head {
|
| 2308 |
display: flex;
|
| 2309 |
align-items: center;
|
| 2310 |
justify-content: space-between;
|
| 2311 |
+
flex: 0 0 var(--lp-rail-head-h);
|
| 2312 |
+
height: var(--lp-rail-head-h);
|
| 2313 |
+
padding: 0 10px 0 16px;
|
| 2314 |
+
border-bottom: 1px solid var(--lp-line);
|
| 2315 |
+
transition: padding var(--lp-fold-t) var(--lp-fold-e);
|
| 2316 |
}
|
| 2317 |
.shell-rail-toggle {
|
| 2318 |
width: 28px;
|
|
|
|
| 2339 |
width: var(--lp-rail-min);
|
| 2340 |
flex-basis: var(--lp-rail-min);
|
| 2341 |
}
|
| 2342 |
+
/* Item 2 β collapsed, the three-bars control disappears; clicking the logo expands. */
|
| 2343 |
+
.shell-side.is-collapsed .shell-rail-toggle { display: none; }
|
| 2344 |
+
/* Geometry note (item 1): nothing re-centers on collapse β paddings are tuned so the mark
|
| 2345 |
+
and the icons SLIDE to the strip's center as the width animates (a justify-content flip
|
| 2346 |
+
would snap them at t=0). Mark 26px β (48-26)/2 = 11; icon x: 6 + 10 = 16 = (48-16)/2. */
|
| 2347 |
+
.shell-side.is-collapsed .shell-side-head { padding: 0 11px; }
|
| 2348 |
+
.shell-side.is-collapsed .shell-brand { gap: 0; }
|
| 2349 |
.shell-side.is-collapsed .lp-wordmark,
|
| 2350 |
.shell-side.is-collapsed .shell-nav-label,
|
| 2351 |
+
.shell-side.is-collapsed .shell-account-who {
|
| 2352 |
+
max-width: 0;
|
| 2353 |
+
opacity: 0;
|
| 2354 |
+
}
|
| 2355 |
.shell-side.is-collapsed .shell-nav-badge,
|
| 2356 |
.shell-side.is-collapsed .shell-nav-open,
|
| 2357 |
.shell-side.is-collapsed .shell-nav-group,
|
|
|
|
| 2358 |
.shell-side.is-collapsed .shell-account-dots {
|
| 2359 |
display: none;
|
| 2360 |
}
|
| 2361 |
+
.shell-side.is-collapsed .shell-nav { padding: 8px 6px 0; }
|
| 2362 |
.shell-side.is-collapsed .shell-nav-item {
|
| 2363 |
+
padding: 7px 10px;
|
| 2364 |
+
gap: 0;
|
| 2365 |
}
|
| 2366 |
+
.shell-side.is-collapsed .shell-nav-item.is-child { padding-left: 10px; }
|
| 2367 |
+
.shell-side.is-collapsed .shell-side-bottom { padding: 8px 2px 10px; }
|
| 2368 |
.shell-side.is-collapsed .shell-account {
|
| 2369 |
+
padding: 7px 8px;
|
| 2370 |
+
gap: 0;
|
| 2371 |
}
|
| 2372 |
|
| 2373 |
+
/* Item 2 β the brand is a BUTTON: disabled while expanded (brand, not control), the way
|
| 2374 |
+
back while collapsed. One stable element in both states, so the fold can animate it. */
|
| 2375 |
+
.shell-brand-btn {
|
| 2376 |
+
display: flex;
|
| 2377 |
+
align-items: center;
|
| 2378 |
+
padding: 0;
|
| 2379 |
+
margin: 0;
|
| 2380 |
+
border: none;
|
| 2381 |
+
background: none;
|
| 2382 |
+
color: inherit;
|
| 2383 |
+
font: inherit;
|
| 2384 |
+
cursor: pointer;
|
| 2385 |
+
min-width: 0;
|
| 2386 |
+
}
|
| 2387 |
+
.shell-brand-btn:disabled { cursor: default; }
|
| 2388 |
+
.shell-brand-btn:not(:disabled):hover { opacity: 0.8; }
|
| 2389 |
+
.shell-brand-btn:focus-visible {
|
| 2390 |
+
outline: 2px solid var(--lp-blue-deep);
|
| 2391 |
+
outline-offset: 2px;
|
| 2392 |
+
border-radius: var(--lp-r-sm);
|
| 2393 |
+
}
|
| 2394 |
+
.shell-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
|
| 2395 |
/* β DELIBERATELY OFF THE TYPE SCALE. The wordmark is BRAND, not UI text: 17px is what the app's
|
| 2396 |
own nav wordmark resolves to (1.02rem against its 17px base), and matching the sibling door
|
| 2397 |
matters more here than sitting on the --lp-fs-* ladder. The mark's 26/44px are geometry for
|
| 2398 |
the same reason. Nothing else in this block is allowed off the scale. */
|
| 2399 |
+
.shell-brand .lp-wordmark {
|
| 2400 |
+
font-size: 17px;
|
| 2401 |
+
font-weight: 600;
|
| 2402 |
+
letter-spacing: -0.02em;
|
| 2403 |
+
display: inline-block;
|
| 2404 |
+
max-width: 140px;
|
| 2405 |
+
overflow: hidden;
|
| 2406 |
+
white-space: nowrap;
|
| 2407 |
+
transition:
|
| 2408 |
+
max-width var(--lp-fold-t) var(--lp-fold-e),
|
| 2409 |
+
opacity 0.14s ease;
|
| 2410 |
+
}
|
| 2411 |
+
|
| 2412 |
+
/* Item 3 β the collapsed strip's hover tip: fixed beside the rail (the rail scrolls and
|
| 2413 |
+
clips, so it cannot live inside), pointer-transparent by standing rule. */
|
| 2414 |
+
.shell-nav-tip {
|
| 2415 |
+
position: fixed;
|
| 2416 |
+
left: calc(var(--lp-rail-min) + 8px);
|
| 2417 |
+
transform: translateY(-50%);
|
| 2418 |
+
z-index: 90;
|
| 2419 |
+
background: var(--lp-ink);
|
| 2420 |
+
color: #ffffff;
|
| 2421 |
+
font-size: var(--lp-fs-2xs);
|
| 2422 |
+
font-weight: 500;
|
| 2423 |
+
line-height: 1;
|
| 2424 |
+
padding: 6px 9px;
|
| 2425 |
+
border-radius: var(--lp-r-md);
|
| 2426 |
+
box-shadow: 0 4px 14px rgba(24, 30, 48, 0.22);
|
| 2427 |
+
pointer-events: none;
|
| 2428 |
+
white-space: nowrap;
|
| 2429 |
+
animation: lp-tip-in 0.12s ease;
|
| 2430 |
+
}
|
| 2431 |
+
@keyframes lp-tip-in {
|
| 2432 |
+
from { opacity: 0; transform: translate(-3px, -50%); }
|
| 2433 |
+
to { opacity: 1; transform: translate(0, -50%); }
|
| 2434 |
+
}
|
| 2435 |
|
| 2436 |
/* (.shell-nav-caption deleted with the "Workflows" label it existed to style β owner item 10.
|
| 2437 |
.shell-signed / .shell-signed-sub deleted with the "Shared password gate" copy they styled β
|
|
|
|
| 2442 |
|
| 2443 |
/* THREE BANDS, the host's own rhythm (wave-10 I11, measured against Omni):
|
| 2444 |
logo Β· the assistant slot Β· the database list β margins between the bands,
|
| 2445 |
+
tight rows inside them. Item 5: the first row starts 8px under the shared
|
| 2446 |
+
hairline, the same rhythm as the views rail's first row. */
|
| 2447 |
+
.shell-nav {
|
| 2448 |
+
display: flex;
|
| 2449 |
+
flex-direction: column;
|
| 2450 |
+
padding: 8px 10px 0;
|
| 2451 |
+
transition: padding var(--lp-fold-t) var(--lp-fold-e);
|
| 2452 |
+
}
|
| 2453 |
/* The hairline between the assistant band and the database list β the host
|
| 2454 |
draws the same one under its assist slot. */
|
| 2455 |
.shell-nav-list {
|
|
|
|
| 2472 |
color: var(--lp-ink);
|
| 2473 |
text-decoration: none;
|
| 2474 |
border-radius: var(--lp-r-sm);
|
| 2475 |
+
transition:
|
| 2476 |
+
padding var(--lp-fold-t) var(--lp-fold-e),
|
| 2477 |
+
gap var(--lp-fold-t) var(--lp-fold-e);
|
| 2478 |
}
|
| 2479 |
.shell-nav-item:hover { background: var(--lp-surface-2); }
|
| 2480 |
.shell-nav-item.is-child { padding-left: 30px; }
|
|
|
|
| 2500 |
.shell-nav-icon.is-spark { fill: currentColor; stroke: none; }
|
| 2501 |
.shell-nav-item.is-active .shell-nav-icon { opacity: 1; color: var(--lp-blue-deep); }
|
| 2502 |
|
| 2503 |
+
/* Item 1 β labels FOLD with the rail (max-width + opacity on the shared curve) instead of
|
| 2504 |
+
vanishing at t=0; 152px is the widest a label can render in the 240px rail anyway. */
|
| 2505 |
.shell-nav-label {
|
| 2506 |
+
flex: 1 1 auto;
|
| 2507 |
+
min-width: 0;
|
| 2508 |
+
max-width: 152px;
|
| 2509 |
overflow: hidden;
|
| 2510 |
text-overflow: ellipsis;
|
| 2511 |
white-space: nowrap;
|
| 2512 |
+
transition:
|
| 2513 |
+
max-width var(--lp-fold-t) var(--lp-fold-e),
|
| 2514 |
+
opacity 0.14s ease;
|
| 2515 |
}
|
| 2516 |
|
| 2517 |
/* The new-tab affordance on a hand-off row: quiet until the row is hovered,
|
|
|
|
| 2572 |
margin-top: auto;
|
| 2573 |
padding: 8px 10px 10px;
|
| 2574 |
border-top: 1px solid var(--lp-line);
|
| 2575 |
+
transition: padding var(--lp-fold-t) var(--lp-fold-e);
|
| 2576 |
}
|
| 2577 |
|
| 2578 |
/* The account corner: ONE line (the host's `_account_css` card) that opens the
|
|
|
|
| 2593 |
border-radius: var(--lp-r-sm);
|
| 2594 |
cursor: pointer;
|
| 2595 |
color: var(--lp-ink);
|
| 2596 |
+
transition:
|
| 2597 |
+
padding var(--lp-fold-t) var(--lp-fold-e),
|
| 2598 |
+
gap var(--lp-fold-t) var(--lp-fold-e);
|
| 2599 |
}
|
| 2600 |
.shell-account:hover { background: var(--lp-surface-2); }
|
| 2601 |
.shell-account:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: -2px; }
|
|
|
|
| 2613 |
font-size: var(--lp-fs-2xs);
|
| 2614 |
font-weight: 600;
|
| 2615 |
}
|
| 2616 |
+
.shell-account-who {
|
| 2617 |
+
display: flex;
|
| 2618 |
+
flex-direction: column;
|
| 2619 |
+
min-width: 0;
|
| 2620 |
+
line-height: 1.25;
|
| 2621 |
+
flex: 1 1 auto;
|
| 2622 |
+
max-width: 152px;
|
| 2623 |
+
overflow: hidden;
|
| 2624 |
+
transition:
|
| 2625 |
+
max-width var(--lp-fold-t) var(--lp-fold-e),
|
| 2626 |
+
opacity 0.14s ease;
|
| 2627 |
+
}
|
| 2628 |
.shell-account-name {
|
| 2629 |
font-size: var(--lp-fs-2xs);
|
| 2630 |
font-weight: 600;
|
web/src/shell/Shell.tsx
CHANGED
|
@@ -31,6 +31,7 @@
|
|
| 31 |
// ---------------------------------------------------------------------------
|
| 32 |
|
| 33 |
import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
|
| 34 |
import CustomerGrid from "../customer-grid/CustomerGrid";
|
| 35 |
import { clearCustomersCache } from "../customer-grid/apiBridge";
|
| 36 |
import { OverlayProvider } from "../customer-grid/OverlaySurface";
|
|
@@ -308,6 +309,23 @@ export default function Shell() {
|
|
| 308 |
// storage can be blocked; the toggle still works for the session
|
| 309 |
}
|
| 310 |
}, [navCollapsed]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
|
| 312 |
// The window signals the data layer raises (apiContract.ts). It talks to the
|
| 313 |
// frame this way because `customer-grid/**` is host-neutral β the same tree
|
|
@@ -441,14 +459,28 @@ export default function Shell() {
|
|
| 441 |
same generated file, so the two shells cannot drift. "Royal Imports"
|
| 442 |
stays on business documents only. */}
|
| 443 |
<div className="shell-side-head">
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
<button
|
| 446 |
type="button"
|
| 447 |
className="shell-rail-toggle"
|
| 448 |
-
aria-label=
|
| 449 |
aria-expanded={!navCollapsed}
|
| 450 |
-
title=
|
| 451 |
-
onClick={() => setNavCollapsed(
|
| 452 |
>
|
| 453 |
<RailToggleIcon />
|
| 454 |
</button>
|
|
@@ -465,6 +497,8 @@ export default function Shell() {
|
|
| 465 |
href={appLink(APP_BASE, "analyst")}
|
| 466 |
target="_blank"
|
| 467 |
rel="noreferrer"
|
|
|
|
|
|
|
| 468 |
>
|
| 469 |
<SparkIcon />
|
| 470 |
<span className="shell-nav-label">AI assistant</span>
|
|
@@ -499,12 +533,26 @@ export default function Shell() {
|
|
| 499 |
</div>
|
| 500 |
);
|
| 501 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
return item.kind === "native" ? (
|
| 503 |
-
<a key={item.key} className={cls} href={item.href}>
|
| 504 |
{inner}
|
| 505 |
</a>
|
| 506 |
) : (
|
| 507 |
-
<a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
{inner}
|
| 509 |
</a>
|
| 510 |
);
|
|
@@ -535,6 +583,8 @@ export default function Shell() {
|
|
| 535 |
}
|
| 536 |
: undefined
|
| 537 |
}
|
|
|
|
|
|
|
| 538 |
>
|
| 539 |
<AccountMenu
|
| 540 |
user={session.user}
|
|
@@ -545,6 +595,19 @@ export default function Shell() {
|
|
| 545 |
</div>
|
| 546 |
</aside>
|
| 547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 548 |
<main className="shell-main">
|
| 549 |
{/* β An honest failure, never a fallback to the bundled sample. Behind
|
| 550 |
a login, plausible-looking sample revenue is fabricated data on a
|
|
|
|
| 31 |
// ---------------------------------------------------------------------------
|
| 32 |
|
| 33 |
import { useCallback, useEffect, useRef, useState } from "react";
|
| 34 |
+
import type { MouseEvent as ReactMouseEvent } from "react";
|
| 35 |
import CustomerGrid from "../customer-grid/CustomerGrid";
|
| 36 |
import { clearCustomersCache } from "../customer-grid/apiBridge";
|
| 37 |
import { OverlayProvider } from "../customer-grid/OverlaySurface";
|
|
|
|
| 309 |
// storage can be blocked; the toggle still works for the session
|
| 310 |
}
|
| 311 |
}, [navCollapsed]);
|
| 312 |
+
// Owner item 3 (2026-07-31) β the collapsed strip names its icons on hover. A real DOM
|
| 313 |
+
// tooltip positioned FIXED beside the rail: the rail scrolls and clips (overflow), so a
|
| 314 |
+
// CSS ::after inside it could never escape; and it is pointer-events:none by standing rule
|
| 315 |
+
// ([[ui-invisible-to-assertions]] β a tooltip that can receive the pointer swallows the
|
| 316 |
+
// next click).
|
| 317 |
+
const [navTip, setNavTip] = useState<{ label: string; y: number } | null>(null);
|
| 318 |
+
useEffect(() => {
|
| 319 |
+
if (!navCollapsed) setNavTip(null);
|
| 320 |
+
}, [navCollapsed]);
|
| 321 |
+
const tipEnter = useCallback(
|
| 322 |
+
(label: string) => (e: ReactMouseEvent<HTMLElement>) => {
|
| 323 |
+
const r = e.currentTarget.getBoundingClientRect();
|
| 324 |
+
setNavTip({ label, y: r.top + r.height / 2 });
|
| 325 |
+
},
|
| 326 |
+
[]
|
| 327 |
+
);
|
| 328 |
+
const tipLeave = useCallback(() => setNavTip(null), []);
|
| 329 |
|
| 330 |
// The window signals the data layer raises (apiContract.ts). It talks to the
|
| 331 |
// frame this way because `customer-grid/**` is host-neutral β the same tree
|
|
|
|
| 459 |
same generated file, so the two shells cannot drift. "Royal Imports"
|
| 460 |
stays on business documents only. */}
|
| 461 |
<div className="shell-side-head">
|
| 462 |
+
{/* Owner item 2 (2026-07-31) β collapsed, the LOGO is the way back and the
|
| 463 |
+
three-bars toggle disappears (CSS hides it). One stable element in both states
|
| 464 |
+
so the mark can animate rather than swap; disabled while expanded, where it is
|
| 465 |
+
brand, not control. */}
|
| 466 |
+
<button
|
| 467 |
+
type="button"
|
| 468 |
+
className="shell-brand-btn"
|
| 469 |
+
disabled={!navCollapsed}
|
| 470 |
+
aria-label={navCollapsed ? "Expand navigation" : undefined}
|
| 471 |
+
onMouseEnter={navCollapsed ? tipEnter("Expand navigation") : undefined}
|
| 472 |
+
onMouseLeave={navCollapsed ? tipLeave : undefined}
|
| 473 |
+
onClick={() => setNavCollapsed(false)}
|
| 474 |
+
>
|
| 475 |
+
<Brand size={26} className="shell-brand" />
|
| 476 |
+
</button>
|
| 477 |
<button
|
| 478 |
type="button"
|
| 479 |
className="shell-rail-toggle"
|
| 480 |
+
aria-label="Minimize navigation"
|
| 481 |
aria-expanded={!navCollapsed}
|
| 482 |
+
title="Minimize navigation"
|
| 483 |
+
onClick={() => setNavCollapsed(true)}
|
| 484 |
>
|
| 485 |
<RailToggleIcon />
|
| 486 |
</button>
|
|
|
|
| 497 |
href={appLink(APP_BASE, "analyst")}
|
| 498 |
target="_blank"
|
| 499 |
rel="noreferrer"
|
| 500 |
+
onMouseEnter={navCollapsed ? tipEnter("AI assistant") : undefined}
|
| 501 |
+
onMouseLeave={navCollapsed ? tipLeave : undefined}
|
| 502 |
>
|
| 503 |
<SparkIcon />
|
| 504 |
<span className="shell-nav-label">AI assistant</span>
|
|
|
|
| 533 |
</div>
|
| 534 |
);
|
| 535 |
}
|
| 536 |
+
// Owner item 3 β collapsed, the icon names its database on hover.
|
| 537 |
+
const tip = navCollapsed
|
| 538 |
+
? {
|
| 539 |
+
onMouseEnter: tipEnter(item.label),
|
| 540 |
+
onMouseLeave: tipLeave,
|
| 541 |
+
}
|
| 542 |
+
: {};
|
| 543 |
return item.kind === "native" ? (
|
| 544 |
+
<a key={item.key} className={cls} href={item.href} {...tip}>
|
| 545 |
{inner}
|
| 546 |
</a>
|
| 547 |
) : (
|
| 548 |
+
<a
|
| 549 |
+
key={item.key}
|
| 550 |
+
className={cls}
|
| 551 |
+
href={item.href}
|
| 552 |
+
target="_blank"
|
| 553 |
+
rel="noreferrer"
|
| 554 |
+
{...tip}
|
| 555 |
+
>
|
| 556 |
{inner}
|
| 557 |
</a>
|
| 558 |
);
|
|
|
|
| 583 |
}
|
| 584 |
: undefined
|
| 585 |
}
|
| 586 |
+
onMouseEnter={navCollapsed ? tipEnter(session.user.name) : undefined}
|
| 587 |
+
onMouseLeave={navCollapsed ? tipLeave : undefined}
|
| 588 |
>
|
| 589 |
<AccountMenu
|
| 590 |
user={session.user}
|
|
|
|
| 595 |
</div>
|
| 596 |
</aside>
|
| 597 |
|
| 598 |
+
{/* Item 3 β the collapsed rail's hover tip: fixed beside the strip, outside the
|
| 599 |
+
scrolling rail that would clip it, and pointer-transparent by standing rule. */}
|
| 600 |
+
{navTip ? (
|
| 601 |
+
<div
|
| 602 |
+
className="shell-nav-tip"
|
| 603 |
+
style={{ top: navTip.y }}
|
| 604 |
+
role="tooltip"
|
| 605 |
+
aria-hidden="true"
|
| 606 |
+
>
|
| 607 |
+
{navTip.label}
|
| 608 |
+
</div>
|
| 609 |
+
) : null}
|
| 610 |
+
|
| 611 |
<main className="shell-main">
|
| 612 |
{/* β An honest failure, never a fallback to the bundled sample. Behind
|
| 613 |
a login, plausible-looking sample revenue is fabricated data on a
|