Release v0.2.0 #74

Merged
lamacchinadesiderante merged 24 commits from develop into main 2024-05-13 18:07:51 +00:00
12 changed files with 154 additions and 12 deletions
Showing only changes of commit 295fc4dadb - Show all commits

View File

@ -23,7 +23,8 @@
"lang_title": "Please select language", "lang_title": "Please select language",
"lang_it": "Italian", "lang_it": "Italian",
"lang_en": "English", "lang_en": "English",
"settings_title": "Settings" "settings_title": "Settings",
"platform_title": "Platform:"
}, },
"Results": { "Results": {
"query": "Search results for: {{ query }}", "query": "Search results for: {{ query }}",

View File

@ -23,7 +23,8 @@
"lang_title": "Seleziona la lingua", "lang_title": "Seleziona la lingua",
"lang_it": "Italiano", "lang_it": "Italiano",
"lang_en": "Inglese", "lang_en": "Inglese",
"settings_title": "Impostazioni" "settings_title": "Impostazioni",
"platform_title": "Piattaforma:"
}, },
"Results": { "Results": {
"query": "Risultati della ricerca per: {{ query }}", "query": "Risultati della ricerca per: {{ query }}",

63
package-lock.json generated
View File

@ -17,6 +17,7 @@
"next-intl": "^3.11.3", "next-intl": "^3.11.3",
"next-nprogress-bar": "^2.3.11", "next-nprogress-bar": "^2.3.11",
"react": "^18", "react": "^18",
"react-cookie": "^7.1.4",
"react-dom": "^18", "react-dom": "^18",
"react-icons": "^5.1.0", "react-icons": "^5.1.0",
"react-image": "^4.1.0", "react-image": "^4.1.0",
@ -519,6 +520,20 @@
"tslib": "^2.4.0" "tslib": "^2.4.0"
} }
}, },
"node_modules/@types/cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="
},
"node_modules/@types/hoist-non-react-statics": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz",
"integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==",
"dependencies": {
"@types/react": "*",
"hoist-non-react-statics": "^3.3.0"
}
},
"node_modules/@types/json5": { "node_modules/@types/json5": {
"version": "0.0.29", "version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@ -537,14 +552,12 @@
"node_modules/@types/prop-types": { "node_modules/@types/prop-types": {
"version": "15.7.12", "version": "15.7.12",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz",
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q=="
"devOptional": true
}, },
"node_modules/@types/react": { "node_modules/@types/react": {
"version": "18.2.79", "version": "18.2.79",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.79.tgz", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.79.tgz",
"integrity": "sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w==", "integrity": "sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w==",
"devOptional": true,
"dependencies": { "dependencies": {
"@types/prop-types": "*", "@types/prop-types": "*",
"csstype": "^3.0.2" "csstype": "^3.0.2"
@ -1339,6 +1352,14 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true "dev": true
}, },
"node_modules/cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@ -1382,8 +1403,7 @@
"node_modules/csstype": { "node_modules/csstype": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
"devOptional": true
}, },
"node_modules/damerau-levenshtein": { "node_modules/damerau-levenshtein": {
"version": "1.0.8", "version": "1.0.8",
@ -2711,6 +2731,14 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/hoist-non-react-statics": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
"dependencies": {
"react-is": "^16.7.0"
}
},
"node_modules/htmlparser2": { "node_modules/htmlparser2": {
"version": "8.0.2", "version": "8.0.2",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
@ -4087,6 +4115,19 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/react-cookie": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-7.1.4.tgz",
"integrity": "sha512-wDxxa/HYaSXSMlyWJvJ5uZTzIVtQTPf1gMksFgwAz/2/W3lCtY8r4OChCXMPE7wax0PAdMY97UkNJedGv7KnDw==",
"dependencies": {
"@types/hoist-non-react-statics": "^3.3.5",
"hoist-non-react-statics": "^3.3.2",
"universal-cookie": "^7.0.0"
},
"peerDependencies": {
"react": ">= 16.3.0"
}
},
"node_modules/react-dom": { "node_modules/react-dom": {
"version": "18.2.0", "version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@ -4120,8 +4161,7 @@
"node_modules/react-is": { "node_modules/react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"dev": true
}, },
"node_modules/react-redux": { "node_modules/react-redux": {
"version": "9.1.1", "version": "9.1.1",
@ -4964,6 +5004,15 @@
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true "dev": true
}, },
"node_modules/universal-cookie": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-7.1.4.tgz",
"integrity": "sha512-Q+DVJsdykStWRMtXr2Pdj3EF98qZHUH/fXv/gwFz/unyToy1Ek1w5GsWt53Pf38tT8Gbcy5QNsj61Xe9TggP4g==",
"dependencies": {
"@types/cookie": "^0.6.0",
"cookie": "^0.6.0"
}
},
"node_modules/uri-js": { "node_modules/uri-js": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",

View File

@ -18,6 +18,7 @@
"next-intl": "^3.11.3", "next-intl": "^3.11.3",
"next-nprogress-bar": "^2.3.11", "next-nprogress-bar": "^2.3.11",
"react": "^18", "react": "^18",
"react-cookie": "^7.1.4",
"react-dom": "^18", "react-dom": "^18",
"react-icons": "^5.1.0", "react-icons": "^5.1.0",
"react-image": "^4.1.0", "react-image": "^4.1.0",

View File

@ -2,6 +2,8 @@
.container { .container {
overflow: visible !important;
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -0,0 +1,11 @@
@import 'fontsize';
@import 'spacing';
.container {
.title {
margin-bottom: $spacing_16;
}
}

View File

@ -0,0 +1,42 @@
'use client'
import { Platforms } from '@/meta/settings';
import css from './Platform.module.scss'
import React from 'react';
import { setCookie } from '@/utils/cookies/write';
import { useCookies } from 'react-cookie';
interface Props {
labels: {
title: string,
}
}
const Platform: React.FC<Props> = (props) => {
const { labels } = props
const [cookies] = useCookies(['platform']);
const handleChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
const value = event.target.value;
await setCookie('platform', value)
}
return (
<div className={css.container}>
<div className={css.title}>{labels.title}</div>
<select defaultValue={ cookies.platform ?? Platforms.xvideos } onChange={handleChange} name={'platform'} aria-label={labels.title}>
{Object.keys(Platforms).map((elem, key) => {
return <option className={css.option} key={key} value={elem}>{elem.toUpperCase()}</option>
})}
</select>
</div>
);
};
export default Platform;

View File

@ -5,11 +5,13 @@ import React from 'react';
import { IoCloseCircleOutline } from "react-icons/io5"; import { IoCloseCircleOutline } from "react-icons/io5";
import style from './Modal.module.scss' import style from './Modal.module.scss'
import Platform from './Platform';
interface Props { interface Props {
handleClose(): void handleClose(): void
labels: { labels: {
title: string title: string
platform: any
} }
} }
@ -24,9 +26,9 @@ const LangSwitcher: React.FC<Props> = (props) => {
<div className={style.title}>{labels.title}</div> <div className={style.title}>{labels.title}</div>
<div className={style.close} onClick={() => { handleClose() }}><IoCloseCircleOutline size={24} /></div> <div className={style.close} onClick={() => { handleClose() }}><IoCloseCircleOutline size={24} /></div>
</header> </header>
<p className={style.content}> <div className={style.content}>
SETTINGS <Platform labels={{ title: labels.platform.title }} />
</p> </div>
</article> </article>
</dialog > </dialog >

View File

@ -26,6 +26,9 @@ const Menu: React.FC = () => {
const settingsLabels = { const settingsLabels = {
title: t('settings_title'), title: t('settings_title'),
platform: {
title: t('platform_title')
}
} }
return ( return (

View File

@ -1,3 +1,8 @@
export enum Platforms {
xvideos= 'xvideos',
xnxx= 'xnxx'
}
export enum Themes { export enum Themes {
light= 'light', light= 'light',
dark= 'dark' dark= 'dark'

11
src/utils/cookies/read.ts Normal file
View File

@ -0,0 +1,11 @@
'use server'
import { cookies } from 'next/headers'
export async function getCookie(name: string) {
return cookies().get(name);
}
export async function hasCookie(name: string):Promise<boolean> {
return cookies().has(name)
}

View File

@ -0,0 +1,14 @@
'use server'
import { cookies } from 'next/headers'
export async function deleteCookie(name: string) {
cookies().delete(name)
}
export async function setCookie(name: string, value: string) {
cookies().set(name, value, {
sameSite: 'lax',
secure: false
})
}