* 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 --------- Co-authored-by: triphora <emma@modrinth.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me>
102 lines
1.8 KiB
Vue
102 lines
1.8 KiB
Vue
<template>
|
|
<div class="chips">
|
|
<button
|
|
v-for="item in items"
|
|
:key="item"
|
|
class="iconified-button"
|
|
:class="{ selected: selected === item, capitalize: capitalize }"
|
|
@click="toggleItem(item)"
|
|
>
|
|
<CheckIcon v-if="selected === item" />
|
|
<span>{{ formatLabel(item) }}</span>
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CheckIcon from '~/assets/images/utils/check.svg'
|
|
|
|
export default {
|
|
components: {
|
|
CheckIcon,
|
|
},
|
|
props: {
|
|
modelValue: {
|
|
required: true,
|
|
type: String,
|
|
},
|
|
items: {
|
|
required: true,
|
|
type: Array,
|
|
},
|
|
neverEmpty: {
|
|
default: true,
|
|
type: Boolean,
|
|
},
|
|
formatLabel: {
|
|
default: (x) => x,
|
|
type: Function,
|
|
},
|
|
capitalize: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
emits: ['update:modelValue'],
|
|
computed: {
|
|
selected: {
|
|
get() {
|
|
return this.modelValue
|
|
},
|
|
set(value) {
|
|
this.$emit('update:modelValue', value)
|
|
},
|
|
},
|
|
},
|
|
created() {
|
|
if (this.items.length > 0 && this.neverEmpty) {
|
|
this.selected = this.items[0]
|
|
}
|
|
},
|
|
methods: {
|
|
toggleItem(item) {
|
|
if (this.selected === item && !this.neverEmpty) {
|
|
this.selected = null
|
|
} else {
|
|
this.selected = item
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.chips {
|
|
display: flex;
|
|
grid-gap: 0.5rem;
|
|
flex-wrap: wrap;
|
|
|
|
.iconified-button {
|
|
&.capitalize {
|
|
text-transform: capitalize;
|
|
}
|
|
|
|
svg {
|
|
width: 1em;
|
|
height: 1em;
|
|
}
|
|
|
|
&:focus-visible {
|
|
outline: 0.25rem solid #ea80ff;
|
|
border-radius: 0.25rem;
|
|
}
|
|
}
|
|
|
|
.selected {
|
|
color: var(--color-button-text-active);
|
|
background-color: var(--color-brand-highlight);
|
|
box-shadow: inset 0 0 0 transparent, 0 0 0 2px var(--color-brand);
|
|
}
|
|
}
|
|
</style>
|