mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-21 14:04:03 +01:00
* feat: ✨ channel stats * chore: 🔧 add node resolver * chore: 🔧 add monitored time * chore: 🔧 and queries to front * fix: 🐛 floats to ints * chore: 🔧 add progress bars * chore: 🔧 add channel resolver * chore: 🔧 refactor forwards frontend * refactor: ♻️ channel resolvers * chore: 🔧 refactor channel queries * refactor: ♻️ peer resolver * refactor: ♻️ peer query * fix: 🐛 small changes * fix: 🐛 typo * chore: 🔧 stats view wip * chore: 🔧 add update script * chore: 🔧 improve ui * chore: 🔧 move buttons * fix: 🐛 home path * chore: 🔧 add public key to node resolver * refactor: ♻️ resume resolver * chore: 🔧 remove test account * chore: 🔧 change logger for lnpay * feat: ✨ github version Co-authored-by: apotdevin <apotdevincab@gmail.com>
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import * as React from 'react';
|
|
import { ThemeProvider } from 'styled-components';
|
|
import { ModalProvider, BaseModalBackground } from 'styled-react-modal';
|
|
import { useRouter } from 'next/router';
|
|
import { toast } from 'react-toastify';
|
|
import Head from 'next/head';
|
|
import { ContextProvider } from '../src/context/ContextProvider';
|
|
import { useConfigState, ConfigProvider } from '../src/context/ConfigContext';
|
|
import { GlobalStyles } from '../src/styles/GlobalStyle';
|
|
import { Header } from '../src/layouts/header/Header';
|
|
import { Footer } from '../src/layouts/footer/Footer';
|
|
import 'react-toastify/dist/ReactToastify.css';
|
|
import { PageWrapper, HeaderBodyWrapper } from '../src/layouts/Layout.styled';
|
|
import { parseCookies } from '../src/utils/cookies';
|
|
import 'react-circular-progressbar/dist/styles.css';
|
|
|
|
toast.configure({ draggable: false, pauseOnFocusLoss: false });
|
|
|
|
const Wrapper: React.FC = ({ children }) => {
|
|
const { theme } = useConfigState();
|
|
const { pathname } = useRouter();
|
|
|
|
const isRoot = pathname === '/';
|
|
|
|
return (
|
|
<ThemeProvider theme={{ mode: isRoot ? 'light' : theme }}>
|
|
<ModalProvider backgroundComponent={BaseModalBackground}>
|
|
<GlobalStyles />
|
|
<PageWrapper>
|
|
<HeaderBodyWrapper>
|
|
<Header />
|
|
{children}
|
|
</HeaderBodyWrapper>
|
|
<Footer />
|
|
</PageWrapper>
|
|
</ModalProvider>
|
|
</ThemeProvider>
|
|
);
|
|
};
|
|
|
|
const App = ({ Component, pageProps, initialConfig }: any) => (
|
|
<>
|
|
<Head>
|
|
<title>ThunderHub - Lightning Node Manager</title>
|
|
</Head>
|
|
<ConfigProvider initialConfig={initialConfig}>
|
|
<ContextProvider>
|
|
<Wrapper>
|
|
<Component {...pageProps} />
|
|
</Wrapper>
|
|
</ContextProvider>
|
|
</ConfigProvider>
|
|
</>
|
|
);
|
|
|
|
App.getInitialProps = async props => {
|
|
const cookies = parseCookies(props.ctx.req);
|
|
|
|
if (!cookies?.config) {
|
|
return { initialConfig: {} };
|
|
}
|
|
try {
|
|
const initialConfig = JSON.parse(cookies.config);
|
|
return { initialConfig };
|
|
} catch (error) {
|
|
return { initialConfig: {} };
|
|
}
|
|
};
|
|
|
|
export default App;
|