From af17cb4e5de2d236305c208de9c4bc16efdc04b8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 9 Sep 2020 18:55:59 +0200 Subject: keep track of carousel advance instructions --- .../annotationForms/annotationForm.gallery.js | 79 +++++++++++++++++++++- .../annotations/annotationForms/index.js | 3 + 2 files changed, 80 insertions(+), 2 deletions(-) (limited to 'animism-align/frontend/app/views/align/components/annotations/annotationForms') diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js index 5fb8958..c43d8d5 100644 --- a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js +++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js @@ -1,7 +1,7 @@ import React, { Component } from 'react' import { CURTAIN_COLOR_SELECT_OPTIONS } from 'app/constants' -import { TextInput, Select, Checkbox } from 'app/common' +import { TextInput, Select, Checkbox, LabelDescription } from 'app/common' import { AnnotationFormFullscreen } from './annotationForm.utility' export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => { @@ -21,7 +21,7 @@ export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect, className="media_id" selected={annotation.settings.media_id} options={image_list_items} - defaultOption='Choose an image' + defaultOption='Choose a gallery' onChange={handleSettingsSelect} /> @@ -74,3 +74,78 @@ export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect, ) } + +export const AnnotationFormGalleryAdvance = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => { + if (!media.lookup) return
+ const { lookup, order } = media + const image_list_items = order.filter(id => lookup[id].type === 'gallery').map(id => { + const image = lookup[id] + return { + name: image.id, + label: image.author + ' - ' + image.title + } + }) + let item, gallery_items, frame_id, thumbnail + if (annotation.settings.media_id && lookup[annotation.settings.media_id]) { + item = lookup[annotation.settings.media_id] + gallery_items = item.settings.image_order.map((id, index) => { + const caption = item.settings.caption_lookup && item.settings.caption_lookup[id] + console.log(caption) + return { + name: index, + label: (index + 1) + ") " + (caption ? (caption.title || "") : "") + } + }) + if (annotation.settings.frame_index) { + frame_id = item.settings.image_order[annotation.settings.frame_index] + thumbnail = item.settings.thumbnail_lookup[frame_id] + } + } + return ( +
+ + )} + + {thumbnail && ( + + )} + + + + + + +
+ ) +} 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 a4ad015..5cbe773 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 @@ -12,6 +12,7 @@ import { import { AnnotationFormGallery, + AnnotationFormGalleryAdvance, } from './annotationForm.gallery' import { @@ -30,6 +31,8 @@ export const annotationFormLookup = { grid: AnnotationFormGallery, vitrine: AnnotationFormGallery, + gallery_advance: AnnotationFormGalleryAdvance, + intro: AnnotationFormIntro, curtain: AnnotationFormCurtain, } -- cgit v1.2.3-70-g09d2