Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/frontend/src/pages/hosting/manage/[id]/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import { injectModrinthServerContext, ServersManageContentPage } from '@modrinth/ui'

const { server } = injectModrinthServerContext()
const flags = useFeatureFlags()

useHead({
title: `Content - ${server.value?.name ?? 'Server'} - Modrinth`,
})
</script>

<template>
<ServersManageContentPage :show-client-only-filter="flags.developerMode" />
<ServersManageContentPage />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ const filterOptions = computed(() => {
}
})

if (items.value.some((item) => getClientWarningType(item) !== null)) {
options.push({ id: 'warnings', label: 'Warnings' })
}

if (items.value.some((item) => !item.enabled)) {
options.push({ id: 'disabled', label: 'Disabled' })
}
Expand All @@ -175,16 +179,18 @@ function toggleFilter(filterId: string) {
}
}

const attributeFilterIds = new Set(['disabled'])
const attributeFilterIds = new Set(['disabled', 'warnings'])

const typeFilteredCount = computed(() => {
if (selectedFilters.value.length === 0) return items.value.length
const typeFilters = selectedFilters.value.filter((f) => !attributeFilterIds.has(f))
const hasDisabledFilter = selectedFilters.value.includes('disabled')
const hasWarningsFilter = selectedFilters.value.includes('warnings')
return items.value.filter((item) => {
if (typeFilters.length > 0 && !typeFilters.includes(normalizeProjectType(item.project_type)))
return false
if (hasDisabledFilter && item.enabled) return false
if (hasWarningsFilter && getClientWarningType(item) === null) return false
return true
}).length
})
Expand All @@ -206,10 +212,12 @@ const filteredItems = computed(() => {
if (selectedFilters.value.length > 0) {
const typeFilters = selectedFilters.value.filter((f) => !attributeFilterIds.has(f))
const hasDisabledFilter = selectedFilters.value.includes('disabled')
const hasWarningsFilter = selectedFilters.value.includes('warnings')
result = result.filter((item) => {
if (typeFilters.length > 0 && !typeFilters.includes(normalizeProjectType(item.project_type)))
return false
if (hasDisabledFilter && item.enabled) return false
if (hasWarningsFilter && getClientWarningType(item) === null) return false
return true
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ContentFilterOption {
export interface ContentFilterConfig {
showTypeFilters?: boolean
showUpdateFilter?: boolean
showClientOnlyFilter?: boolean
showWarningsFilter?: boolean
isPackLocked?: Ref<boolean>
persistKey?: string
}
Expand Down Expand Up @@ -62,8 +62,8 @@ export function useContentFilters(items: Ref<ContentItem[]>, config?: ContentFil
options.push({ id: 'updates', label: 'Updates' })
}

if (config?.showClientOnlyFilter && items.value.some((m) => getClientWarningType(m) !== null)) {
options.push({ id: 'client-only', label: 'Client-only' })
if (config?.showWarningsFilter && items.value.some((m) => getClientWarningType(m) !== null)) {
options.push({ id: 'warnings', label: 'Warnings' })
}

if (items.value.some((m) => !m.enabled)) {
Expand Down Expand Up @@ -91,7 +91,7 @@ export function useContentFilters(items: Ref<ContentItem[]>, config?: ContentFil
function applyFilters(source: ContentItem[]): ContentItem[] {
if (selectedFilters.value.length === 0) return source

const attributeFilters = new Set(['updates', 'disabled', 'client-only'])
const attributeFilters = new Set(['updates', 'disabled', 'warnings'])
const typeFilters = selectedFilters.value.filter((f) => !attributeFilters.has(f))
const activeAttributes = selectedFilters.value.filter((f) => attributeFilters.has(f))

Expand All @@ -106,7 +106,7 @@ export function useContentFilters(items: Ref<ContentItem[]>, config?: ContentFil
for (const filter of activeAttributes) {
if (filter === 'updates' && !item.has_update) return false
if (filter === 'disabled' && item.enabled) return false
if (filter === 'client-only' && getClientWarningType(item) === null) return false
if (filter === 'warnings' && getClientWarningType(item) === null) return false
}

return true
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/layouts/shared/content-tab/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const { selectedFilters, filterOptions, toggleFilter, applyFilters } = useConten
{
showTypeFilters: true,
showUpdateFilter: ctx.hasUpdateSupport,
showClientOnlyFilter: ctx.showClientOnlyFilter ?? false,
showWarningsFilter: true,
isPackLocked: ctx.isPackLocked,
persistKey: ctx.filterPersistKey,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ export interface ContentManagerContext {
// Upload progress (optional)
uploadState?: Ref<UploadState> | ComputedRef<UploadState>

// Show client-only environment filter pill
showClientOnlyFilter?: boolean

// Bulk operation guard — set by layout, checked by providers to suppress refreshes
isBulkOperating?: Ref<boolean>

Expand Down
10 changes: 0 additions & 10 deletions packages/ui/src/layouts/wrapped/hosting/manage/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ const leaveMessages = defineMessages({
},
})

const props = withDefaults(
defineProps<{
showClientOnlyFilter?: boolean
}>(),
{
showClientOnlyFilter: false,
},
)

const client = injectModrinthClient()
const { server, worldId, busyReasons, isSyncingContent } = injectModrinthServerContext()
const { addNotification } = injectNotificationManager()
Expand Down Expand Up @@ -896,7 +887,6 @@ provideContentManager({
browse: handleBrowseContent,
uploadFiles: handleUploadFiles,
uploadState,
showClientOnlyFilter: props.showClientOnlyFilter,
deletionContext: 'server',
hasUpdateSupport: true,
updateItem: handleUpdateItem,
Expand Down
Loading