summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/annotation/components/annotationForms/annotationForm.gallery.js
blob: 0a8b3fb090775979e1b4ecf80041ed93767f83df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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 <div />
  const image_list_items = makeMediaItems(media, ['gallery'])
  return (
    <div className='options'>
      <Select
        name='media_id'
        className="media_id"
        selected={annotation.settings.media_id}
        options={image_list_items}
        defaultOption='Choose a gallery'
        onChange={handleSettingsSelect}
      />

      <TextInput
        title="Title"
        name="title"
        placeholder="Enter title or leave blank"
        data={annotation.settings}
        onChange={handleSettingsChange}
        autoComplete="off"
      />
      
      <Checkbox
        label="Fullscreen"
        name="fullscreen"
        checked={annotation.settings.fullscreen}
        onChange={handleSettingsSelect}
      />

      <Checkbox
        label="Inline"
        name="inline"
        checked={annotation.settings.inline}
        onChange={handleSettingsSelect}
      />

      <Checkbox
        label="Hide in transcript"
        name="hide_in_transcript"
        checked={annotation.settings.hide_in_transcript}
        onChange={handleSettingsSelect}
      />

      <Select
        title='Color'
        name='color'
        selected={annotation.settings.color}
        options={CURTAIN_COLOR_SELECT_OPTIONS}
        defaultOption='Pick a color'
        onChange={handleSettingsSelect}
      />

      <Select
        title='Arrow Color'
        name='arrow_color'
        selected={annotation.settings.arrow_color}
        options={CURTAIN_COLOR_SELECT_OPTIONS}
        defaultOption='Color of UI arrows'
        onChange={handleSettingsSelect}
      />

      {(annotation.settings.fullscreen && !annotation.settings.inline) && (
        <AnnotationFormFullscreen
          annotation={annotation}
          handleSettingsChange={handleSettingsChange}
          handleSettingsSelect={handleSettingsSelect}
        />
      )}
    </div>
  )
}

export const AnnotationFormGalleryAdvance = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => {
  if (!media.lookup) return <div />
  const image_list_items = makeMediaItems(media, ['gallery'])
  const { gallery_items, thumbnail } = makeGalleryItems(annotation, media)
  return (
    <div className='options'>
      <Select
        name='media_id'
        className="media_id"
        selected={annotation.settings.media_id}
        options={image_list_items}
        defaultOption='Choose a gallery'
        onChange={handleSettingsSelect}
      />

      {gallery_items && (
        <Select
          name='frame_index'
          selected={annotation.settings.frame_index}
          options={gallery_items}
          defaultOption='Choose an image'
          onChange={handleSettingsSelect}
        />
      )}

      {thumbnail && (
        <img src={thumbnail.url} />
      )}

      <Checkbox
        label="Advance half a frame forward to fit two images in view"
        name="half_frame"
        checked={annotation.settings.half_frame}
        onChange={handleSettingsSelect}
      />

      <Checkbox
        label="Hide in transcript"
        name="hide_in_transcript"
        checked={annotation.settings.hide_in_transcript}
        onChange={handleSettingsSelect}
      />

      <Checkbox
        label="Show in checklist"
        name="show_in_checklist"
        checked={annotation.settings.show_in_checklist}
        onChange={handleSettingsSelect}
      />
    </div>
  )
}