Download web/src/customer-grid/FieldProperties.tsx from fsanyoto/loopable: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/spaces/fsanyoto/loopable/resolve/main/web/src/customer-grid/FieldProperties.tsx
- Command line
-
hf download hf://spaces/fsanyoto/loopable/web/src/customer-grid/FieldProperties.tsx
-
curl -L -o FieldProperties.tsx https://huggingface.co/spaces/fsanyoto/loopable/resolve/main/web/src/customer-grid/FieldProperties.tsx
1.68 kB
| import { isPickType } from "./types"; | |
| import type { Field } from "./types"; | |
| /** C3's server-owned field facts are intentionally read, never inferred client-side. */ | |
| type ContractField = Field & { | |
| origin?: string; | |
| valueAuthority?: string; | |
| scope?: string; | |
| deletionLocked?: boolean; | |
| }; | |
| const unknown = "Not provided"; | |
| export function FieldProperties({ field }: { field: Field }) { | |
| const contract = field as ContractField; | |
| // W48-T18 — connector identity fields are allowed to omit optional presentation | |
| // metadata. The menu must remain inspectable rather than assuming a custom-field shape. | |
| const kind = typeof contract.kind === "string" ? contract.kind : field.type; | |
| const axes = [ | |
| ["Kind", kind === "json" ? "Table" : kind], | |
| ["Origin", contract.origin], | |
| ["Value authority", contract.valueAuthority], | |
| ["Scope", contract.scope], | |
| ]; | |
| return ( | |
| <section className="cg-field-properties" aria-label={`${field.label} properties`}> | |
| <h3>Field properties</h3> | |
| <dl> | |
| {axes.map(([label, value]) => ( | |
| <div key={label}> | |
| <dt>{label}</dt> | |
| <dd>{value || unknown}</dd> | |
| </div> | |
| ))} | |
| <div> | |
| <dt>Deletion lock</dt> | |
| <dd>{contract.deletionLocked ? "Locked" : "Not locked"}</dd> | |
| </div> | |
| {isPickType(field.type) && typeof field.limits?.maxOptions === "number" && ( | |
| <div> | |
| <dt>Maximum options</dt> | |
| <dd>{field.limits.maxOptions}</dd> | |
| </div> | |
| )} | |
| </dl> | |
| </section> | |
| ); | |
| } | |
| export function fieldDeletionLocked(field: Field): boolean { | |
| return Boolean((field as ContractField).deletionLocked); | |
| } | |