@windward/games 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/babel.config.js CHANGED
@@ -1 +1 @@
1
- module.exports = { presets: ["@babel/preset-env"] };
1
+ module.exports = { presets: ['@babel/preset-env'] }
@@ -501,6 +501,7 @@ export default {
501
501
  .crossword-board-container {
502
502
  position: relative;
503
503
  padding-top: 5px;
504
+ margin-top: 1rem;
504
505
  overflow: auto;
505
506
  }
506
507
 
@@ -595,8 +596,9 @@ export default {
595
596
 
596
597
  .crossword-clues {
597
598
  background: var(--v-content-background-base);
598
- position: sticky;
599
- bottom: 100px;
599
+ max-height: 30vh;
600
+ overflow-y: scroll;
601
+ bottom: 50px;
600
602
  border-radius: 5px;
601
603
  }
602
604
  .crossword-board__item--number {
@@ -613,63 +615,42 @@ export default {
613
615
  width: 500px;
614
616
  height: 500px;
615
617
  }
616
- .crossword-board-container {
617
- box-sizing: content-box !important;
618
- }
619
618
  }
620
619
  @media (max-width: 1480px) {
621
620
  .crossword-col-4 {
622
621
  width: 400px;
623
622
  height: 400px;
624
623
  }
625
- .crossword-board-container {
626
- box-sizing: content-box !important;
627
- }
628
624
  }
629
625
  @media (max-width: 1360px) {
630
626
  .crossword-col-4 {
631
627
  width: 350px;
632
628
  height: 350px;
633
629
  }
634
- .crossword-board-container {
635
- box-sizing: content-box !important;
636
- }
637
630
  }
638
631
  @media (max-width: 1300px) {
639
632
  .crossword-col-4 {
640
633
  width: 300px;
641
634
  height: 300px;
642
635
  }
643
- .crossword-board-container {
644
- box-sizing: content-box !important;
645
- }
646
636
  }
647
637
  @media (max-width: 1263px) {
648
638
  .crossword-col-4 {
649
639
  width: 550px;
650
640
  height: 550px;
651
641
  }
652
- .crossword-board-container {
653
- box-sizing: content-box !important;
654
- }
655
642
  }
656
643
  @media (max-width: 823px) {
657
644
  .crossword-col-4 {
658
645
  width: 400px;
659
646
  height: 400px;
660
647
  }
661
- .crossword-board-container {
662
- box-sizing: content-box !important;
663
- }
664
648
  }
665
649
  @media (max-width: 631px) {
666
650
  .crossword-col-4 {
667
651
  width: 300px;
668
652
  height: 300px;
669
653
  }
670
- .crossword-board-container {
671
- box-sizing: content-box !important;
672
- }
673
654
  }
674
655
  @media (max-width: 565px) {
675
656
  .crossword-col-4 {
@@ -677,7 +658,6 @@ export default {
677
658
  height: 300px;
678
659
  }
679
660
  .crossword-board-container {
680
- box-sizing: content-box !important;
681
661
  padding-top: 12px;
682
662
  padding-left: 12px;
683
663
  }
@@ -39,7 +39,7 @@
39
39
  }}</v-col>
40
40
  <v-col class="d-flex justify-end pl-4">
41
41
  <v-btn
42
- v-if="status === 'successOutline'"
42
+ v-if="status === 'container-success-outline'"
43
43
  class="mr-5"
44
44
  color="success"
45
45
  elevation="0"
@@ -47,7 +47,7 @@
47
47
  >{{ $t('shared.forms.continue') }}
48
48
  </v-btn>
49
49
  <v-container
50
- v-if="status === 'errorOutline'"
50
+ v-if="status === 'container-error-outline'"
51
51
  class="d-flex justify-end"
52
52
  @click="continueGame"
53
53
  ><v-icon class="icon--error" color="error"
@@ -83,15 +83,12 @@
83
83
  </draggable>
84
84
  <br />
85
85
 
86
- <v-row
87
- class="d-flex flex-wrap flex-row justify-center flex-fill"
88
- >
89
- <v-row align="center" class="col-md-10">
86
+ <v-row class="d-flex justify-center mb-2">
87
+ <v-row class="justify-center">
90
88
  <v-card
91
89
  v-for="(bucket, bindex) in items"
92
90
  :key="'b-v-card-' + bindex"
93
- class="pa-2 flex-fill bucket"
94
- min-height="5em"
91
+ class="card-bucket"
95
92
  outlined
96
93
  tile
97
94
  :color="
@@ -103,7 +100,7 @@
103
100
  "
104
101
  >
105
102
  <v-card-text
106
- class="d-flex justify-center text-center"
103
+ class="d-flex justify-center text-center pl-0 pr-0"
107
104
  >
108
105
  <draggable
109
106
  v-model="items[bindex]"
@@ -113,14 +110,30 @@
113
110
  @change="change($event, bindex)"
114
111
  :move="checkMove"
115
112
  tabindex="0"
113
+ class="draggable-bucket"
116
114
  >
117
115
  <TextViewer
118
116
  v-model="
119
117
  block.metadata.config
120
118
  .bucket_titles[bindex].title
121
119
  "
122
- class="d-flex align-center"
120
+ class="d-flex align-center justify-center container-buckets"
123
121
  ></TextViewer>
122
+ <v-container
123
+ v-for="(
124
+ nested_answer, nested_index
125
+ ) in block.metadata.config
126
+ .bucket_titles[bindex]
127
+ .nested_answers"
128
+ :key="nested_index"
129
+ class="d-flex justify-center align-center pa-0"
130
+ >
131
+ <TextViewer
132
+ class="container-nested-answers mb-1"
133
+ v-model="nested_answer.display"
134
+ remove-root-element
135
+ ></TextViewer>
136
+ </v-container>
124
137
  </draggable>
125
138
  </v-card-text>
126
139
  </v-card>
@@ -166,12 +179,15 @@
166
179
  <v-row
167
180
  class="d-flex flex-wrap flex-row justify-center flex-fill"
168
181
  >
169
- <v-row align="center" class="col-md-10">
182
+ <v-row
183
+ align="center"
184
+ class="col-md-10 justify-space-around"
185
+ >
170
186
  <v-card
171
187
  v-for="(bucket, bindex) in block.metadata.config
172
188
  .bucket_titles"
173
189
  :key="'b-v-card-' + bindex"
174
- class="pa-2 flex-fill bucket"
190
+ class="pa-2 card-bucket"
175
191
  min-height="5em"
176
192
  outlined
177
193
  tile
@@ -198,7 +214,7 @@
198
214
  ].title
