From 7e6dfb31af78b9d5a1a4ccec6998b14beb8a1194 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 10 Mar 2021 17:33:21 +0100 Subject: refactor annotation forms out of the directory nest --- .../annotationForms/annotationForm.gallery.js | 132 ++++++++++++++++ .../annotationForms/annotationForm.image.js | 120 ++++++++++++++ .../annotationForms/annotationForm.text.js | 153 ++++++++++++++++++ .../annotationForms/annotationForm.utility.js | 172 +++++++++++++++++++++ .../annotationForms/annotationForm.video.js | 160 +++++++++++++++++++ .../annotation/components/annotationForms/index.js | 46 ++++++ 6 files changed, 783 insertions(+) create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.gallery.js create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.image.js create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.text.js create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.utility.js create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.video.js create mode 100644 animism-align/frontend/app/views/editor/annotation/components/annotationForms/index.js (limited to 'animism-align/frontend/app/views/editor/annotation/components/annotationForms') diff --git a/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.gallery.js b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.gallery.js new file mode 100644 index 0000000..0a8b3fb --- /dev/null +++ b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.gallery.js @@ -0,0 +1,132 @@ +import React, { Component } from 'react' + +import { CURTAIN_COLOR_SELECT_OPTIONS } from 'app/constants' +import { TextInput, Select, Checkbox, LabelDescription } from 'app/common' +import { AnnotationFormFullscreen } from './annotationForm.utility' +import { makeMediaItems, makeGalleryItems } from 'app/utils/annotation.utils' + +export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => { + if (!media.lookup) return
+ const image_list_items = makeMediaItems(media, ['gallery']) + return ( +
+ + + + + {gallery_items && ( + + + {gallery_items && ( + + + {(annotation.settings.fullscreen) && ( +
+ + +
+ )} + + + + + + + + {(annotation.settings.fullscreen && !annotation.settings.inline) && ( + + )} +
+ ) +} diff --git a/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.text.js b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.text.js new file mode 100644 index 0000000..8bc7675 --- /dev/null +++ b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.text.js @@ -0,0 +1,153 @@ +import React, { Component } from 'react' + +import { + CURTAIN_COLOR_SELECT_OPTIONS, + CURTAIN_STYLE_SELECT_OPTIONS, + BLACK_WHITE_SELECT_OPTIONS, + IMAGE_BACKGROUND_SIZE_OPTIONS, +} from 'app/constants' +import { Select, Checkbox, TextInput, LabelDescription } from 'app/common' +import { AnnotationFormFullscreen } from './annotationForm.utility' +import { makeMediaItems } from 'app/utils/annotation.utils' + +export const AnnotationFormSectionHeading = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => { + const image_list_items = makeMediaItems(media, ['image', 'video', 'gallery']) + return ( +
+ + + + + {'Player will fade from this color when section begins'} + + {!annotation.settings.no_audio && +
+ + + + +
+ ) +} + +export const AnnotationFormFootnote = ({ annotation, handleSettingsSelect, handleSettingsChange }) => { + return ( +
+ +
+ ) +} diff --git a/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.utility.js b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.utility.js new file mode 100644 index 0000000..7e823cc --- /dev/null +++ b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.utility.js @@ -0,0 +1,172 @@ +import React, { Component } from 'react' + +import { timestamp } from 'app/utils' +import { TextInput, LabelDescription, Select, Checkbox } from 'app/common' +import { CURTAIN_COLOR_SELECT_OPTIONS, CURTAIN_STYLE_SELECT_OPTIONS } from 'app/constants' +import { annotationFadeTimings } from 'app/utils/annotation.utils' +import { makeMediaItems } from 'app/utils/annotation.utils' + +export const AnnotationFormIntro = ({ annotation, media, handleSettingsChange, handleSettingsSelect }) => { + if (!media.lookup) return
+ const image_list_items = makeMediaItems(media, 'file') + return ( +
+ + + + + + {'Timestamp where voiceover starts, after any intro sound effect.'} + + + +
+ ) +} + +export const AnnotationFormCurtain = ({ annotation, handleSettingsChange, handleSettingsSelect }) => { + return ( +
+ + + + + + + +
+ ) +} + +export const AnnotationFormFullscreen = ({ annotation, handleSettingsChange, handleSettingsSelect }) => { + const { + fadeInDuration, fadeOutDuration, duration, + start_ts, end_ts, fade_in_end_ts, fade_out_start_ts, + } = annotationFadeTimings(annotation) + return ( +
+ + + {duration} + {' seconds, ends at '} + {timestamp(end_ts)} + + + + + {fadeInDuration} + {' seconds, ends at '} + {timestamp(fade_in_end_ts)} + + + + + {fadeOutDuration} + {' seconds, starts at '} + {timestamp(fade_out_start_ts)} + +
+ ) +} diff --git a/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.video.js b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.video.js new file mode 100644 index 0000000..dd5f640 --- /dev/null +++ b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.video.js @@ -0,0 +1,160 @@ +import React, { Component } from 'react' + +import { CURTAIN_COLOR_SELECT_OPTIONS, IMAGE_BACKGROUND_SIZE_OPTIONS } from 'app/constants' +import { Select, Checkbox, TextInput, LabelDescription } from 'app/common' +import { AnnotationFormFullscreen } from './annotationForm.utility' +import { makeMediaItems } from 'app/utils/annotation.utils' + +export const AnnotationFormVideo = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => { + if (!media.lookup) return
+ const video_list_items = makeMediaItems(media, ['video']) + return ( +
+ + + + + {'Auto-advances the video to this point when starting'} + + + {(annotation.settings.fullscreen && !annotation.settings.inline) && ( + + )} +
+ ) +} + +export const AnnotationFormVideoSetVolume = ({ annotation, handleSettingsChange }) => { + return ( +
+ + +
+ ) +} \ No newline at end of file diff --git a/animism-align/frontend/app/views/editor/annotation/components/annotationForms/index.js b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/index.js new file mode 100644 index 0000000..8a1be48 --- /dev/null +++ b/animism-align/frontend/app/views/editor/annotation/components/annotationForms/index.js @@ -0,0 +1,46 @@ +import { + AnnotationFormSectionHeading, + AnnotationFormTextPlate, + AnnotationFormFootnote, + AnnotationFormSubtitle, +} from './annotationForm.text' + +import { + AnnotationFormVideo, + AnnotationFormVideoSetVolume, +} from './annotationForm.video' + +import { + AnnotationFormImage, +} from './annotationForm.image' + +import { + AnnotationFormGallery, + AnnotationFormGalleryAdvance, +} from './annotationForm.gallery' + +import { + AnnotationFormCurtain, + AnnotationFormIntro, +} from './annotationForm.utility' + +export const annotationFormLookup = { + section_heading: AnnotationFormSectionHeading, + text_plate: AnnotationFormTextPlate, + footnote: AnnotationFormFootnote, + subtitle: AnnotationFormSubtitle, + + image: AnnotationFormImage, + video: AnnotationFormVideo, + video_set_volume: AnnotationFormVideoSetVolume, + + gallery: AnnotationFormGallery, + carousel: AnnotationFormGallery, + grid: AnnotationFormGallery, + vitrine: AnnotationFormGallery, + + gallery_advance: AnnotationFormGalleryAdvance, + + intro: AnnotationFormIntro, + curtain: AnnotationFormCurtain, +} -- cgit v1.2.3-70-g09d2