@mundogamernetwork/shared-ui 1.1.96 → 1.2.1
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/components/playtest/PlaytestBrief.vue +152 -0
- package/components/playtest/PlaytestPendingConfirmation.vue +84 -0
- package/components/playtest/PlaytestResponseFlow.vue +371 -0
- package/components/playtest/StarRatingInput.vue +105 -0
- package/components/playtest/accessibility/CriterionRow.vue +167 -0
- package/components/playtest/baseline/BaselineSectionStep.vue +106 -0
- package/components/playtest/compliance/ChecklistItemRow.vue +200 -0
- package/components/playtest/concept-poll/EmojiReactionVote.vue +145 -0
- package/components/playtest/concept-poll/FiveSecondTestVote.vue +197 -0
- package/components/playtest/concept-poll/HeadToHeadVote.vue +98 -0
- package/components/playtest/concept-poll/MultiSelectVote.vue +104 -0
- package/components/playtest/concept-poll/RankedChoiceVote.vue +169 -0
- package/components/playtest/concept-poll/SingleSelectVote.vue +98 -0
- package/components/playtest/concept-poll/StarRatingVote.vue +110 -0
- package/components/playtest/concept-poll/VoteReasonField.vue +74 -0
- package/components/playtest/lqa/FileIssueForm.vue +181 -0
- package/components/playtest/lqa/IssueList.vue +99 -0
- package/components/playtest/lqa/LocaleSelector.vue +73 -0
- package/components/playtest/moderated/JoinCallPanel.vue +135 -0
- package/components/playtest/moderated/SessionCard.vue +146 -0
- package/composables/usePlaytestResponse.ts +446 -0
- package/nuxt.config.ts +42 -4
- package/package.json +10 -3
- package/services/playtestTesterService.ts +416 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// poll_type=emoji_reaction — answer shape {option_id, emoji}.
|
|
3
|
+
import { ref, computed } from "vue";
|
|
4
|
+
import VoteReasonField from "./VoteReasonField.vue";
|
|
5
|
+
import type { PlaytestConceptPollOption } from "../../../services/playtestTesterService";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<{
|
|
8
|
+
options: PlaytestConceptPollOption[];
|
|
9
|
+
submitting?: boolean;
|
|
10
|
+
emojiChoices?: string[];
|
|
11
|
+
}>(), {
|
|
12
|
+
emojiChoices: () => ["😍", "😀", "😐", "😕", "😡"],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: "submit", payload: { answer: { option_id: number; emoji: string }; reason: string }): void
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const selected = ref<number | null>(null);
|
|
20
|
+
const emoji = ref<string | null>(null);
|
|
21
|
+
const reason = ref("");
|
|
22
|
+
|
|
23
|
+
const canSubmit = computed(() =>
|
|
24
|
+
selected.value !== null && !!emoji.value && reason.value.trim().length >= 3 && !props.submitting
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
function submit() {
|
|
28
|
+
if (!canSubmit.value || selected.value === null || !emoji.value) return;
|
|
29
|
+
emit("submit", { answer: { option_id: selected.value, emoji: emoji.value }, reason: reason.value.trim() });
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="emoji-vote">
|
|
35
|
+
<div class="emoji-vote__options">
|
|
36
|
+
<label
|
|
37
|
+
v-for="opt in options"
|
|
38
|
+
:key="opt.id"
|
|
39
|
+
class="emoji-vote__option"
|
|
40
|
+
:class="{ 'emoji-vote__option--selected': selected === opt.id }"
|
|
41
|
+
>
|
|
42
|
+
<input type="radio" :value="opt.id" v-model="selected" name="emoji-vote-option">
|
|
43
|
+
<img v-if="opt.media_url" :src="opt.media_url" :alt="opt.label" class="emoji-vote__media">
|
|
44
|
+
<span>{{ opt.label }}</span>
|
|
45
|
+
</label>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div v-if="selected !== null" class="emoji-vote__emojis">
|
|
49
|
+
<span class="emoji-vote__emojis-label">{{ $t("playtest.concept_poll.emoji_label", "Pick your reaction") }}</span>
|
|
50
|
+
<div class="emoji-vote__emojis-row">
|
|
51
|
+
<button
|
|
52
|
+
v-for="e in emojiChoices"
|
|
53
|
+
:key="e"
|
|
54
|
+
type="button"
|
|
55
|
+
class="emoji-vote__emoji-btn"
|
|
56
|
+
:class="{ 'emoji-vote__emoji-btn--selected': emoji === e }"
|
|
57
|
+
@click="emoji = e"
|
|
58
|
+
>
|
|
59
|
+
{{ e }}
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<VoteReasonField v-model="reason" />
|
|
65
|
+
|
|
66
|
+
<button type="button" class="btn primary emoji-vote__submit" :disabled="!canSubmit" @click="submit">
|
|
67
|
+
{{ $t("playtest.concept_poll.submit_vote", "Submit vote") }}
|
|
68
|
+
</button>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<style scoped lang="scss">
|
|
73
|
+
.emoji-vote {
|
|
74
|
+
&__options {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: 8px;
|
|
78
|
+
margin-bottom: 16px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&__option {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 10px;
|
|
85
|
+
padding: 10px 14px;
|
|
86
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
87
|
+
border: 2px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
color: var(--text-primary, #fff);
|
|
90
|
+
|
|
91
|
+
&--selected {
|
|
92
|
+
border-color: var(--primary, #D297FF);
|
|
93
|
+
background: rgba(210, 151, 255, 0.08);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
input {
|
|
97
|
+
accent-color: var(--primary, #D297FF);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__media {
|
|
102
|
+
width: 40px;
|
|
103
|
+
height: 40px;
|
|
104
|
+
object-fit: cover;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&__emojis {
|
|
108
|
+
margin-bottom: 16px;
|
|
109
|
+
|
|
110
|
+
&-label {
|
|
111
|
+
display: block;
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
color: var(--secondary-info-fg, #aaa);
|
|
114
|
+
margin-bottom: 8px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&-row {
|
|
118
|
+
display: flex;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&__emoji-btn {
|
|
124
|
+
font-size: 1.6rem;
|
|
125
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
126
|
+
border: 2px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
127
|
+
padding: 6px 10px;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
transition: transform 0.12s, border-color 0.12s;
|
|
130
|
+
|
|
131
|
+
&:hover {
|
|
132
|
+
transform: scale(1.1);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&--selected {
|
|
136
|
+
border-color: var(--primary, #D297FF);
|
|
137
|
+
background: rgba(210, 151, 255, 0.08);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&__submit {
|
|
142
|
+
margin-top: 16px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// poll_type=five_second_test — answer shape {option_id, recall_text}. No
|
|
3
|
+
// server-side timer exists for this poll type (confirmed against the
|
|
4
|
+
// backend this session) — the countdown/hide/recall sequence below is pure
|
|
5
|
+
// client state, and is inherently bypassable (a tester could inspect the DOM
|
|
6
|
+
// during the reveal window). Accepted as a known limitation per the plan.
|
|
7
|
+
import { ref, computed, onBeforeUnmount } from "vue";
|
|
8
|
+
import VoteReasonField from "./VoteReasonField.vue";
|
|
9
|
+
import type { PlaytestConceptPollOption } from "../../../services/playtestTesterService";
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
12
|
+
options: PlaytestConceptPollOption[];
|
|
13
|
+
submitting?: boolean;
|
|
14
|
+
seconds?: number;
|
|
15
|
+
}>(), {
|
|
16
|
+
seconds: 5,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
(e: "submit", payload: { answer: { option_id: number; recall_text: string }; reason: string }): void
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
type Phase = "intro" | "showing" | "recall";
|
|
24
|
+
|
|
25
|
+
const phase = ref<Phase>("intro");
|
|
26
|
+
const remaining = ref(props.seconds);
|
|
27
|
+
let timer: ReturnType<typeof setInterval> | null = null;
|
|
28
|
+
|
|
29
|
+
const selected = ref<number | null>(null);
|
|
30
|
+
const recallText = ref("");
|
|
31
|
+
const reason = ref("");
|
|
32
|
+
|
|
33
|
+
function start() {
|
|
34
|
+
phase.value = "showing";
|
|
35
|
+
remaining.value = props.seconds;
|
|
36
|
+
timer = setInterval(() => {
|
|
37
|
+
remaining.value -= 1;
|
|
38
|
+
if (remaining.value <= 0) {
|
|
39
|
+
stopTimer();
|
|
40
|
+
phase.value = "recall";
|
|
41
|
+
}
|
|
42
|
+
}, 1000);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function stopTimer() {
|
|
46
|
+
if (timer) {
|
|
47
|
+
clearInterval(timer);
|
|
48
|
+
timer = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onBeforeUnmount(stopTimer);
|
|
53
|
+
|
|
54
|
+
const canSubmit = computed(() =>
|
|
55
|
+
selected.value !== null &&
|
|
56
|
+
recallText.value.trim().length > 0 &&
|
|
57
|
+
reason.value.trim().length >= 3 &&
|
|
58
|
+
!props.submitting
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
function submit() {
|
|
62
|
+
if (!canSubmit.value || selected.value === null) return;
|
|
63
|
+
emit("submit", {
|
|
64
|
+
answer: { option_id: selected.value, recall_text: recallText.value.trim() },
|
|
65
|
+
reason: reason.value.trim(),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<div class="five-sec-vote">
|
|
72
|
+
<div v-if="phase === 'intro'" class="five-sec-vote__intro">
|
|
73
|
+
<p>{{ $t("playtest.concept_poll.five_second_intro", `You'll see the image(s) for ${seconds} seconds, then answer from memory.`) }}</p>
|
|
74
|
+
<button type="button" class="btn primary" @click="start">
|
|
75
|
+
{{ $t("playtest.concept_poll.five_second_start", "Start") }}
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div v-else-if="phase === 'showing'" class="five-sec-vote__showing">
|
|
80
|
+
<div class="five-sec-vote__countdown">{{ remaining }}</div>
|
|
81
|
+
<div class="five-sec-vote__images">
|
|
82
|
+
<img v-for="opt in options" :key="opt.id" :src="opt.media_url ?? ''" :alt="opt.label" class="five-sec-vote__media">
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div v-else class="five-sec-vote__recall">
|
|
87
|
+
<div class="five-sec-vote__options">
|
|
88
|
+
<label
|
|
89
|
+
v-for="opt in options"
|
|
90
|
+
:key="opt.id"
|
|
91
|
+
class="five-sec-vote__option"
|
|
92
|
+
:class="{ 'five-sec-vote__option--selected': selected === opt.id }"
|
|
93
|
+
>
|
|
94
|
+
<input type="radio" :value="opt.id" v-model="selected" name="five-sec-option">
|
|
95
|
+
<span>{{ opt.label }}</span>
|
|
96
|
+
</label>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<label for="recall-text" class="five-sec-vote__recall-label">
|
|
100
|
+
{{ $t("playtest.concept_poll.recall_label", "What do you remember? (required)") }}
|
|
101
|
+
</label>
|
|
102
|
+
<textarea id="recall-text" v-model="recallText" class="five-sec-vote__textarea" rows="3" required />
|
|
103
|
+
|
|
104
|
+
<VoteReasonField v-model="reason" />
|
|
105
|
+
|
|
106
|
+
<button type="button" class="btn primary five-sec-vote__submit" :disabled="!canSubmit" @click="submit">
|
|
107
|
+
{{ $t("playtest.concept_poll.submit_vote", "Submit vote") }}
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<style scoped lang="scss">
|
|
114
|
+
.five-sec-vote {
|
|
115
|
+
&__intro {
|
|
116
|
+
text-align: center;
|
|
117
|
+
padding: 24px 0;
|
|
118
|
+
|
|
119
|
+
p {
|
|
120
|
+
color: var(--secondary-info-fg, #aaa);
|
|
121
|
+
margin-bottom: 16px;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&__showing {
|
|
126
|
+
text-align: center;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__countdown {
|
|
130
|
+
font-size: 2.5rem;
|
|
131
|
+
font-weight: 800;
|
|
132
|
+
color: var(--primary, #D297FF);
|
|
133
|
+
margin-bottom: 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&__images {
|
|
137
|
+
display: flex;
|
|
138
|
+
gap: 12px;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
flex-wrap: wrap;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&__media {
|
|
144
|
+
max-width: 100%;
|
|
145
|
+
max-height: 320px;
|
|
146
|
+
object-fit: contain;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__options {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
margin-bottom: 16px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&__option {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
gap: 10px;
|
|
160
|
+
padding: 10px 14px;
|
|
161
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
162
|
+
border: 2px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
color: var(--text-primary, #fff);
|
|
165
|
+
|
|
166
|
+
&--selected {
|
|
167
|
+
border-color: var(--primary, #D297FF);
|
|
168
|
+
background: rgba(210, 151, 255, 0.08);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
input {
|
|
172
|
+
accent-color: var(--primary, #D297FF);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&__recall-label {
|
|
177
|
+
display: block;
|
|
178
|
+
font-size: 12px;
|
|
179
|
+
color: var(--secondary-info-fg, #aaa);
|
|
180
|
+
margin-bottom: 6px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__textarea {
|
|
184
|
+
width: 100%;
|
|
185
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
186
|
+
border: 1px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
187
|
+
color: var(--text-primary, #fff);
|
|
188
|
+
padding: 10px;
|
|
189
|
+
font-size: 13px;
|
|
190
|
+
resize: vertical;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&__submit {
|
|
194
|
+
margin-top: 16px;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// poll_type=head_to_head — answer shape {option_id}. Typically exactly 2
|
|
3
|
+
// options (A/B), rendered side by side; the poll model doesn't hard-cap
|
|
4
|
+
// option count server-side, so this renders whatever options come back.
|
|
5
|
+
import { ref, computed } from "vue";
|
|
6
|
+
import VoteReasonField from "./VoteReasonField.vue";
|
|
7
|
+
import type { PlaytestConceptPollOption } from "../../../services/playtestTesterService";
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
options: PlaytestConceptPollOption[];
|
|
11
|
+
submitting?: boolean;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const emit = defineEmits<{
|
|
15
|
+
(e: "submit", payload: { answer: { option_id: number }; reason: string }): void
|
|
16
|
+
}>();
|
|
17
|
+
|
|
18
|
+
const selected = ref<number | null>(null);
|
|
19
|
+
const reason = ref("");
|
|
20
|
+
|
|
21
|
+
const canSubmit = computed(() => selected.value !== null && reason.value.trim().length >= 3 && !props.submitting);
|
|
22
|
+
|
|
23
|
+
function submit() {
|
|
24
|
+
if (!canSubmit.value || selected.value === null) return;
|
|
25
|
+
emit("submit", { answer: { option_id: selected.value }, reason: reason.value.trim() });
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div class="h2h-vote">
|
|
31
|
+
<div class="h2h-vote__options">
|
|
32
|
+
<button
|
|
33
|
+
v-for="opt in options"
|
|
34
|
+
:key="opt.id"
|
|
35
|
+
type="button"
|
|
36
|
+
class="h2h-vote__option"
|
|
37
|
+
:class="{ 'h2h-vote__option--selected': selected === opt.id }"
|
|
38
|
+
@click="selected = opt.id"
|
|
39
|
+
>
|
|
40
|
+
<img v-if="opt.media_url" :src="opt.media_url" :alt="opt.label" class="h2h-vote__media">
|
|
41
|
+
<span class="h2h-vote__label">{{ opt.label }}</span>
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<VoteReasonField v-model="reason" />
|
|
46
|
+
|
|
47
|
+
<button type="button" class="btn primary h2h-vote__submit" :disabled="!canSubmit" @click="submit">
|
|
48
|
+
{{ $t("playtest.concept_poll.submit_vote", "Submit vote") }}
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<style scoped lang="scss">
|
|
54
|
+
.h2h-vote {
|
|
55
|
+
&__options {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
58
|
+
gap: 12px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__option {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
padding: 14px;
|
|
67
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
68
|
+
border: 2px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
color: var(--text-primary, #fff);
|
|
71
|
+
transition: border-color 0.15s;
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
border-color: var(--primary, #D297FF);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&--selected {
|
|
78
|
+
border-color: var(--primary, #D297FF);
|
|
79
|
+
background: rgba(210, 151, 255, 0.08);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&__media {
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-height: 140px;
|
|
86
|
+
object-fit: cover;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&__label {
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__submit {
|
|
95
|
+
margin-top: 16px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// poll_type=multi_select — answer shape {option_ids: number[]}, must be a
|
|
3
|
+
// non-empty array (VoteConceptPollRequest.php).
|
|
4
|
+
import { ref, computed } from "vue";
|
|
5
|
+
import VoteReasonField from "./VoteReasonField.vue";
|
|
6
|
+
import type { PlaytestConceptPollOption } from "../../../services/playtestTesterService";
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
options: PlaytestConceptPollOption[];
|
|
10
|
+
submitting?: boolean;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits<{
|
|
14
|
+
(e: "submit", payload: { answer: { option_ids: number[] }; reason: string }): void
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const selected = ref<number[]>([]);
|
|
18
|
+
const reason = ref("");
|
|
19
|
+
|
|
20
|
+
const canSubmit = computed(() => selected.value.length > 0 && reason.value.trim().length >= 3 && !props.submitting);
|
|
21
|
+
|
|
22
|
+
function toggle(id: number) {
|
|
23
|
+
const idx = selected.value.indexOf(id);
|
|
24
|
+
if (idx === -1) selected.value.push(id);
|
|
25
|
+
else selected.value.splice(idx, 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function submit() {
|
|
29
|
+
if (!canSubmit.value) return;
|
|
30
|
+
emit("submit", { answer: { option_ids: [...selected.value] }, reason: reason.value.trim() });
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="multi-select-vote">
|
|
36
|
+
<div class="multi-select-vote__options">
|
|
37
|
+
<label
|
|
38
|
+
v-for="opt in options"
|
|
39
|
+
:key="opt.id"
|
|
40
|
+
class="multi-select-vote__option"
|
|
41
|
+
:class="{ 'multi-select-vote__option--selected': selected.includes(opt.id) }"
|
|
42
|
+
>
|
|
43
|
+
<input type="checkbox" :checked="selected.includes(opt.id)" @change="toggle(opt.id)">
|
|
44
|
+
<img v-if="opt.media_url" :src="opt.media_url" :alt="opt.label" class="multi-select-vote__media">
|
|
45
|
+
<span class="multi-select-vote__label">{{ opt.label }}</span>
|
|
46
|
+
</label>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<VoteReasonField v-model="reason" />
|
|
50
|
+
|
|
51
|
+
<button type="button" class="btn primary multi-select-vote__submit" :disabled="!canSubmit" @click="submit">
|
|
52
|
+
{{ $t("playtest.concept_poll.submit_vote", "Submit vote") }}
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style scoped lang="scss">
|
|
58
|
+
.multi-select-vote {
|
|
59
|
+
&__options {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 8px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__option {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 10px;
|
|
69
|
+
padding: 10px 14px;
|
|
70
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
71
|
+
border: 2px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
color: var(--text-primary, #fff);
|
|
74
|
+
transition: border-color 0.15s;
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
border-color: var(--primary, #D297FF);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&--selected {
|
|
81
|
+
border-color: var(--primary, #D297FF);
|
|
82
|
+
background: rgba(210, 151, 255, 0.08);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
input {
|
|
86
|
+
accent-color: var(--primary, #D297FF);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&__media {
|
|
91
|
+
width: 48px;
|
|
92
|
+
height: 48px;
|
|
93
|
+
object-fit: cover;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&__label {
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&__submit {
|
|
101
|
+
margin-top: 16px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// poll_type=ranked_choice — answer shape {ranking: number[]} (>=2 unique
|
|
3
|
+
// option_ids, in order of preference). No sortable/drag-and-drop library is
|
|
4
|
+
// a dependency anywhere in this repo (checked package.json + node_modules
|
|
5
|
+
// this session) — per the "no generic backend"-style instruction against
|
|
6
|
+
// adding a new dependency for one component, this implements a simple
|
|
7
|
+
// up/down-arrow reorder list instead of pulling in vuedraggable/sortablejs.
|
|
8
|
+
import { ref, computed } from "vue";
|
|
9
|
+
import VoteReasonField from "./VoteReasonField.vue";
|
|
10
|
+
import type { PlaytestConceptPollOption } from "../../../services/playtestTesterService";
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
options: PlaytestConceptPollOption[];
|
|
14
|
+
submitting?: boolean;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits<{
|
|
18
|
+
(e: "submit", payload: { answer: { ranking: number[] }; reason: string }): void
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
// Initialize ranking in the order options were given (position asc, from
|
|
22
|
+
// the poll's own ordering) — tester reorders from there.
|
|
23
|
+
const ranking = ref<PlaytestConceptPollOption[]>([...props.options]);
|
|
24
|
+
const reason = ref("");
|
|
25
|
+
|
|
26
|
+
const canSubmit = computed(() => ranking.value.length >= 2 && reason.value.trim().length >= 3 && !props.submitting);
|
|
27
|
+
|
|
28
|
+
function moveUp(index: number) {
|
|
29
|
+
if (index === 0) return;
|
|
30
|
+
const arr = ranking.value;
|
|
31
|
+
[arr[index - 1], arr[index]] = [arr[index], arr[index - 1]];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function moveDown(index: number) {
|
|
35
|
+
if (index === ranking.value.length - 1) return;
|
|
36
|
+
const arr = ranking.value;
|
|
37
|
+
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function submit() {
|
|
41
|
+
if (!canSubmit.value) return;
|
|
42
|
+
emit("submit", {
|
|
43
|
+
answer: { ranking: ranking.value.map((o) => o.id) },
|
|
44
|
+
reason: reason.value.trim(),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<div class="ranked-choice-vote">
|
|
51
|
+
<p class="ranked-choice-vote__hint">
|
|
52
|
+
{{ $t("playtest.concept_poll.ranked_hint", "Order these from your most to least preferred (use the arrows).") }}
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<ol class="ranked-choice-vote__list">
|
|
56
|
+
<li v-for="(opt, index) in ranking" :key="opt.id" class="ranked-choice-vote__item">
|
|
57
|
+
<span class="ranked-choice-vote__position">{{ index + 1 }}</span>
|
|
58
|
+
<img v-if="opt.media_url" :src="opt.media_url" :alt="opt.label" class="ranked-choice-vote__media">
|
|
59
|
+
<span class="ranked-choice-vote__label">{{ opt.label }}</span>
|
|
60
|
+
<span class="ranked-choice-vote__controls">
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
class="ranked-choice-vote__arrow"
|
|
64
|
+
:disabled="index === 0"
|
|
65
|
+
:aria-label="$t('playtest.concept_poll.move_up', 'Move up')"
|
|
66
|
+
@click="moveUp(index)"
|
|
67
|
+
>
|
|
68
|
+
<i class="fa-solid fa-arrow-up" />
|
|
69
|
+
</button>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
class="ranked-choice-vote__arrow"
|
|
73
|
+
:disabled="index === ranking.length - 1"
|
|
74
|
+
:aria-label="$t('playtest.concept_poll.move_down', 'Move down')"
|
|
75
|
+
@click="moveDown(index)"
|
|
76
|
+
>
|
|
77
|
+
<i class="fa-solid fa-arrow-down" />
|
|
78
|
+
</button>
|
|
79
|
+
</span>
|
|
80
|
+
</li>
|
|
81
|
+
</ol>
|
|
82
|
+
|
|
83
|
+
<VoteReasonField v-model="reason" />
|
|
84
|
+
|
|
85
|
+
<button type="button" class="btn primary ranked-choice-vote__submit" :disabled="!canSubmit" @click="submit">
|
|
86
|
+
{{ $t("playtest.concept_poll.submit_vote", "Submit vote") }}
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style scoped lang="scss">
|
|
92
|
+
.ranked-choice-vote {
|
|
93
|
+
&__hint {
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
color: var(--secondary-info-fg, #aaa);
|
|
96
|
+
margin: 0 0 10px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__list {
|
|
100
|
+
list-style: none;
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: 6px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__item {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 10px;
|
|
112
|
+
padding: 8px 12px;
|
|
113
|
+
background: var(--bg-app-badge, #1a1a1a);
|
|
114
|
+
border: 1px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__position {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
width: 22px;
|
|
122
|
+
height: 22px;
|
|
123
|
+
font-size: 12px;
|
|
124
|
+
font-weight: 700;
|
|
125
|
+
background: var(--primary, #D297FF);
|
|
126
|
+
color: var(--key-accent-ink, #13161C);
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&__media {
|
|
131
|
+
width: 36px;
|
|
132
|
+
height: 36px;
|
|
133
|
+
object-fit: cover;
|
|
134
|
+
flex-shrink: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&__label {
|
|
138
|
+
flex: 1;
|
|
139
|
+
font-size: 13px;
|
|
140
|
+
color: var(--text-primary, #fff);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&__controls {
|
|
144
|
+
display: flex;
|
|
145
|
+
gap: 4px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__arrow {
|
|
149
|
+
background: none;
|
|
150
|
+
border: 1px solid var(--button-secondary-default-bg, #2a2a2a);
|
|
151
|
+
color: var(--text-primary, #fff);
|
|
152
|
+
padding: 4px 8px;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
|
|
155
|
+
&:hover:not(:disabled) {
|
|
156
|
+
border-color: var(--primary, #D297FF);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&:disabled {
|
|
160
|
+
opacity: 0.35;
|
|
161
|
+
cursor: not-allowed;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&__submit {
|
|
166
|
+
margin-top: 16px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
</style>
|