summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/align/components/annotations/annotationForms
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/align/components/annotations/annotationForms')
-rw-r--r--animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.utility.js80
-rw-r--r--animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js11
2 files changed, 88 insertions, 3 deletions
diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.utility.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.utility.js
new file mode 100644
index 0000000..2b6f868
--- /dev/null
+++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.utility.js
@@ -0,0 +1,80 @@
+import React, { Component } from 'react'
+
+import { timestamp } from 'app/utils'
+import { TextInput, LabelDescription, Select } from 'app/common'
+import { CURTAIN_COLOR_SELECT_OPTIONS } from 'app/constants'
+import { curtainTimings } from 'app/utils/annotation.utils'
+
+export const AnnotationFormCurtain = ({ annotation, handleSettingsChange, handleSettingsSelect }) => {
+ const {
+ fadeInDurationInSeconds, fadeOutDurationInSeconds, durationInSeconds,
+ start_ts, end_ts, fade_in_end_ts, fade_out_start_ts,
+ } = curtainTimings(annotations)
+
+ return (
+ <div className='options'>
+ <TextInput
+ title="Total duration"
+ name="duration"
+ className="number"
+ placeholder="0:00"
+ data={annotation.settings}
+ onChange={handleSettingsChange}
+ autoComplete="off"
+ />
+ <LabelDescription>
+ {durationInSeconds}
+ {' seconds, ends at '}
+ {timestamp(end_ts)}
+ </LabelDescription>
+
+ <TextInput
+ title="Fade in duration"
+ name="fade_in_duration"
+ className="number"
+ placeholder="0:00"
+ data={annotation.settings}
+ onChange={handleSettingsChange}
+ autoComplete="off"
+ />
+ <LabelDescription>
+ {fadeInDurationInSeconds}
+ {' seconds, ends at '}
+ {timestamp(fade_in_end_ts)}
+ </LabelDescription>
+
+ <TextInput
+ title="Fade out duration"
+ name="fade_out_duration"
+ className="number"
+ placeholder="0:00"
+ data={annotation.settings}
+ onChange={handleSettingsChange}
+ autoComplete="off"
+ />
+ <LabelDescription>
+ {fadeOutDurationInSeconds}
+ {' seconds, starts at '}
+ {timestamp(fade_out_start_ts)}
+ </LabelDescription>
+
+ <Select
+ title='Color'
+ name='color'
+ selected={annotation.settings.color}
+ options={CURTAIN_COLOR_SELECT_OPTIONS}
+ defaultOption='Pick a color'
+ onChange={handleSettingsSelect}
+ />
+
+ <TextInput
+ title="Curtain text"
+ name="curtain_text"
+ placeholder="Enter text or leave blank"
+ data={annotation.settings}
+ onChange={handleSettingsChange}
+ autoComplete="off"
+ />
+ </div>
+ )
+}
diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
index 1411efc..29f9def 100644
--- a/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
+++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
@@ -6,7 +6,12 @@ import {
AnnotationFormImage,
} from './annotationForm.image'
-export {
- AnnotationFormImage,
- AnnotationFormVideo,
+import {
+ AnnotationFormCurtain,
+} from './annotationForm.utility'
+
+export const annotationFormLookup = {
+ image: AnnotationFormImage,
+ video: AnnotationFormVideo,
+ curtain: AnnotationFormCurtain,
}