mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 13:05:50 +00:00
fix: hide filters if just one type
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
</ButtonStyled>
|
</ButtonStyled>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap items-center gap-1.5">
|
<div v-if="hasMultipleMethods" class="flex flex-wrap items-center gap-1.5">
|
||||||
<FilterIcon class="size-5 shrink-0 text-secondary" aria-hidden="true" />
|
<FilterIcon class="size-5 shrink-0 text-secondary" aria-hidden="true" />
|
||||||
<button
|
<button
|
||||||
:class="filterClass(methodFilter === 'all')"
|
:class="filterClass(methodFilter === 'all')"
|
||||||
@@ -158,7 +158,7 @@ import {
|
|||||||
useVIntl,
|
useVIntl,
|
||||||
} from '@modrinth/ui'
|
} from '@modrinth/ui'
|
||||||
import { openUrl } from '@tauri-apps/plugin-opener'
|
import { openUrl } from '@tauri-apps/plugin-opener'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type MethodFilter,
|
type MethodFilter,
|
||||||
@@ -193,6 +193,9 @@ const methodFilterOptions: Array<{ id: ShareMethod; label: string }> = [
|
|||||||
{ id: 'direct', label: methodLabels.direct },
|
{ id: 'direct', label: methodLabels.direct },
|
||||||
{ id: 'link', label: methodLabels.link },
|
{ id: 'link', label: methodLabels.link },
|
||||||
]
|
]
|
||||||
|
const hasMultipleMethods = computed(
|
||||||
|
() => new Set(props.rows.map((row) => row.method)).size > 1,
|
||||||
|
)
|
||||||
const columns = computed<TableColumn<ShareTableColumn>[]>(() => {
|
const columns = computed<TableColumn<ShareTableColumn>[]>(() => {
|
||||||
const result: TableColumn<ShareTableColumn>[] = [
|
const result: TableColumn<ShareTableColumn>[] = [
|
||||||
{
|
{
|
||||||
@@ -288,6 +291,10 @@ function filterClass(active: boolean) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(hasMultipleMethods, (multiple) => {
|
||||||
|
if (!multiple) methodFilter.value = 'all'
|
||||||
|
})
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
pushUpdate: {
|
pushUpdate: {
|
||||||
id: 'app.instance.admonitions.shared-instance.publish-button',
|
id: 'app.instance.admonitions.shared-instance.publish-button',
|
||||||
|
|||||||
Reference in New Issue
Block a user