Release v0.4.1: Refactor platforms and orientation #115
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "proxyraye-next",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client'
|
||||
|
||||
import { Cookies, Platforms, XVideosOrientations, PornHubOrientations, YouPornOrientations, RedTubeOrientations, XHamsterOrientations } from '@/meta/settings';
|
||||
import { Cookies, OrientationMapper, Platforms, XVideosOrientations } from '@/meta/settings';
|
||||
|
||||
import css from './Orientation.module.scss'
|
||||
|
||||
|
@ -17,23 +17,7 @@ interface Props {
|
|||
}
|
||||
|
||||
const getOrientations = (platform: Platforms):Object => {
|
||||
if ([Platforms.xnxx, Platforms.xvideos].includes(platform)) {
|
||||
return XVideosOrientations
|
||||
}
|
||||
|
||||
if([Platforms.youporn].includes(platform)) {
|
||||
return YouPornOrientations
|
||||
}
|
||||
|
||||
if([Platforms.redtube].includes(platform)) {
|
||||
return RedTubeOrientations
|
||||
}
|
||||
|
||||
if([Platforms.xhamster].includes(platform)) {
|
||||
return XHamsterOrientations
|
||||
}
|
||||
|
||||
return PornHubOrientations
|
||||
return OrientationMapper[platform];
|
||||
}
|
||||
|
||||
const Orientation: React.FC<Props> = (props) => {
|
||||
|
@ -42,7 +26,7 @@ const Orientation: React.FC<Props> = (props) => {
|
|||
|
||||
const [cookies] = useCookies([Cookies.orientation, Cookies.platform]);
|
||||
|
||||
const orientationsList = cookies.platform ? getOrientations(cookies.platform ) : XVideosOrientations
|
||||
const orientationsList = cookies.platform ? getOrientations(cookies.platform) : XVideosOrientations
|
||||
|
||||
const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
const value = event.target.value;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client'
|
||||
|
||||
import { Cookies, Platforms, PornHubOrientations, RedTubeOrientations, XHamsterOrientations, XVideosOrientations, YouPornOrientations } from '@/meta/settings';
|
||||
import { Cookies, OrientationMapper, Platforms } from '@/meta/settings';
|
||||
|
||||
import css from './Platform.module.scss'
|
||||
|
||||
|
@ -18,27 +18,8 @@ interface Props {
|
|||
}
|
||||
|
||||
const mapOrientationToPlatform = (platform: string, orientation: string): string | undefined => {
|
||||
|
||||
if ([String(Platforms.xnxx), String(Platforms.xvideos)].includes(platform)) {
|
||||
return Object.keys(XVideosOrientations).includes(orientation) ? orientation : String(XVideosOrientations.etero)
|
||||
}
|
||||
|
||||
if ([String(Platforms.pornhub)].includes(platform)) {
|
||||
return Object.keys(PornHubOrientations).includes(orientation) ? orientation : String(PornHubOrientations.generic)
|
||||
}
|
||||
|
||||
if ([String(Platforms.redtube)].includes(platform)) {
|
||||
return Object.keys(RedTubeOrientations).includes(orientation) ? orientation : String(RedTubeOrientations.etero)
|
||||
}
|
||||
|
||||
if ([String(Platforms.xhamster)].includes(platform)) {
|
||||
return Object.keys(XHamsterOrientations).includes(orientation) ? orientation : String(XHamsterOrientations.etero)
|
||||
}
|
||||
|
||||
if ([String(Platforms.youporn)].includes(platform)) {
|
||||
return String(YouPornOrientations.generic)
|
||||
}
|
||||
|
||||
const orientations = OrientationMapper[platform as Platforms]
|
||||
return Object.keys(orientations).includes(orientation) ? orientation : String(Object.keys(orientations)[0])
|
||||
}
|
||||
|
||||
const Platform: React.FC<Props> = (props) => {
|
||||
|
|
|
@ -58,3 +58,12 @@ export interface LangOption {
|
|||
label: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export const OrientationMapper = {
|
||||
[Platforms.xvideos]: XVideosOrientations,
|
||||
[Platforms.xnxx]: XVideosOrientations,
|
||||
[Platforms.pornhub]: PornHubOrientations,
|
||||
[Platforms.youporn]: YouPornOrientations,
|
||||
[Platforms.redtube]: RedTubeOrientations,
|
||||
[Platforms.xhamster]: XHamsterOrientations
|
||||
}
|
Loading…
Reference in New Issue