rename category to orientation

This commit is contained in:
La macchina desiderante 2024-05-11 20:06:04 +02:00
parent 4e789ddce1
commit fab737abfd
9 changed files with 25 additions and 25 deletions

View File

@ -25,7 +25,7 @@
"lang_en": "English",
"settings_title": "Settings",
"platform_title": "Platform:",
"category_title": "Category:"
"orientation_title": "Orientation:"
},
"Results": {
"query": "Search results for: {{ query }}",

View File

@ -25,7 +25,7 @@
"lang_en": "Inglese",
"settings_title": "Impostazioni",
"platform_title": "Piattaforma:",
"category_title": "Categoria:"
"orientation_title": "Orientamento:"
},
"Results": {
"query": "Risultati della ricerca per: {{ query }}",

View File

@ -9,6 +9,6 @@ export default async function SearchPage({ params }: { params: { query: string }
const data = await fetchGalleryData({ query: params.query })
return <Layout>
<Search data={data} query={params.query} />
<Search data={data} query={decodeURIComponent(params.query)} />
</Layout>
}

View File

@ -1,8 +1,8 @@
'use client'
import { Cookies, XVideosCategories } from '@/meta/settings';
import { Cookies, XVideosOrientations } from '@/meta/settings';
import css from './Category.module.scss'
import css from './Orientation.module.scss'
import React from 'react';
@ -15,23 +15,23 @@ interface Props {
}
}
const Category: React.FC<Props> = (props) => {
const Orientation: React.FC<Props> = (props) => {
const { labels } = props
const [cookies] = useCookies([Cookies.category]);
const [cookies] = useCookies([Cookies.orientation]);
const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
const value = event.target.value;
await setCookie(Cookies.category, value)
await setCookie(Cookies.orientation, value)
}
return (
<div className={css.container}>
<div className={css.title}>{labels.title}</div>
<select defaultValue={ cookies.category ?? XVideosCategories.etero } onChange={handleChange} name={'category'} aria-label={labels.title}>
{Object.keys(XVideosCategories).map((elem, key) => {
<select defaultValue={ cookies.orientation ?? XVideosOrientations.etero } onChange={handleChange} name={'orientation'} aria-label={labels.title}>
{Object.keys(XVideosOrientations).map((elem, key) => {
return <option className={css.option} key={key} value={elem}>{elem.toUpperCase()}</option>
})}
</select>
@ -39,4 +39,4 @@ const Category: React.FC<Props> = (props) => {
);
};
export default Category;
export default Orientation;

View File

@ -6,14 +6,14 @@ import { IoCloseCircleOutline } from "react-icons/io5";
import style from './Modal.module.scss'
import Platform from './Platform';
import Category from './Category';
import Orientation from './Orientation';
interface Props {
handleClose(): void
labels: {
title: string
platform: any
category: any
orientation: any
}
}
@ -30,7 +30,7 @@ const LangSwitcher: React.FC<Props> = (props) => {
</header>
<div className={style.content}>
<Platform labels={{ title: labels.platform.title }} />
<Category labels={{ title: labels.category.title }} />
<Orientation labels={{ title: labels.orientation.title }} />
</div>
</article>
</dialog >

View File

@ -29,8 +29,8 @@ const Menu: React.FC = () => {
platform: {
title: t('platform_title')
},
category: {
title: t('category_title')
orientation: {
title: t('orientation_title')
}
}

View File

@ -1,6 +1,6 @@
export enum Cookies {
theme= 'theme',
category= 'category',
orientation= 'orientation',
platform= 'platform'
}
@ -15,7 +15,7 @@ export enum XVideosCatQueryMap {
trans= 'shemale'
}
export enum XVideosCategories {
export enum XVideosOrientations {
etero= 'etero',
gay= 'gay',
trans= 'trans'

View File

@ -1,10 +1,10 @@
import { XVIDEOS_BASE_URL, XVIDEOS_BASE_URL_GAY, XVIDEOS_BASE_URL_TRANS } from '@/constants/urls';
import { Cookies, XVideosCatQueryMap, XVideosCategories } from '@/meta/settings';
import { Cookies, XVideosCatQueryMap, XVideosOrientations } from '@/meta/settings';
import { getCookie } from '@/utils/cookies/read';
export const getXVideosQueryUrl = async (query?: string) => {
const category = await getCookie(Cookies.category)
const category = await getCookie(Cookies.orientation)
if (!category && !query) {
return XVIDEOS_BASE_URL
@ -14,17 +14,17 @@ export const getXVideosQueryUrl = async (query?: string) => {
return `${XVIDEOS_BASE_URL}/?k=${query}`
}
if (category && !Object.values(XVideosCategories).includes(category.value as XVideosCategories)) {
if (category && !Object.values(XVideosOrientations).includes(category.value as XVideosOrientations)) {
return XVIDEOS_BASE_URL
}
if (category && !query) {
switch (category.value) {
case XVideosCategories.etero:
case XVideosOrientations.etero:
return XVIDEOS_BASE_URL
case XVideosCategories.gay:
case XVideosOrientations.gay:
return XVIDEOS_BASE_URL_GAY
case XVideosCategories.trans:
case XVideosOrientations.trans:
return XVIDEOS_BASE_URL_TRANS
default:
return XVIDEOS_BASE_URL;
@ -32,7 +32,7 @@ export const getXVideosQueryUrl = async (query?: string) => {
}
if (category && query) {
return `${XVIDEOS_BASE_URL}/?k=${query}&typef=${XVideosCatQueryMap[category.value as XVideosCategories]}`
return `${XVIDEOS_BASE_URL}/?k=${query}&typef=${XVideosCatQueryMap[category.value as XVideosOrientations]}`
}
return XVIDEOS_BASE_URL