v0.2/code-improvements #63

Merged
lamacchinadesiderante merged 3 commits from v0.2/code-improvements into develop 2024-05-11 12:20:56 +00:00
4 changed files with 70 additions and 33 deletions
Showing only changes of commit aa86a71dc6 - Show all commits

View File

@ -1,8 +1,11 @@
'use client'
import "@/styles/globals.scss" import "@/styles/globals.scss"
import ReduxProvider from "@/store/redux-provider"; import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'ProxyRaye',
description: 'Watch porn videos without tracking or annoying ads!',
}
export default function RootLayout({ export default function RootLayout({
children, children,
@ -14,9 +17,7 @@ export default function RootLayout({
return ( return (
<> <>
<ReduxProvider>
{children} {children}
</ReduxProvider>
</> </>
); );
} }

View File

@ -0,0 +1,38 @@
'use client'
import React from 'react';
import Head from 'next/head';
import { AppProgressBar as ProgressBar } from 'next-nprogress-bar';
import { useAppSelector } from '@/store/store';
import { LAYOUT_COLORS_PINK, LAYOUT_COLORS_YELLOW } from '@/constants/colors';
import { Themes } from '@/meta/settings';
const Content: React.FC<React.PropsWithChildren> = (props) => {
const { children } = props;
const theme = useAppSelector((state) => state.settings.theme);
return (
<html data-theme={theme} /*lang={locale}*/>
<Head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<body>
<main className="container">{children}</main>
<ProgressBar
height="4px"
color={theme == Themes.dark ? LAYOUT_COLORS_YELLOW : LAYOUT_COLORS_PINK}
options={{ showSpinner: false }}
shallowRouting
/>
</body>
</html>
);
};
export default Content;

View File

@ -1,38 +1,18 @@
'use client'
import React from 'react'; import React from 'react';
import Head from 'next/head'; import WithRedux from '@/store/withRedux';
import Content from './Content';
import { AppProgressBar as ProgressBar } from 'next-nprogress-bar';
import { useAppSelector } from '@/store/store';
import { LAYOUT_COLORS_PINK, LAYOUT_COLORS_YELLOW } from '@/constants/colors';
import { Themes } from '@/meta/settings';
const Layout: React.FC<React.PropsWithChildren> = (props) => { const Layout: React.FC<React.PropsWithChildren> = (props) => {
const { children } = props; const { children } = props;
const theme = useAppSelector((state) => state.settings.theme);
return ( return (
<html data-theme={theme} /*lang={locale}*/> <WithRedux>
<Head> <Content>
<meta charSet="utf-8" /> {children}
<meta name="viewport" content="width=device-width, initial-scale=1" /> </Content>
<title>Proxy Raye: watch porn videos without tracking or annoying ads!</title> </WithRedux>
</Head>
<body>
<main className="container">{children}</main>
<ProgressBar
height="4px"
color={theme == Themes.dark ? LAYOUT_COLORS_YELLOW : LAYOUT_COLORS_PINK }
options={{ showSpinner: false }}
shallowRouting
/>
</body>
</html>
); );
}; };

18
src/store/withRedux.tsx Normal file
View File

@ -0,0 +1,18 @@
'use client'
import ReduxProvider from "@/store/redux-provider";
export default function WithRedux({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<>
<ReduxProvider>
{children}
</ReduxProvider>
</>
);
}