199
215
  "
200
216
  class="d-flex align-center"
201
- ></TextViewer> </draggable
217
+ ></TextViewer></draggable
202
218
  ></v-card-text>
203
219
  </v-card>
204
220
  </v-row>
@@ -295,6 +311,17 @@ export default {
295
311
  if (_.isEmpty(this.block.metadata.config.bucket_titles)) {
296
312
  this.block.metadata.config.bucket_titles = []
297
313
  }
314
+ if (
315
+ this.block.metadata.config.bucket_titles &&
316
+ this.block.metadata.config.bucket_titles[0] &&
317
+ _.isEmpty(
318
+ this.block.metadata.config.bucket_titles[0].nested_answers
319
+ )
320
+ ) {
321
+ this.block.metadata.config.bucket_titles.forEach((bucket) => {
322
+ bucket.nested_answers = []
323
+ })
324
+ }
298
325
  if (_.isEmpty(this.block.metadata.config.bucket_answers)) {
299
326
  this.block.metadata.config.bucket_answers = []
300
327
  }
@@ -331,6 +358,7 @@ export default {
331
358
  },
332
359
  completedPercent() {
333
360
  if (
361
+ this.block.metadata.config.bucket_answers &&
334
362
  this.block.metadata.config.bucket_answers.length > 0 &&
335
363
  this.items.length > 0
336
364
  ) {
@@ -347,10 +375,16 @@ export default {
347
375
  },
348
376
  },
349
377
  mounted() {
350
- if (this.block.metadata.config.bucket_answers.length > 0) {
378
+ if (
379
+ this.block.metadata.config.bucket_answers &&
380
+ this.block.metadata.config.bucket_answers.length > 0
381
+ ) {
351
382
  this.setMainAnswer()
352
383
  }
353
- if (this.block.metadata.config.bucket_titles.length > 0) {
384
+ if (
385
+ this.block.metadata.config.bucket_titles &&
386
+ this.block.metadata.config.bucket_titles.length > 0
387
+ ) {
354
388
  this.setUpGame()
355
389
  }
356
390
  this.status = 'default'
@@ -470,8 +504,14 @@ export default {
470
504
  this.feedback = this.$t(
471
505
  'windward.games.components.content.blocks.matching_game.congratulations_feedback'
472
506
  )
507
+ this.block.metadata.config.bucket_titles[
508
+ bucket_index
509
+ ].nested_answers.push(evt.added.element)
473
510
  } else {
474
- this.status = 'successOutline'
511
+ this.status = 'container-success-outline'
512
+ this.block.metadata.config.bucket_titles[
513
+ bucket_index
514
+ ].nested_answers.push(evt.added.element)
475
515
  // set correct feedback
476
516
  if (evt.added.element.feedback) {
477
517
  this.feedback = evt.added.element.feedback
@@ -496,7 +536,7 @@ export default {
496
536
  : this.$t(
497
537
  'windward.games.components.settings.bucket_game.form.feedback.incorrect_default'
498
538
  )
499
- this.status = 'errorOutline'
539
+ this.status = 'container-error-outline'
500
540
  }
501
541
  },
502
542
  continueGame() {
@@ -509,6 +549,9 @@ export default {
509
549
  for (const index in this.block.metadata.config.bucket_answers) {
510
550
  this.items[index] = []
511
551
  }
552
+ this.block.metadata.config.bucket_titles.forEach((element) => {
553
+ element.nested_answers = []
554
+ })
512
555
  this.status = 'default'
513
556
  this.feedback = ''
514
557
  this.allow_drag = true
@@ -518,26 +561,61 @@ export default {
518
561
  }
519
562
  </script>
520
563
  <style scoped>
521
- .successOutline {
564
+ .container-success-outline {
522
565
  border: 4px solid var(--v-success-base);
523
566
  color: var(--v-success-base);
524
567
  }
525
- .errorOutline {
568
+ .container-error-outline {
526
569
  border: 4px solid var(--v-error-base);
527
570
  color: var(--v-error-base);
528
571
  }
529
572
  .span-bold {
530
573
  font-weight: bold;
531
574
  }
532
- .bucket {
575
+ .card-bucket {
533
576
  line-height: 1.1em;
534
577
  padding: 0.5em;
535
578
  box-shadow: 0px 2px 3px #0000004a;
536
579
  transition: 0.5s box-shadow;
537
580
  margin: 1%;
581
+ max-width: 12vw;
582
+ min-width: 12vw;
583
+ color: black !important;
538
584
  }
539
585
  .card_text {
540
586
  font-size: large;
541
587
  color: black;
542
588
  }
589
+ .container-nested-answers {
590
+ max-width: 10vw;
591
+ min-width: 10vw;
592
+ padding-left: 4px;
593
+ padding-right: 4px;
594
+ overflow: hidden;
595
+ white-space: nowrap;
596
+ text-overflow: ellipsis;
597
+ background-color: white;
598
+ color: black;
599
+ box-shadow: 0px 2px 3px #0000004a;
600
+ border-radius: 2px;
601
+ }
602
+ .container-buckets {
603
+ color: black;
604
+ }
605
+ .draggable-bucket {
606
+ width: 100%;
607
+ }
608
+ @media (max-width: 600px) {
609
+ .card-bucket {
610
+ width: 40vh;
611
+ max-width: 40vh;
612
+ }
613
+ .container-nested-answers {
614
+ display: block !important;
615
+ width: 100%;
616
+ max-width: 100%;
617
+ min-width: 100%;
618
+ overflow-x: hidden !important;
619
+ }
620
+ }
543
621
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-container style="height: 100%" class="div-container">
3
- <v-card outlined @click="toggleCard" v-show="value" :class="cardClass">
3
+ <v-card outlined @click="toggleCard" v-show="side" :class="cardClass">
4
4
  <v-card-text>
5
5
  <CardFace
6
6
  side="front"
@@ -9,7 +9,7 @@
9
9
  ></CardFace>
10
10
  </v-card-text>
11
11
  </v-card>
12
- <v-card outlined @click="toggleCard" v-show="!value" :class="cardClass">
12
+ <v-card outlined @click="toggleCard" v-show="!side" :class="cardClass">
13
13
  <v-card-title class="card-title">
14
14
  <v-row align="center" justify="center">{{
15
15
  backFace.header
@@ -34,10 +34,10 @@ export default {
34
34
  return {
35
35
  settings: {},
36
36
  flip: false,
37
+ side: true,
37
38
  }
38
39
  },
39
40
  props: {
40
- value: { type: Boolean, required: false, default: false },
41
41
  options: { type: Object, default: {} },
42
42
  slide: { type: Number, required: true, default: 0 },
43
43
  assets: { type: Array, required: true },
@@ -93,12 +93,16 @@ export default {
93
93
  }
94
94
  },
95
95
  },
96
+ mounted() {
97
+ this.side = true
98
+ },
96
99
  methods: {
97
100
  toggleCard() {
98
101
  //only flip card when user click
99
102
  this.flip = true
100
103
  //this.cardClass = 'animated flipInY flashcard flashcard--size-md'
101
- this.$emit('input', !this.value)
104
+ this.$emit('input', !this.side)
105
+ this.side = !this.side
102
106
  },
103
107
  },
104
108
  }
@@ -8,10 +8,7 @@
8
8
  {{ block.metadata.config.instructions }}
9
9
  </p>
10
10
  <br />
11
- <v-carousel
12
- :value="block.metadata.config.currentSlide"
13
- :hide-delimiters="hideDeliminators"
14
- >
11
+ <v-carousel v-model="currentSlide" hide-delimiters>
15
12
  <template #prev="{ on, attrs }">
16
13
  <v-btn
17
14
  variant="elevated"
@@ -44,13 +41,20 @@
44
41
  >
45
42
  <v-sheet height="90%" tile>
46
43
  <Flashcard
47
- v-model="block.metadata.config.cards[index].side"
48
44
  :options="card"
49
- :slide="block.metadata.config.currentSlide"
50
- :key="seed + '-' + block.metadata.config.currentSlide"
45
+ :slide="currentSlide"
46
+ :key="seed + '-' + currentSlide"
51
47
  :assets="block.assets"
52
48
  />
53
49
  </v-sheet>
50
+ <div class="d-flex justify-end">
51
+ {{
52
+ $t('windward.games.shared.content_blocks.out_of', [
53
+ index + 1,
54
+ block.metadata.config.cards.length,
55
+ ])
56
+ }}
57
+ </div>
54
58
  </v-carousel-item>
55
59
  </v-carousel>
56
60
  </div>
@@ -73,6 +77,7 @@ export default {
73
77
  toggle: true,
74
78
  seed: Crypto.id(),
75
79
  cards: [],
80
+ currentSlide: 0,
76
81
  }
77
82
  },
78
83
  beforeMount() {
@@ -84,7 +89,6 @@ export default {
84
89
  }
85
90
  if (_.isEmpty(this.block.metadata.config)) {
86
91
  this.block.metadata.config = {}
87
- this.block.metadata.config.currentSlide = 0
88
92
  this.block.metadata.config.title = this.$t(
89
93
  'windward.games.components.content.blocks.flashcard.title'
90
94
  )
@@ -101,39 +105,10 @@ export default {
101
105
  computed: {
102
106
  slide() {
103
107
  if (this.block.metadata.config.cards.length > 0) {
104
- return this.block.metadata.config.currentSlide + 1
108
+ return this.currentSlide + 1
105
109
  }
106
110
  return 0
107
111
  },
108
- hideDeliminators() {
109
- const condition1 =
110
- window.innerWidth <= 1483 ||
111
- this.block.metadata.config.cards.length >= 13
112
- const condition2 =
113
- this.block.metadata.config.cards.length >= 12 &&
114
- window.innerWidth <= 1692
115
- const condition3 =
116
- this.block.metadata.config.cards.length >= 11 &&
117
- window.innerWidth <= 1634
118
- const condition4 =
119
- this.block.metadata.config.cards.length >= 10 &&
120
- window.innerWidth <= 1571
121
- const condition5 =
122
- this.block.metadata.config.cards.length >= 9 &&
123
- window.innerWidth <= 1518
124
-
125
- if (
126
- condition1 ||
127
- condition2 ||
128
- condition3 ||
129
- condition4 ||
130
- condition5
131
- ) {
132
- return true
133
- } else {
134
- return false
135
- }
136
- },
137
112
  },
138
113
  methods: {
139
114
  onActionPanelEdit() {
@@ -97,7 +97,7 @@
97
97
  group="people"
98
98
  tabindex="0"
99
99
  >
100
- <div :id="mainPrompt.file.id">
100
+ <div :id="mainPrompt.file.file_asset_id">
101
101
  <v-img
102
102
  :aria-describedby="
103
103
  getFileAriaDescribedBy(
@@ -196,7 +196,7 @@
196
196
  :id="
197
197
  block.metadata.config.prompts[
198
198
  startingIndex
199
- ][startingIndex].file.id
199
+ ][startingIndex].file.file_asset_id
200
200
  "
201
201
  >
202
202
  <v-img
@@ -498,7 +498,7 @@ export default {
498
498
  (outerElement) => {
499
499
  const mainElement = outerElement.find((element) => {
500
500
  return (
501
- element.file?.id ==
501
+ element.file?.file_asset_id ==
502
502
  evt.to.firstElementChild.id
503
503
  )
504
504
  })