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", "lang_en": "English",
"settings_title": "Settings", "settings_title": "Settings",
"platform_title": "Platform:", "platform_title": "Platform:",
"category_title": "Category:" "orientation_title": "Orientation:"
}, },
"Results": { "Results": {
"query": "Search results for: {{ query }}", "query": "Search results for: {{ query }}",

View File

@ -25,7 +25,7 @@
"lang_en": "Inglese", "lang_en": "Inglese",
"settings_title": "Impostazioni", "settings_title": "Impostazioni",
"platform_title": "Piattaforma:", "platform_title": "Piattaforma:",
"category_title": "Categoria:" "orientation_title": "Orientamento:"
}, },
"Results": { "Results": {
"query": "Risultati della ricerca per: {{ query }}", "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 }) const data = await fetchGalleryData({ query: params.query })
return <Layout> return <Layout>
<Search data={data} query={params.query} /> <Search data={data} query={decodeURIComponent(params.query)} />
</Layout> </Layout>
} }

View File

@ -1,8 +1,8 @@
'use client' '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'; 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 { labels } = props
const [cookies] = useCookies([Cookies.category]); const [cookies] = useCookies([Cookies.orientation]);
const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => { const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
const value = event.target.value; const value = event.target.value;
await setCookie(Cookies.category, value) await setCookie(Cookies.orientation, value)
} }
return ( return (
<div className={css.container}> <div className={css.container}>
<div className={css.title}>{labels.title}</div> <div className={css.title}>{labels.title}</div>
<select defaultValue={ cookies.category ?? XVideosCategories.etero } onChange={handleChange} name={'category'} aria-label={labels.title}> <select defaultValue={ cookies.orientation ?? XVideosOrientations.etero } onChange={handleChange} name={'orientation'} aria-label={labels.title}>
{Object.keys(XVideosCategories).map((elem, key) => { {Object.keys(XVideosOrientations).map((elem, key) => {
return <option className={css.option} key={key} value={elem}>{elem.toUpperCase()}</option> return <option className={css.option} key={key} value={elem}>{elem.toUpperCase()}</option>
})} })}
</select> </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 style from './Modal.module.scss'
import Platform from './Platform'; import Platform from './Platform';
import Category from './Category'; import Orientation from './Orientation';
interface Props { interface Props {
handleClose(): void handleClose(): void
labels: { labels: {
title: string title: string
platform: any platform: any
category: any orientation: any
} }
} }
@ -30,7 +30,7 @@ const LangSwitcher: React.FC<Props> = (props) => {
</header> </header>
<div className={style.content}> <div className={style.content}>
<Platform labels={{ title: labels.platform.title }} /> <Platform labels={{ title: labels.platform.title }} />
<Category labels={{ title: labels.category.title }} /> <Orientation labels={{ title: labels.orientation.title }} />
</div> </div>
</article> </article>
</dialog > </dialog >

View File

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

View File

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

View File

@ -1,10 +1,10 @@
import { XVIDEOS_BASE_URL, XVIDEOS_BASE_URL_GAY, XVIDEOS_BASE_URL_TRANS } from '@/constants/urls'; 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'; import { getCookie } from '@/utils/cookies/read';
export const getXVideosQueryUrl = async (query?: string) => { export const getXVideosQueryUrl = async (query?: string) => {
const category = await getCookie(Cookies.category) const category = await getCookie(Cookies.orientation)
if (!category && !query) { if (!category && !query) {
return XVIDEOS_BASE_URL return XVIDEOS_BASE_URL
@ -14,17 +14,17 @@ export const getXVideosQueryUrl = async (query?: string) => {
return `${XVIDEOS_BASE_URL}/?k=${query}` 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 return XVIDEOS_BASE_URL
} }
if (category && !query) { if (category && !query) {
switch (category.value) { switch (category.value) {
case XVideosCategories.etero: case XVideosOrientations.etero:
return XVIDEOS_BASE_URL return XVIDEOS_BASE_URL
case XVideosCategories.gay: case XVideosOrientations.gay:
return XVIDEOS_BASE_URL_GAY return XVIDEOS_BASE_URL_GAY
case XVideosCategories.trans: case XVideosOrientations.trans:
return XVIDEOS_BASE_URL_TRANS return XVIDEOS_BASE_URL_TRANS
default: default:
return XVIDEOS_BASE_URL; return XVIDEOS_BASE_URL;
@ -32,7 +32,7 @@ export const getXVideosQueryUrl = async (query?: string) => {
} }
if (category && query) { 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 return XVIDEOS_BASE_URL