resolve o/c violation inside Platform component

This commit is contained in:
La macchina desiderante 2024-05-28 22:20:05 +02:00
parent 6a8e433367
commit d41e3a91c2
2 changed files with 4 additions and 23 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "proxyraye-next", "name": "proxyraye-next",
"version": "0.4.0", "version": "0.4.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",

View File

@ -1,6 +1,6 @@
'use client' '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' import css from './Platform.module.scss'
@ -18,27 +18,8 @@ interface Props {
} }
const mapOrientationToPlatform = (platform: string, orientation: string): string | undefined => { const mapOrientationToPlatform = (platform: string, orientation: string): string | undefined => {
const orientations = OrientationMapper[platform as Platforms]
if ([String(Platforms.xnxx), String(Platforms.xvideos)].includes(platform)) { return Object.keys(orientations).includes(orientation) ? orientation : String(Object.keys(orientations)[0])
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 Platform: React.FC<Props> = (props) => { const Platform: React.FC<Props> = (props) => {