* Begin UI for threads and moderation overhaul * Hide close button on non-report threads * Fix review age coloring * Add project count * Remove action buttons from queue page and add queued date to project page * Hook up to actual data * Remove unused icon * Get up to 1000 projects in queue * prettier * more prettier * Changed all the things * lint * rebuild * Add omorphia * Workaround formatjs bug in ThreadSummary.vue * Fix notifications page on prod * Fix a few notifications and threads bugs * lockfile * Fix duplicate button styles * more fixes and polishing * More fixes * Remove legacy pages * More bugfixes * Add some error catching for reports and notifications * More error handling * fix lint * Add inbox links * Remove loading component and rename member header * Rely on threads always existing * Handle if project update notifs are not grouped * oops * Fix chips on notifications page * Import ModalModeration * finish threads * New authentication (#1234) * Initial new auth work * more auth pages * Finish most * more * fix on landing page * Finish everything but PATs + Sessions * fix threads merge bugs * fix cf pages ssr * fix most issues * Finish authentication * Fix merge --------- Co-authored-by: triphora <emma@modrinth.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
147 lines
3.1 KiB
Vue
147 lines
3.1 KiB
Vue
<template>
|
|
<nuxt-link :to="link" class="thread-summary" :class="{ raised: raised }">
|
|
<div class="thread-title-row">
|
|
<span v-if="report" class="thread-title">Report thread</span>
|
|
<span v-else class="thread-title">Thread</span>
|
|
<span class="thread-messages"
|
|
>{{ props.thread.messages.length }} messages <ChevronRightIcon
|
|
/></span>
|
|
</div>
|
|
<template v-if="displayMessages.length > 0">
|
|
<ThreadMessage
|
|
v-for="message in displayMessages"
|
|
:key="message.id"
|
|
:message="message"
|
|
:report="report"
|
|
:members="members"
|
|
force-compact
|
|
no-links
|
|
/>
|
|
</template>
|
|
<span v-else>There are no messages in this thread yet.</span>
|
|
</nuxt-link>
|
|
</template>
|
|
|
|
<script setup>
|
|
import ChevronRightIcon from '~/assets/images/utils/chevron-right.svg'
|
|
import ThreadMessage from '~/components/ui/thread/ThreadMessage.vue'
|
|
|
|
const props = defineProps({
|
|
thread: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
report: {
|
|
type: Object,
|
|
required: false,
|
|
default: null,
|
|
},
|
|
raised: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
link: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
messages: {
|
|
type: Array,
|
|
required: false,
|
|
default() {
|
|
return []
|
|
},
|
|
},
|
|
auth: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
})
|
|
|
|
const app = useNuxtApp()
|
|
|
|
const members = computed(() => {
|
|
const members = {}
|
|
for (const member of props.thread.members) {
|
|
members[member.id] = member
|
|
}
|
|
members[props.auth.user.id] = props.auth.user
|
|
return members
|
|
})
|
|
|
|
const displayMessages = computed(() => {
|
|
const sortedMessages = props.thread.messages
|
|
.slice()
|
|
.sort((a, b) => app.$dayjs(a.created) - app.$dayjs(b.created))
|
|
if (props.messages.length > 0) {
|
|
return sortedMessages.filter((msg) => props.messages.includes(msg.id))
|
|
} else {
|
|
return sortedMessages.length > 0 ? [sortedMessages[sortedMessages.length - 1]] : []
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.thread-summary {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background-color: var(--color-bg);
|
|
padding: var(--spacing-card-bg);
|
|
border-radius: var(--size-rounded-card);
|
|
border: 1px solid var(--color-divider-dark);
|
|
gap: var(--spacing-card-sm);
|
|
|
|
.thread-title-row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
|
|
.thread-title {
|
|
font-weight: bold;
|
|
color: var(--color-heading);
|
|
}
|
|
|
|
.thread-messages {
|
|
margin-left: auto;
|
|
color: var(--color-link);
|
|
|
|
svg {
|
|
vertical-align: top;
|
|
}
|
|
}
|
|
}
|
|
|
|
.thread-message {
|
|
.user {
|
|
font-weight: bold;
|
|
}
|
|
|
|
.date {
|
|
color: var(--color-text-secondary);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
}
|
|
|
|
.thread-message,
|
|
.thread-message > span {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: var(--spacing-card-xs);
|
|
align-items: center;
|
|
}
|
|
|
|
&.raised {
|
|
background-color: var(--color-raised-bg);
|
|
}
|
|
|
|
&:hover .thread-title-row,
|
|
&:focus-visible .thread-title-row {
|
|
text-decoration: underline;
|
|
filter: var(--hover-filter);
|
|
}
|
|
|
|
&:active .thread-title-row {
|
|
filter: var(--active-filter);
|
|
}
|
|
}
|
|
</style>
|