aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FieldView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/FieldView.tsx')
-rw-r--r--src/client/views/nodes/FieldView.tsx50
1 files changed, 9 insertions, 41 deletions
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index 86779e0dd..85dd779fc 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -50,50 +50,18 @@ export class FieldView extends React.Component<FieldViewProps> {
@computed
get field(): FieldResult {
- const { Document, fieldKey } = this.props;
+ const { Document, fieldKey: fieldKey } = this.props;
return Document[fieldKey];
}
render() {
const field = this.field;
- if (field === undefined) {
- return <p>{'<null>'}</p>;
- }
- // if (typeof field === "string") {
- // return <p>{field}</p>;
- // }
- // else if (field instanceof RichTextField) {
- // return <FormattedTextBox {...this.props} />;
- // }
- // else if (field instanceof ImageField) {
- // return <ImageBox {...this.props} />;
- // }
- // else if (field instaceof PresBox) {
- // return <PresBox {...this.props} />;
- // }
- // else if (field instanceof VideoField) {
- // return <VideoBox {...this.props} />;
- // }
- // else if (field instanceof AudioField) {
- // return <AudioBox {...this.props} />;
- //}
- else if (field instanceof DateField) {
- return <p>{field.date.toLocaleString()}</p>;
- } else if (field instanceof Doc) {
- return (
- <p>
- <b>{field.title?.toString()}</b>
- </p>
- );
- } else if (field instanceof List) {
- return <div> {field.length ? field.map(f => Field.toString(f)).join(', ') : ''} </div>;
- }
- // bcz: this belongs here, but it doesn't render well so taking it out for now
- else if (field instanceof WebField) {
- return <p>{Field.toString(field.url.href)}</p>;
- } else if (!(field instanceof Promise)) {
- return <p>{Field.toString(field)}</p>;
- } else {
- return <p> {'Waiting for server...'} </p>;
- }
+ // prettier-ignore
+ if (field instanceof Doc) return <p> <b>{field.title?.toString()}</b></p>;
+ if (field === undefined) return <p>{'<null>'}</p>;
+ if (field instanceof DateField) return <p>{field.date.toLocaleString()}</p>;
+ if (field instanceof List) return <div> {field.map(f => Field.toString(f)).join(', ')} </div>;
+ if (field instanceof WebField) return <p>{Field.toString(field.url.href)}</p>;
+ if (!(field instanceof Promise)) return <p>{Field.toString(field)}</p>;
+ return <p> {'Waiting for server...'} </p>;
}
}