Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | 54x 7x 7x 7x 7x 7x 6x 7x 4x 7x 6x 2x 45x 45x 45x 45x 45x 48x 3x 45x 48x 48x 48x 6x | <template>
<article class="review-card card" :data-task-id="task.taskId">
<div class="card-body">
<template v-if="task.view.pack">
<p class="review-context small text-muted mb-2">
<font-awesome-icon icon="fa-solid fa-store" class="me-1" />
{{ t('store.title') }}
</p>
<div class="review-pack mb-3">
<p class="fw-semibold mb-1">
{{ getTranslation(task.view.pack.name) }}
<span class="badge bg-secondary ms-1 review-pack-version">
v{{ task.view.pack.version }}
</span>
</p>
<p v-if="getTranslation(task.view.pack.description)" class="small mb-1">
{{ getTranslation(task.view.pack.description) }}
</p>
<p v-if="task.view.pack.entities.length > 0" class="small text-muted mb-0">
{{ task.view.pack.entities.map((entity) => getTranslation(entity.name)).join(', ') }}
</p>
</div>
</template>
<p v-else-if="task.view.entity" class="review-context small text-muted mb-2">
<font-awesome-icon icon="fa-solid fa-cube" class="me-1" />
{{ getTranslation(task.view.entity.name) }}
</p>
<div v-if="itemCard" class="review-item mb-3">
<EntityItemCard
:item="itemCard.item"
:fields="itemCard.fields"
:layout="itemCard.layout"
:get-translation="getTranslation"
:can-edit="false"
:can-delete="false"
:can-like="false"
compact
/>
</div>
<p v-else-if="task.view.item?.label" class="review-item-label small mb-2">
{{ task.view.item.label }}
</p>
<blockquote
v-if="task.view.parent && task.view.parent.body && !showDiscussion"
class="review-parent text-muted small mb-2"
>
<span class="d-block fw-semibold">{{ t('moderation.replyingTo') }}</span>
{{ task.view.parent.body }}
</blockquote>
<p v-if="!showDiscussion" class="review-comment fs-5 mb-2">{{ task.view.comment.body }}</p>
<ModerationThread
v-if="showDiscussion"
class="mb-2"
:entity-id="task.view.entity?.id"
:item-id="task.view.item?.id"
:pack-id="task.view.pack?.id"
:parent-id="task.view.parent?.id ?? null"
:comment="task.view.comment"
/>
<button
type="button"
class="btn btn-link btn-sm p-0 mb-3 toggle-discussion"
:aria-expanded="showDiscussion"
@click="showDiscussion = !showDiscussion"
>
<font-awesome-icon icon="fa-solid fa-comments" class="me-1" />
{{ showDiscussion ? t('moderation.hideDiscussion') : t('moderation.seeDiscussion') }}
</button>
<div class="review-actions d-flex gap-2">
<button
type="button"
class="btn btn-success flex-fill"
:disabled="disabled"
@click="$emit('vote', 'approve')"
>
<font-awesome-icon icon="fa-solid fa-check" class="me-2" />
{{ t('moderation.approve') }}
</button>
<button
type="button"
class="btn btn-danger flex-fill"
:disabled="disabled"
@click="$emit('vote', 'reject')"
>
<font-awesome-icon icon="fa-solid fa-times" class="me-2" />
{{ t('moderation.reject') }}
</button>
</div>
<slot name="footer" />
</div>
</article>
</template>
<script setup lang="ts">
// @implements UC-MOD-002.1, UC-STORE-009.1
// One content to review, shown with what is needed to judge it: the item as
// its entity's default form shows it (or the store pack, as its card does),
// the comment replied to, and on demand the whole discussion around it. Used by the Moderation page and inline in
// the comments panel, when posting needs a few more reviews.
import { computed, ref, watch } from 'vue'
import EntityItemCard from '@/components/EntityItemCard.vue'
import ModerationThread from '@/components/ModerationThread.vue'
import { useUILanguage } from '@/composables/useUILanguage'
import { useLanguage } from '@/composables/useLanguage'
import type { ModerationTask, ModerationVote } from '@/stores/moderation'
const props = withDefaults(defineProps<{ task: ModerationTask; disabled?: boolean }>(), {
disabled: false
})
defineEmits<{ vote: [choice: ModerationVote] }>()
const { t } = useUILanguage()
const { getTranslation } = useLanguage()
const showDiscussion = ref(false)
// The next task starts folded again
watch(
() => props.task.taskId,
() => (showDiscussion.value = false)
)
const itemCard = computed(() => {
const { item, entity } = props.task.view
const card = item?.card
if (!item || !entity || !card || card.fields.length === 0) return null
return {
item: { ...card.values, id: item.id, entityId: entity.id },
fields: card.fields,
layout: card.layout
}
})
</script>
<style scoped>
.review-parent {
border-left: 3px solid var(--bw-border, rgba(0, 0, 0, 0.15));
padding-left: 0.75rem;
}
.review-comment {
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.review-item :deep(.entity-item-card) {
background: var(--bw-surface-muted, rgba(0, 0, 0, 0.03));
}
</style>
|