fsanyoto commited on
Commit
05b3449
·
verified ·
1 Parent(s): dcee68f

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "161f8a6",
3
  "releases": [
4
  {
5
  "version": "v53",
 
1
  {
2
+ "current": "c75c333",
3
  "releases": [
4
  {
5
  "version": "v53",
VERSION CHANGED
@@ -1 +1 @@
1
- 161f8a6
 
1
+ c75c333
web/src/customer-grid/ColumnMenu.tsx CHANGED
@@ -917,6 +917,26 @@ function OptionsEditor({
917
  );
918
  }
919
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
920
  /**
921
  * The create-picker's kind: a creatable overlay type, or the FORMULA-MEASURE pseudo-kind.
922
  * "measure" is deliberately NOT a FieldType — a measure column's real type comes from the
@@ -3452,6 +3472,7 @@ export default function ColumnMenu({
3452
  onChange={(event) => setNote(event.target.value)}
3453
  />
3454
  </label>
 
3455
  {/* C5-AUTOFIELD — an EXISTING automation column edits its CONFIG, not its type.
3456
  ⚠ This guard is load-bearing, not tidiness. `automation` is excluded from
3457
  RETYPE_TYPES (see its note), so rendering the picker for one would show a
 
917
  );
918
  }
919
 
920
+ /**
921
+ * A source-backed choice field may be editable at the record level while its schema stays owned
922
+ * by the database contract. The normal options editor must not promise a definition write for
923
+ * that field, but hiding its hydrated vocabulary makes an imported value look unconfigured.
924
+ */
925
+ function ChoicePreview({ field }: { field: Field }) {
926
+ const options = choiceOptions(field);
927
+ if (options.length === 0) return null;
928
+ return (
929
+ <div className="cg-options-editor cg-options-preview">
930
+ <div className="cg-options-head"><strong>Choices</strong></div>
931
+ <div className="cg-options-preview-list">
932
+ {options.map((option) => (
933
+ <span className="cg-option-preview" key={option}>{option}</span>
934
+ ))}
935
+ </div>
936
+ </div>
937
+ );
938
+ }
939
+
940
  /**
941
  * The create-picker's kind: a creatable overlay type, or the FORMULA-MEASURE pseudo-kind.
942
  * "measure" is deliberately NOT a FieldType — a measure column's real type comes from the
 
3472
  onChange={(event) => setNote(event.target.value)}
3473
  />
3474
  </label>
3475
+ {!onRetype && needsOptions(field.type) && <ChoicePreview field={field} />}
3476
  {/* C5-AUTOFIELD — an EXISTING automation column edits its CONFIG, not its type.
3477
  ⚠ This guard is load-bearing, not tidiness. `automation` is excluded from
3478
  RETYPE_TYPES (see its note), so rendering the picker for one would show a
web/src/customer-grid/CustomerGrid.tsx CHANGED
@@ -10221,6 +10221,15 @@ function CustomerGridSurface({
10221
  }))
10222
  }
10223
  onNotesCommit={(key, value) => patchAndRecord(detailPid, { [key]: value })}
 
 
 
 
 
 
 
 
 
10224
  viewer={viewer}
10225
  // Wave-14 close-out stitch (HOST): TSREC's two light-switch props, unwired when
10226
  // the GRID session ended — item 9's picker vocabulary + item 11's photos. Same
 
10221
  }))
10222
  }
10223
  onNotesCommit={(key, value) => patchAndRecord(detailPid, { [key]: value })}
10224
+ onChoiceAdded={(key, choice) =>
10225
+ setFields((current) => current.map((item) => {
10226
+ if (item.key !== key ||
10227
+ (item.type !== "select" && item.type !== "multiselect") ||
10228
+ choiceOptions(item).some((existing) =>
10229
+ existing.toLowerCase() === choice.toLowerCase())) return item;
10230
+ return { ...item, options: [...choiceOptions(item), choice] };
10231
+ }))
10232
+ }
10233
  viewer={viewer}
10234
  // Wave-14 close-out stitch (HOST): TSREC's two light-switch props, unwired when
10235
  // the GRID session ended — item 9's picker vocabulary + item 11's photos. Same
web/src/customer-grid/RecordDetail.css CHANGED
@@ -420,6 +420,35 @@
420
  font-size: var(--lp-fs-2xs);
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  /* Multiselect: a chip row, not a `<select multiple>`. The native control needs
424
  ctrl-click for a second value and paints a four-row scrollbox for a
425
  three-choice field; a chip says its own state and takes one click. */
 
420
  font-size: var(--lp-fs-2xs);
421
  }
422
 
423
+ .cg-record-main .cg-detail-choice-create {
424
+ display: flex;
425
+ align-items: center;
426
+ flex: 1 1 auto;
427
+ min-width: 0;
428
+ gap: 7px;
429
+ }
430
+
431
+ .cg-record-main .cg-detail-choice-add {
432
+ flex: 0 0 auto;
433
+ padding: 2px 0;
434
+ border: 0;
435
+ background: transparent;
436
+ color: var(--lp-blue-solid);
437
+ font: inherit;
438
+ font-size: var(--lp-fs-2xs);
439
+ font-weight: 600;
440
+ white-space: nowrap;
441
+ cursor: pointer;
442
+ }
443
+
444
+ .cg-record-main .cg-detail-choice-add:hover { text-decoration: underline; }
445
+
446
+ .cg-record-main .cg-detail-choice-add:focus-visible {
447
+ outline: 2px solid var(--lp-blue-deep);
448
+ outline-offset: 1px;
449
+ border-radius: var(--lp-r-sm);
450
+ }
451
+
452
  /* Multiselect: a chip row, not a `<select multiple>`. The native control needs
453
  ctrl-click for a second value and paints a four-row scrollbox for a
454
  three-choice field; a chip says its own state and takes one click. */
web/src/customer-grid/RecordDetail.tsx CHANGED
@@ -35,7 +35,7 @@ import {
35
  import { actionHref } from "./display";
36
  import JsonViewer, { CodeViewer } from "./JsonViewer";
37
  import { StarRow, StarIcon } from "./Stars";
38
- import { AI_STATE_PREFIX, codeLanguageOf, isPickType, mayEditField, ratingMax } from "./types";
39
  /* ⭐⭐ W41-T44 (owner instruction 25) — THE PIVOT'S VOCABULARY IS IMPORTED, NEVER RESTATED.
40
  W41-T42 declared all of it in `types.ts` precisely because this ticket and W41-T43 open the
41
  same feature through other doors and neither may edit that file. A second `buildPivotRequest`
@@ -161,6 +161,8 @@ export interface RecordDetailProps {
161
  onClose: () => void;
162
  onNotesChange: (key: string, value: string) => void;
163
  onNotesCommit: (key: string, value: string) => void;
 
 
164
  /**
165
  * ⭐ W35-T29 (C5, R5/R6) — this record's star, and the two halves travel TOGETHER.
166
  *
@@ -400,6 +402,47 @@ function recordPivotFilter(fields: Field[], record: Row): FilterRule | null {
400
  return null;
401
  }
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  /**
404
  * ⭐ THE SAME FOUR STATES `CustomerGrid` KEEPS, AND THE SAME WORDS FOR THEM. `absent` is not an
405
  * empty result: it is "the endpoint that answers this question is not there, or did not answer"
@@ -428,6 +471,7 @@ export default function RecordDetail({
428
  onClose,
429
  onNotesChange,
430
  onNotesCommit,
 
431
  starred = false,
432
  onStar,
433
  viewer,
@@ -1035,32 +1079,42 @@ export default function RecordDetail({
1035
  matches what the canvas paints for the same cell. `user` columns are excluded: a
1036
  person is not a choice with a palette, and `optionTint` would hash a name into
1037
  one. */}
1038
- <select
1039
- id={inputId}
1040
- className="cg-detail-select"
1041
- value={current}
1042
- style={
1043
- field.type === "select"
1044
- ? (() => {
1045
- const tint = optionTint(field, current);
1046
- return tint
1047
- ? { background: tint.bg, color: tint.fg,
1048
- borderColor: optionBorderColor(tint.bg) }
1049
- : undefined;
1050
- })()
1051
- : undefined
1052
- }
1053
- onChange={(event) => onNotesCommit(field.key, event.target.value)}
1054
- >
1055
- <option value="">
1056
- {field.type === "user" ? "Unassigned" : "None"}
1057
- </option>
1058
- {entries.map((entry) => (
1059
- <option key={entry.value} value={entry.value}>
1060
- {entry.label}
 
 
 
 
 
1061
  </option>
1062
- ))}
1063
- </select>
 
 
 
 
 
1064
  </span>
1065
  );
1066
  } else if (isControl && field.type === "multiselect") {
@@ -1078,9 +1132,13 @@ export default function RecordDetail({
1078
  aria-labelledby={`${inputId}-lbl`}
1079
  >
1080
  {entries.length === 0 ? (
1081
- <span className="cg-detail-nochoice">
1082
- No choices yet. Add them from the column menu.
1083
- </span>
 
 
 
 
1084
  ) : (
1085
  /**
1086
  * ⭐ W40-T23 (owner instruction 14) — TYPE-AHEAD ON THE CHIP ROW.
 
35
  import { actionHref } from "./display";
36
  import JsonViewer, { CodeViewer } from "./JsonViewer";
37
  import { StarRow, StarIcon } from "./Stars";
38
+ import { AI_STATE_PREFIX, choiceOptions, codeLanguageOf, isPickType, mayEditField, ratingMax } from "./types";
39
  /* ⭐⭐ W41-T44 (owner instruction 25) — THE PIVOT'S VOCABULARY IS IMPORTED, NEVER RESTATED.
40
  W41-T42 declared all of it in `types.ts` precisely because this ticket and W41-T43 open the
41
  same feature through other doors and neither may edit that file. A second `buildPivotRequest`
 
161
  onClose: () => void;
162
  onNotesChange: (key: string, value: string) => void;
163
  onNotesCommit: (key: string, value: string) => void;
164
+ /** Keeps a just-created source-backed choice available before the next payload refresh. */
165
+ onChoiceAdded: (key: string, value: string) => void;
166
  /**
167
  * ⭐ W35-T29 (C5, R5/R6) — this record's star, and the two halves travel TOGETHER.
168
  *
 
402
  return null;
403
  }
404
 
405
+ /** The record drawer's equivalent of the grid picker's `Add option` row. */
406
+ function ChoiceCreateInput({
407
+ field,
408
+ onCreate,
409
+ }: {
410
+ field: Field;
411
+ onCreate: (value: string) => void;
412
+ }) {
413
+ const [draft, setDraft] = useState("");
414
+ const candidate = draft.trim().replace(/\s+/g, " ").slice(0, 60);
415
+ const isNew = candidate !== "" && !choiceOptions(field).some(
416
+ (choice) => choice.toLowerCase() === candidate.toLowerCase()
417
+ );
418
+ const create = () => {
419
+ if (!isNew) return;
420
+ onCreate(candidate);
421
+ setDraft("");
422
+ };
423
+ return (
424
+ <span className="cg-detail-choice-create">
425
+ <input
426
+ className="cg-detail-input"
427
+ value={draft}
428
+ placeholder="Find or add a choice…"
429
+ aria-label={`Add a ${field.label} choice`}
430
+ onChange={(event) => setDraft(event.target.value)}
431
+ onKeyDown={(event) => {
432
+ if (event.key !== "Enter") return;
433
+ event.preventDefault();
434
+ create();
435
+ }}
436
+ />
437
+ {isNew && (
438
+ <button type="button" className="cg-detail-choice-add" onClick={create}>
439
+ Add option: {candidate}
440
+ </button>
441
+ )}
442
+ </span>
443
+ );
444
+ }
445
+
446
  /**
447
  * ⭐ THE SAME FOUR STATES `CustomerGrid` KEEPS, AND THE SAME WORDS FOR THEM. `absent` is not an
448
  * empty result: it is "the endpoint that answers this question is not there, or did not answer"
 
471
  onClose,
472
  onNotesChange,
473
  onNotesCommit,
474
+ onChoiceAdded,
475
  starred = false,
476
  onStar,
477
  viewer,
 
1079
  matches what the canvas paints for the same cell. `user` columns are excluded: a
1080
  person is not a choice with a palette, and `optionTint` would hash a name into
1081
  one. */}
1082
+ {field.type === "select" && entries.length === 0 ? (
1083
+ <ChoiceCreateInput
1084
+ field={field}
1085
+ onCreate={(choice) => {
1086
+ onChoiceAdded(field.key, choice);
1087
+ onNotesCommit(field.key, choice);
1088
+ }}
1089
+ />
1090
+ ) : (
1091
+ <select
1092
+ id={inputId}
1093
+ className="cg-detail-select"
1094
+ value={current}
1095
+ style={
1096
+ field.type === "select"
1097
+ ? (() => {
1098
+ const tint = optionTint(field, current);
1099
+ return tint
1100
+ ? { background: tint.bg, color: tint.fg,
1101
+ borderColor: optionBorderColor(tint.bg) }
1102
+ : undefined;
1103
+ })()
1104
+ : undefined
1105
+ }
1106
+ onChange={(event) => onNotesCommit(field.key, event.target.value)}
1107
+ >
1108
+ <option value="">
1109
+ {field.type === "user" ? "Unassigned" : "None"}
1110
  </option>
1111
+ {entries.map((entry) => (
1112
+ <option key={entry.value} value={entry.value}>
1113
+ {entry.label}
1114
+ </option>
1115
+ ))}
1116
+ </select>
1117
+ )}
1118
  </span>
1119
  );
1120
  } else if (isControl && field.type === "multiselect") {
 
1132
  aria-labelledby={`${inputId}-lbl`}
1133
  >
1134
  {entries.length === 0 ? (
1135
+ <ChoiceCreateInput
1136
+ field={field}
1137
+ onCreate={(choice) => {
1138
+ onChoiceAdded(field.key, choice);
1139
+ onNotesCommit(field.key, [...held, choice].join(","));
1140
+ }}
1141
+ />
1142
  ) : (
1143
  /**
1144
  * ⭐ W40-T23 (owner instruction 14) — TYPE-AHEAD ON THE CHIP ROW.
web/src/index.css CHANGED
@@ -1754,6 +1754,20 @@ body > .cg-overlay {
1754
  cursor: pointer;
1755
  }
1756
  .cg-option-add:hover { text-decoration: underline; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1757
  .cg-field-hint {
1758
  display: block;
1759
  font-size: var(--lp-fs-3xs);
 
1754
  cursor: pointer;
1755
  }
1756
  .cg-option-add:hover { text-decoration: underline; }
1757
+ .cg-options-preview-list {
1758
+ display: flex;
1759
+ flex-wrap: wrap;
1760
+ gap: 5px;
1761
+ }
1762
+ .cg-option-preview {
1763
+ padding: 2px 7px;
1764
+ border: 1px solid var(--lp-line);
1765
+ border-radius: var(--lp-r-pill);
1766
+ background: var(--lp-surface-2);
1767
+ color: var(--lp-ink);
1768
+ font-size: var(--lp-fs-2xs);
1769
+ line-height: 1.35;
1770
+ }
1771
  .cg-field-hint {
1772
  display: block;
1773
  font-size: var(--lp-fs-3xs);