Remove irrelevant NSFW filter for extensions

This commit is contained in:
arkon 2024-01-08 17:38:07 -05:00
parent f087aebccb
commit ed9378f616
4 changed files with 2 additions and 25 deletions

View File

@ -15,21 +15,18 @@ import {
import { langName, simpleLangName } from '../../../config/scripts/languages' import { langName, simpleLangName } from '../../../config/scripts/languages'
import type { Extension } from '../../queries/useExtensionsRepositoryQuery' import type { Extension } from '../../queries/useExtensionsRepositoryQuery'
export type Nsfw = 'Show all' | 'NSFW' | 'SFW'
export type Sort = 'Ascending' | 'Descending' export type Sort = 'Ascending' | 'Descending'
const props = defineProps<{ const props = defineProps<{
extensions: Extension[][] extensions: Extension[][]
search: string search: string
lang: string[] lang: string[]
nsfw: Nsfw
sort: Sort sort: Sort
}>() }>()
defineEmits<{ defineEmits<{
(e: 'update:search', search: string): void (e: 'update:search', search: string): void
(e: 'update:lang', lang: string[]): void (e: 'update:lang', lang: string[]): void
(e: 'update:nsfw', nsfw: Nsfw): void
(e: 'update:sort', sort: Sort): void (e: 'update:sort', sort: Sort): void
}>() }>()
@ -76,16 +73,6 @@ const labelPosition = computed(() => isSmallScreen.value ? 'top' : 'right')
<ElRadio label="Descending" /> <ElRadio label="Descending" />
</ElRadioGroup> </ElRadioGroup>
</ElFormItem> </ElFormItem>
<ElFormItem label="Display mode:">
<ElRadioGroup
:model-value="nsfw"
@update:model-value="$emit('update:nsfw', $event)"
>
<ElRadio label="NSFW" />
<ElRadio label="SFW" />
<ElRadio label="Show all" />
</ElRadioGroup>
</ElFormItem>
</ElForm> </ElForm>
</div> </div>
</ClientOnly> </ClientOnly>

View File

@ -12,7 +12,6 @@ const pkgId = computed(() => {
}) })
const pkgName = computed(() => item.value.name.split(': ')[1]) const pkgName = computed(() => item.value.name.split(': ')[1])
const pkgIsNsfw = computed(() => item.value.nsfw === 1)
const iconUrl = computed(() => { const iconUrl = computed(() => {
return `https://raw.githubusercontent.com/tachiyomiorg/extensions/repo/icon/${item.value.pkg}.png` return `https://raw.githubusercontent.com/tachiyomiorg/extensions/repo/icon/${item.value.pkg}.png`
@ -43,8 +42,7 @@ function handleAnalytics() {
{{ pkgId }} {{ pkgId }}
</div> </div>
</div> </div>
<Badge v-if="pkgIsNsfw" type="danger" :text="item.version" title="This extension contains NSFW entries." /> <Badge type="info" :text="item.version" />
<Badge v-else type="info" :text="item.version" title="This extension is free from NSFW entries." />
<a <a
:href="apkUrl" :href="apkUrl"
class="extension-download" class="extension-download"

View File

@ -8,7 +8,7 @@ import useExtensionsRepositoryQuery from '../../queries/useExtensionsRepositoryQ
import type { Extension } from '../../queries/useExtensionsRepositoryQuery' import type { Extension } from '../../queries/useExtensionsRepositoryQuery'
import ExtensionFilters from './ExtensionFilters.vue' import ExtensionFilters from './ExtensionFilters.vue'
import ExtensionList from './ExtensionList.vue' import ExtensionList from './ExtensionList.vue'
import type { Nsfw, Sort } from './ExtensionFilters.vue' import type { Sort } from './ExtensionFilters.vue'
const { data: extensions, isLoading } = useExtensionsRepositoryQuery({ const { data: extensions, isLoading } = useExtensionsRepositoryQuery({
select: (response) => { select: (response) => {
@ -22,7 +22,6 @@ const { data: extensions, isLoading } = useExtensionsRepositoryQuery({
const filters = reactive({ const filters = reactive({
search: '', search: '',
lang: [] as string[], lang: [] as string[],
nsfw: 'Show all' as Nsfw,
sort: 'Ascending' as Sort, sort: 'Ascending' as Sort,
}) })
@ -65,9 +64,6 @@ const filteredExtensions = computed(() => {
|| ext.sources.some(source => source.id.includes(filters.search)), || ext.sources.some(source => source.id.includes(filters.search)),
) )
} }
filteredGroup = filteredGroup.filter(ext =>
filters.nsfw === 'Show all' ? true : ext.nsfw === (filters.nsfw === 'NSFW' ? 1 : 0),
)
if (filters.sort && filters.sort === 'Descending') if (filters.sort && filters.sort === 'Descending')
filteredGroup = filteredGroup.reverse() filteredGroup = filteredGroup.reverse()
@ -109,7 +105,6 @@ watch([isLoading, loadingInstance], async ([newIsLoading]) => {
<ExtensionFilters <ExtensionFilters
v-model:search="filters.search" v-model:search="filters.search"
v-model:lang="filters.lang" v-model:lang="filters.lang"
v-model:nsfw="filters.nsfw"
v-model:sort="filters.sort" v-model:sort="filters.sort"
:extensions="extensions ?? []" :extensions="extensions ?? []"
/> />

View File

@ -12,9 +12,6 @@ export interface Extension {
lang: string lang: string
code: number code: number
version: string version: string
nsfw: number
hasReadme: number
hasChangelog: number
sources: Source[] sources: Source[]
} }