mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 01:46:58 +01:00
Moved SettingsProvider to root Providers component.
This commit is contained in:
parent
92a513e4d0
commit
44e243ad12
@ -4,7 +4,6 @@ import useUser from 'components/hooks/useUser';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import SideNav from 'components/layout/SideNav';
|
||||
import styles from './layout.module.css';
|
||||
import SettingsContext from './SettingsContext';
|
||||
|
||||
export default function SettingsLayout({ children }) {
|
||||
const { user } = useUser();
|
||||
@ -25,25 +24,14 @@ export default function SettingsLayout({ children }) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const hostUrl = process.env.hostUrl || location.origin;
|
||||
|
||||
const config = {
|
||||
settingsUrl: '/settings/websites',
|
||||
shareUrl: hostUrl,
|
||||
trackingCodeUrl: hostUrl,
|
||||
websitesUrl: `/websites`,
|
||||
};
|
||||
|
||||
return (
|
||||
<SettingsContext.Provider value={config}>
|
||||
<div className={styles.layout}>
|
||||
{!cloudMode && (
|
||||
<div className={styles.menu}>
|
||||
<SideNav items={items} shallow={true} selectedKey={getKey()} />
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>
|
||||
</SettingsContext.Provider>
|
||||
<div className={styles.layout}>
|
||||
{!cloudMode && (
|
||||
<div className={styles.menu}>
|
||||
<SideNav items={items} shallow={true} selectedKey={getKey()} />
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export function Realtime({ websiteId }) {
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
.reduce((arr, { country }) => {
|
||||
.reduce((arr: { x: any; y: number }[], { country }: any) => {
|
||||
if (country) {
|
||||
const row = arr.find(({ x }) => x === country);
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { IntlProvider } from 'react-intl';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ReactBasicsProvider } from 'react-basics';
|
||||
import ErrorBoundary from 'components/common/ErrorBoundary';
|
||||
import SettingsContext from 'app/(main)/settings/SettingsContext';
|
||||
import useLocale from 'components/hooks/useLocale';
|
||||
import 'chartjs-adapter-date-fns';
|
||||
|
||||
@ -24,14 +25,29 @@ function MessagesProvider({ children }) {
|
||||
);
|
||||
}
|
||||
|
||||
function SettingsProvider({ children }) {
|
||||
const hostUrl = process.env.hostUrl || location.origin;
|
||||
|
||||
const config = {
|
||||
settingsUrl: '/settings/websites',
|
||||
shareUrl: hostUrl,
|
||||
trackingCodeUrl: hostUrl,
|
||||
websitesUrl: `/websites`,
|
||||
};
|
||||
|
||||
return <SettingsContext.Provider value={config}>{children}</SettingsContext.Provider>;
|
||||
}
|
||||
|
||||
export function Providers({ children }) {
|
||||
return (
|
||||
<MessagesProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ReactBasicsProvider>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</ReactBasicsProvider>
|
||||
</QueryClientProvider>
|
||||
<SettingsProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ReactBasicsProvider>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</ReactBasicsProvider>
|
||||
</QueryClientProvider>
|
||||
</SettingsProvider>
|
||||
</MessagesProvider>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user