📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fats-fix (#380)
Maksim Mrug96cf58f26500
diff --git a/app/App.tsx b/app/App.tsxindex 5842b4756..68d332647 100644--- a/app/App.tsx+++ b/app/App.tsx@@ -107,7 +107,6 @@ const App: React.FC<IApp> = ({ ssrTheme, ssrAuthenticated }) => {&& !_endsWith(pathname, '/new')&& !_endsWith(pathname, '/subscribers/invite')&& !_endsWith(pathname, '/subscribers/invite')- && !_endsWith(pathname, '/password')&& !_includes(pathname, '/alerts/')&& !_includes(pathname, '/settings/')diff --git a/app/pages/Project/ProjectProtectedPassword/index.tsx b/app/pages/Project/ProjectProtectedPassword/index.tsxindex adbf0e352..54844012c 100644--- a/app/pages/Project/ProjectProtectedPassword/index.tsx+++ b/app/pages/Project/ProjectProtectedPassword/index.tsx@@ -12,6 +12,8 @@ import Button from 'ui/Button'import { checkPassword } from 'api'import { useDispatch } from 'react-redux'import UIActions from 'redux/reducers/ui'+import Header from 'components/Header'+import Footer from 'components/Footer'interface IProjectProtectedPasswordForm {password: string,@@ -19,7 +21,13 @@ interface IProjectProtectedPasswordForm {const MAX_PASSWORD_LENGTH = 80-const ProjectProtectedPassword = (): JSX.Element => {+const ProjectProtectedPassword = ({+ ssrTheme, embedded, isAuth,+}: {+ ssrTheme: "light" | "dark",+ embedded: boolean,+ isAuth: boolean+}): JSX.Element => {const { t }: {t: (key: string, optinions?: {[key: string]: string | number,@@ -33,7 +41,7 @@ const ProjectProtectedPassword = (): JSX.Element => {password?: string,}>({})const { id }: {- id: string+ id: string,} = useParams()const [beenSubmitted, setBeenSubmitted] = useState<boolean>(false)const [isLoading, setIsLoading] = useState<boolean>(false)@@ -73,7 +81,10 @@ const ProjectProtectedPassword = (): JSX.Element => {id,password: data.password,}))- navigate(_replace(routes.project, ':id', id))+ navigate({+ pathname: _replace(routes.project, ':id', id),+ search: `?embedded=${embedded}&theme=${ssrTheme}`,+ })}setErrors({password: t('apiNotifications.incorrectPassword'),@@ -114,32 +125,40 @@ const ProjectProtectedPassword = (): JSX.Element => {}return (- <div className='min-h-page bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>- <form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}>- <h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>- {t('titles.passwordProtected')}- </h2>- <Input- name='password'- id='password'- type='password'- label={t('auth.common.password')}- value={form.password}- placeholder={t('auth.common.password')}- className='mt-4'- onChange={handleInput}- error={beenSubmitted && errors.password}- />- <div className='mt-5'>- <Button className='mr-2 border-indigo-100 dark:text-gray-50 dark:border-slate-700/50 dark:bg-slate-800 dark:hover:bg-slate-700' onClick={onCancel} secondary regular>- {t('common.cancel')}- </Button>- <Button type='submit' loading={isLoading} primary regular>- {t('common.continue')}- </Button>- </div>- </form>- </div>+ <>+ {!embedded && (+ <Header ssrTheme={ssrTheme} authenticated={isAuth} />+ )}+ <div className='min-h-page bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>+ <form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}>+ <h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>+ {t('titles.passwordProtected')}+ </h2>+ <Input+ name='password'+ id='password'+ type='password'+ label={t('auth.common.password')}+ value={form.password}+ placeholder={t('auth.common.password')}+ className='mt-4'+ onChange={handleInput}+ error={beenSubmitted && errors.password}+ />+ <div className='mt-5'>+ <Button className='mr-2 border-indigo-100 dark:text-gray-50 dark:border-slate-700/50 dark:bg-slate-800 dark:hover:bg-slate-700' onClick={onCancel} secondary regular>+ {t('common.cancel')}+ </Button>+ <Button type='submit' loading={isLoading} primary regular>+ {t('common.continue')}+ </Button>+ </div>+ </form>+ </div>+ {!embedded && (+ <Footer authenticated={isAuth} minimal />+ )}+ </>)}diff --git a/app/pages/Project/View/ViewProject.tsx b/app/pages/Project/View/ViewProject.tsxindex e75d3181f..776f203c0 100644--- a/app/pages/Project/View/ViewProject.tsx+++ b/app/pages/Project/View/ViewProject.tsx@@ -690,12 +690,18 @@ const ViewProject = ({if (projectPassword) {checkPassword(id, projectPassword).then((res) => {if (res) {- navigate(_replace(routes.project, ':id', id))+ navigate({+ pathname: _replace(routes.project, ':id', id),+ search: `?theme=${ssrTheme}&embedded=${embedded}`,+ })return}showError(t('apiNotifications.incorrectPassword'))- navigate(_replace(routes.project_protected_password, ':id', id))+ navigate({+ pathname: _replace(routes.project_protected_password, ':id', id),+ search: `?theme=${ssrTheme}&embedded=${embedded}`,+ })removeItem(PROJECTS_PROTECTED)})return@@ -1886,7 +1892,10 @@ const ViewProject = ({}if (projectRes.isPasswordProtected && !projectRes.isOwner && _isEmpty(projectPassword)) {- navigate(_replace(routes.project_protected_password, ':id', id))+ navigate({+ pathname: _replace(routes.project_protected_password, ':id', id),+ search: `?theme=${ssrTheme}&embedded=${embedded}`,+ })return}diff --git a/app/routes/projects.$id.password.tsx b/app/routes/projects.$id.password.tsxindex c0c08700f..342dd693a 100644--- a/app/routes/projects.$id.password.tsx+++ b/app/routes/projects.$id.password.tsx@@ -1,5 +1,28 @@import ProjectProtectedPassword from 'pages/Project/ProjectProtectedPassword'+import type { LoaderArgs } from '@remix-run/node'+import { useLoaderData } from '@remix-run/react'+import { json } from '@remix-run/node'++import {+ detectTheme, isEmbedded, getProjectPassword, isAuthenticated,+} from 'utils/server'+++export async function loader({ request }: LoaderArgs) {+ const embedded = isEmbedded(request)+ const queryPassword = getProjectPassword(request)+ const [theme] = detectTheme(request)+ const isAuth = isAuthenticated(request)++ return json({+ theme, embedded, queryPassword, isAuth,+ })+}export default function Index() {- return <ProjectProtectedPassword />+ const {+ theme, embedded, isAuth,+ } = useLoaderData<typeof loader>()++ return <ProjectProtectedPassword ssrTheme={theme} embedded={embedded} isAuth={isAuth} />}