mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 17:14:50 +00:00
update toggle filter design (#6888)
change toggle filters to just use exclude-only filters, same design as the others.
This commit is contained in:
@@ -29,13 +29,15 @@ export type FilterOption = BaseOption &
|
||||
| { method: 'environment'; environment: 'client' | 'server' }
|
||||
)
|
||||
|
||||
export type FilterMode = 'include' | 'exclude'
|
||||
|
||||
export type FilterType = {
|
||||
id: string
|
||||
formatted_name: string
|
||||
options: FilterOption[]
|
||||
supported_project_types: ProjectType[]
|
||||
query_param: string
|
||||
supports_negative_filter: boolean
|
||||
supports: FilterMode[]
|
||||
toggle_groups?: {
|
||||
id: string
|
||||
formatted_name: string
|
||||
@@ -46,7 +48,7 @@ export type FilterType = {
|
||||
ordering?: number
|
||||
} & (
|
||||
| {
|
||||
display: 'all' | 'scrollable' | 'none' | 'toggle'
|
||||
display: 'all' | 'scrollable' | 'none'
|
||||
}
|
||||
| {
|
||||
display: 'expandable'
|
||||
@@ -191,7 +193,7 @@ export function useSearch(
|
||||
: ([category.project_type] as ProjectType[]),
|
||||
display: 'all',
|
||||
query_param: category.header === 'resolutions' ? 'g' : 'f',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: [],
|
||||
}
|
||||
@@ -227,7 +229,7 @@ export function useSearch(
|
||||
supported_project_types: ['mod', 'modpack'],
|
||||
display: 'all',
|
||||
query_param: 'e',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
searchable: false,
|
||||
options: [
|
||||
{
|
||||
@@ -267,7 +269,7 @@ export function useSearch(
|
||||
supported_project_types: ALL_PROJECT_TYPES,
|
||||
display: 'scrollable',
|
||||
query_param: 'v',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
toggle_groups: [
|
||||
{
|
||||
id: 'all_versions',
|
||||
@@ -305,7 +307,7 @@ export function useSearch(
|
||||
supported_project_types: ['mod'],
|
||||
display: 'expandable',
|
||||
query_param: 'g',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
default_values: DEFAULT_MOD_LOADERS,
|
||||
searchable: false,
|
||||
options: tags.value.loaders
|
||||
@@ -337,7 +339,7 @@ export function useSearch(
|
||||
supported_project_types: ['modpack'],
|
||||
display: 'all',
|
||||
query_param: 'g',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: tags.value.loaders
|
||||
.filter((loader) => loader.supported_project_types.includes('modpack'))
|
||||
@@ -363,7 +365,7 @@ export function useSearch(
|
||||
display: 'expandable',
|
||||
default_values: DEFAULT_PLUGIN_LOADERS,
|
||||
query_param: 'g',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: tags.value.loaders
|
||||
.filter(
|
||||
@@ -392,7 +394,7 @@ export function useSearch(
|
||||
supported_project_types: ['plugin'],
|
||||
display: 'all',
|
||||
query_param: 'g',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: tags.value.loaders
|
||||
.filter((loader) => PLUGIN_PLATFORMS.includes(loader.name))
|
||||
@@ -416,7 +418,7 @@ export function useSearch(
|
||||
),
|
||||
supported_project_types: ['shader'],
|
||||
query_param: 'g',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
display: 'expandable',
|
||||
default_values: DEFAULT_SHADER_LOADERS,
|
||||
@@ -439,7 +441,7 @@ export function useSearch(
|
||||
),
|
||||
supported_project_types: ['mod', 'modpack', 'resourcepack', 'shader', 'plugin', 'datapack'],
|
||||
query_param: 'l',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
display: 'all',
|
||||
searchable: false,
|
||||
options: [
|
||||
@@ -466,7 +468,7 @@ export function useSearch(
|
||||
),
|
||||
supported_project_types: ALL_PROJECT_TYPES,
|
||||
query_param: 'pid',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
display: 'none',
|
||||
searchable: false,
|
||||
options: [],
|
||||
@@ -481,8 +483,9 @@ export function useSearch(
|
||||
}),
|
||||
),
|
||||
supported_project_types: ['mod', 'plugin', 'datapack'],
|
||||
display: 'toggle',
|
||||
display: 'all',
|
||||
query_param: 'a',
|
||||
supports: ['exclude'],
|
||||
searchable: false,
|
||||
ordering: -1000,
|
||||
options: excludeableProjectTypes.map((target) => ({
|
||||
|
||||
@@ -157,7 +157,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'all',
|
||||
query_param: 'sc',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: [],
|
||||
}
|
||||
@@ -204,7 +204,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'all',
|
||||
query_param: 'sct',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
searchable: false,
|
||||
options: [
|
||||
{
|
||||
@@ -250,7 +250,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'scrollable',
|
||||
query_param: 'sgv',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
searchable: true,
|
||||
options: (tags.value?.gameVersions ?? []).map((gv) => ({
|
||||
id: gv.version,
|
||||
@@ -271,7 +271,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'all',
|
||||
query_param: 'sr',
|
||||
supports_negative_filter: true,
|
||||
supports: ['include', 'exclude'],
|
||||
searchable: false,
|
||||
options: sortedRegions.map(([code, name]) => ({
|
||||
id: code,
|
||||
@@ -291,7 +291,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'scrollable',
|
||||
query_param: 'sl',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
searchable: true,
|
||||
options: sortedLanguages.map(([code, name]) => ({
|
||||
id: code,
|
||||
@@ -312,7 +312,7 @@ export function useServerSearch(opts: {
|
||||
supported_project_types: ['server'],
|
||||
display: 'all',
|
||||
query_param: 'sst',
|
||||
supports_negative_filter: false,
|
||||
supports: ['include'],
|
||||
searchable: false,
|
||||
options: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user