mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
checkpoint
This commit is contained in:
parent
db1ae3f2c7
commit
9e8748e2f3
@ -14,7 +14,7 @@ import useUser from 'hooks/useUser';
|
||||
import Logo from 'assets/logo.svg';
|
||||
import styles from './Header.module.css';
|
||||
|
||||
export default function Header({ settingsDisabled }) {
|
||||
export default function Header() {
|
||||
const { user } = useUser();
|
||||
const { pathname } = useRouter();
|
||||
const { updatesDisabled } = useConfig();
|
||||
@ -38,7 +38,7 @@ export default function Header({ settingsDisabled }) {
|
||||
<Link href="/realtime">
|
||||
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
|
||||
</Link>
|
||||
{!settingsDisabled && (
|
||||
{!process.env.isCloudMode && (
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
@ -48,7 +48,7 @@ export default function Header({ settingsDisabled }) {
|
||||
<div className={styles.buttons}>
|
||||
<ThemeButton />
|
||||
<LanguageButton menuAlign="right" />
|
||||
{user && <UserButton settingsDisabled={settingsDisabled} />}
|
||||
{user && <UserButton />}
|
||||
</div>
|
||||
</header>
|
||||
</>
|
||||
|
@ -4,13 +4,7 @@ import Header from 'components/layout/Header';
|
||||
import Footer from 'components/layout/Footer';
|
||||
import useLocale from 'hooks/useLocale';
|
||||
|
||||
export default function Layout({
|
||||
title,
|
||||
children,
|
||||
header = true,
|
||||
footer = true,
|
||||
settingsDisabled = false,
|
||||
}) {
|
||||
export default function Layout({ title, children, header = true, footer = true }) {
|
||||
const { dir } = useLocale();
|
||||
|
||||
return (
|
||||
@ -19,7 +13,7 @@ export default function Layout({
|
||||
<title>umami{title && ` - ${title}`}</title>
|
||||
</Head>
|
||||
|
||||
{header && <Header settingsDisabled={settingsDisabled} />}
|
||||
{header && <Header />}
|
||||
<main>{children}</main>
|
||||
{footer && <Footer />}
|
||||
<div id="__modals" dir={dir} />
|
||||
|
@ -9,7 +9,7 @@ import styles from './UserButton.module.css';
|
||||
import { AUTH_TOKEN } from 'lib/constants';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
export default function UserButton({ settingsDisabled }) {
|
||||
export default function UserButton() {
|
||||
const { user } = useUser();
|
||||
const router = useRouter();
|
||||
|
||||
@ -28,7 +28,7 @@ export default function UserButton({ settingsDisabled }) {
|
||||
{
|
||||
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
|
||||
value: 'profile',
|
||||
hidden: settingsDisabled,
|
||||
hidden: process.env.isCloudMode,
|
||||
},
|
||||
{ label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' },
|
||||
];
|
||||
|
@ -36,6 +36,7 @@ module.exports = {
|
||||
env: {
|
||||
currentVersion: pkg.version,
|
||||
isProduction: process.env.NODE_ENV === 'production',
|
||||
isCloudMode: process.env.CLOUD_MODE,
|
||||
},
|
||||
basePath: process.env.BASE_PATH,
|
||||
output: 'standalone',
|
||||
|
12
pages/404.js
12
pages/404.js
@ -2,9 +2,9 @@ import React from 'react';
|
||||
import Layout from 'components/layout/Layout';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
export default function Custom404({ settingsDisabled }) {
|
||||
export default function Custom404() {
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<div className="row justify-content-center">
|
||||
<h1>
|
||||
<FormattedMessage id="message.page-not-found" defaultMessage="Page not found" />
|
||||
@ -13,11 +13,3 @@ export default function Custom404({ settingsDisabled }) {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import TestConsole from 'components/pages/TestConsole';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
import useUser from 'hooks/useUser';
|
||||
|
||||
export default function ConsolePage({ enabled, settingsDisabled }) {
|
||||
export default function ConsolePage({ enabled }) {
|
||||
const { loading } = useRequireLogin();
|
||||
const { user } = useUser();
|
||||
|
||||
@ -13,14 +13,8 @@ export default function ConsolePage({ enabled, settingsDisabled }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<TestConsole />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: { enabled: !!process.env.ENABLE_TEST_CONSOLE },
|
||||
};
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import Layout from 'components/layout/Layout';
|
||||
import Dashboard from 'components/pages/Dashboard';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
|
||||
export default function DashboardPage({ settingsDisabled }) {
|
||||
export default function DashboardPage() {
|
||||
const { loading } = useRequireLogin();
|
||||
|
||||
if (loading) {
|
||||
@ -11,16 +11,8 @@ export default function DashboardPage({ settingsDisabled }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<Dashboard />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ export default function LoginPage({ loginDisabled }) {
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN || process.env.CLOUD_MODE },
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN || process.env.isCloudMode },
|
||||
};
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import Layout from 'components/layout/Layout';
|
||||
import RealtimeDashboard from 'components/pages/RealtimeDashboard';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
|
||||
export default function RealtimePage({ settingsDisabled }) {
|
||||
export default function RealtimePage() {
|
||||
const { loading } = useRequireLogin();
|
||||
|
||||
if (loading) {
|
||||
@ -11,16 +11,8 @@ export default function RealtimePage({ settingsDisabled }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<RealtimeDashboard />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,11 +1,3 @@
|
||||
import Index from './index';
|
||||
|
||||
export default Index;
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -3,26 +3,16 @@ import Layout from 'components/layout/Layout';
|
||||
import Settings from 'components/pages/Settings';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
|
||||
export default function SettingsPage({ settingsDisabled }) {
|
||||
export default function SettingsPage() {
|
||||
const { loading } = useRequireLogin();
|
||||
|
||||
if (settingsDisabled || loading) {
|
||||
if (process.env.isCloudMode || loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
TEST TEST TEST
|
||||
{settingsDisabled}
|
||||
<Layout>
|
||||
<Settings />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,11 +1,3 @@
|
||||
import Index from './index';
|
||||
|
||||
export default Index;
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import Layout from 'components/layout/Layout';
|
||||
import WebsiteDetails from 'components/pages/WebsiteDetails';
|
||||
import useShareToken from 'hooks/useShareToken';
|
||||
|
||||
export default function SharePage({ settingsDisabled }) {
|
||||
export default function SharePage() {
|
||||
const router = useRouter();
|
||||
const { id } = router.query;
|
||||
const shareId = id?.[0];
|
||||
@ -17,16 +17,8 @@ export default function SharePage({ settingsDisabled }) {
|
||||
const { websiteId } = shareToken;
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<WebsiteDetails websiteId={websiteId} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import Layout from 'components/layout/Layout';
|
||||
import WebsiteDetails from 'components/pages/WebsiteDetails';
|
||||
import useRequireLogin from 'hooks/useRequireLogin';
|
||||
|
||||
export default function DetailsPage({ settingsDisabled }) {
|
||||
export default function DetailsPage() {
|
||||
const { loading } = useRequireLogin();
|
||||
const router = useRouter();
|
||||
const { id } = router.query;
|
||||
@ -16,16 +16,8 @@ export default function DetailsPage({ settingsDisabled }) {
|
||||
const [websiteId] = id;
|
||||
|
||||
return (
|
||||
<Layout settingsDisabled={settingsDisabled}>
|
||||
<Layout>
|
||||
<WebsiteDetails websiteId={websiteId} />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
settingsDisabled: !!process.env.CLOUD_MODE,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user