add redux middleware and metadata

This commit is contained in:
La macchina desiderante 2024-05-11 13:59:01 +02:00
parent 4d083a14b0
commit aa86a71dc6
4 changed files with 70 additions and 33 deletions

View File

@ -1,8 +1,11 @@
'use client'
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({
children,
@ -14,9 +17,7 @@ export default function RootLayout({
return (
<>
<ReduxProvider>
{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 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';
import WithRedux from '@/store/withRedux';
import Content from './Content';
const Layout: 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" />
<title>Proxy Raye: watch porn videos without tracking or annoying ads!</title>
</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>
<WithRedux>
<Content>
{children}
</Content>
</WithRedux>
);
};

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>
</>
);
}