diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteHome.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteHome.vue index bc833bf..5550836 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteHome.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteHome.vue @@ -12,6 +12,7 @@ import SkinSiteMapView from './SkinSiteMapView.vue' import SkinSiteNavCards from './SkinSiteNavCards.vue' import SkinSiteProfileModal from './SkinSiteProfileModal.vue' import SkinSiteProfileView from './SkinSiteProfileView.vue' +import SkinSiteReviewView from './SkinSiteReviewView.vue' const { formatMessage } = useVIntl() const { addNotification } = injectNotificationManager() @@ -47,6 +48,7 @@ async function copyAddress() { + diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue index c2e7982..77fe917 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteMapView.vue @@ -3,7 +3,7 @@ import { ExternalIcon, SpinnerIcon } from '@modrinth/assets' import { defineMessages, injectNotificationManager, useVIntl } from '@modrinth/ui' import { computed, onMounted, ref, watch } from 'vue' -import { type SkinSiteMapServer,skinSiteMapServers } from '@/helpers/skin-site-api' +import { type SkinSiteMapServer, skinSiteMapServers } from '@/helpers/skin-site-api' const { formatMessage } = useVIntl() const { handleError } = injectNotificationManager() diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteReviewView.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteReviewView.vue new file mode 100644 index 0000000..558757f --- /dev/null +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteReviewView.vue @@ -0,0 +1,313 @@ + + + + + ← {{ activePaper ? formatMessage(messages.backToList) : formatMessage(messages.back) }} + + + + + {{ formatMessage(messages.title) }} + {{ formatMessage(messages.subtitle) }} + + + + + {{ formatMessage(messages.loading) }} + + + {{ formatMessage(messages.failed) }} + + + {{ formatMessage(messages.empty) }} + + + {{ paper.title }} + {{ paper.description }} + + + + + + {{ formatMessage(messages.submitted) }} + {{ resultLabel(receipt.result) }} + + {{ formatMessage(messages.backToList) }} + + + + + {{ activePaper.title }} + + + {{ formatMessage(messages.email) }} + + {{ formatMessage(messages.emailHint) }} + + + + {{ + formatMessage(messages.inviteCode) + }} + + + + + + {{ question.title }} + + {{ formatMessage(messages.required) }} + + + {{ + question.annotation + }} + + + {{ question.answer }} + + + + + + {{ option.description }} + + + + + + + {{ option.description }} + + + + + + + + + + {{ formatMessage(submitting ? messages.submitting : messages.submit) }} + + + + diff --git a/apps/app-frontend/src/helpers/skin-site-api.ts b/apps/app-frontend/src/helpers/skin-site-api.ts index 57b826c..2249f14 100644 --- a/apps/app-frontend/src/helpers/skin-site-api.ts +++ b/apps/app-frontend/src/helpers/skin-site-api.ts @@ -550,3 +550,81 @@ export interface SkinSiteMapServer { export function skinSiteMapServers(): Promise> { return skinSiteRequest('maps', { auth: false }) } +// --------------------------------------------------------------------------- +// Player review (public side) +// --------------------------------------------------------------------------- + +export type SkinSiteReviewQuestionType = 'SINGLE' | 'MULTIPLE' | 'TRUE_FALSE' | 'FILL' | 'ESSAY' +export type SkinSiteReviewResult = 'PENDING' | 'PASSED' | 'REJECTED' + +export interface SkinSiteReviewOption { + id: string + description: string + correct?: boolean + defaultSelected?: boolean +} + +export interface SkinSiteReviewQuestion { + id: string + type: SkinSiteReviewQuestionType + title: string + annotation?: string | null + score?: number + optional?: boolean + fatal?: boolean + options?: SkinSiteReviewOption[] + answer?: string | null + maxLength?: number | null + informationQuestion?: boolean +} + +export interface SkinSiteReviewPaper { + id: string + title: string + description?: string + questions: SkinSiteReviewQuestion[] + [key: string]: unknown +} + +export interface SkinSiteReviewCatalog { + papers: SkinSiteReviewPaper[] + [key: string]: unknown +} + +export interface SkinSiteReviewReceipt { + id?: number + accessToken?: string + result?: SkinSiteReviewResult + title?: string + [key: string]: unknown +} + +export function skinSiteReviewCatalog(): Promise> { + return skinSiteRequest('review/public', { auth: false }) +} + +export function skinSiteReviewPaper( + paperId: string, +): Promise> { + return skinSiteRequest(`review/public/${encodeURIComponent(paperId)}`, { + auth: false, + }) +} + +export interface SkinSiteReviewSubmitData { + paperId: string + email: string + answers: Record + inviteCode?: string + [key: string]: unknown +} + +export function skinSiteSubmitReview( + data: SkinSiteReviewSubmitData, +): Promise> { + return skinSiteRequest('review/submit', { + method: 'POST', + body: data, + auth: false, + }) +}
{{ formatMessage(messages.subtitle) }}
+ {{ formatMessage(messages.failed) }} +
+ {{ formatMessage(messages.empty) }} +
{{ resultLabel(receipt.result) }}