feat: demo page switch
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
const Config = {
|
||||
apiServer: process.env.NEXT_PUBLIC_BACKEND_ORIGIN || 'http://localhost:8001',
|
||||
|
||||
// set 'NEXT_PUBLIC_IS_DEMO=true' in frontend/.env
|
||||
isDemoSite: process.env.NEXT_PUBLIC_IS_DEMO === 'true' || false,
|
||||
};
|
||||
|
||||
export default Config;
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
"email_not_exist": "Email address not found",
|
||||
"signup_error": "Sign up failed",
|
||||
"signin_error": "Sign in failed",
|
||||
"demo_page_warning": "This is a demo environment, any data you enter will be reset periodically.",
|
||||
"your_projects": "Your Projects",
|
||||
"public": "Public",
|
||||
"private": "Private",
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"email_not_exist": "メールアドレスが見つかりません",
|
||||
"signup_error": "新規登録に失敗しました",
|
||||
"signin_error": "サインインに失敗しました",
|
||||
"demo_page_warning": "これはデモ環境です。入力したデータは定期的にリセットされます。",
|
||||
"your_projects": "保有プロジェクト",
|
||||
"public": "パブリック",
|
||||
"private": "プライベート",
|
||||
|
||||
@@ -10,6 +10,8 @@ import { signUp, signIn, signInAsGuest } from './authControl';
|
||||
import { isValidEmail, isValidPassword } from './validate';
|
||||
import { TokenContext } from '@/utils/TokenProvider';
|
||||
import { useRouter } from '@/src/navigation';
|
||||
import Config from '@/config/config';
|
||||
const isDemoSite = Config.isDemoSite;
|
||||
|
||||
type Props = {
|
||||
isSignup: Boolean;
|
||||
@@ -166,11 +168,14 @@ export default function AuthPage({ isSignup, messages, locale }: Props) {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{isDemoSite && <div className="my-3 text-default-600">{messages.demoPageWarning}</div>}
|
||||
|
||||
<div className="flex justify-end items-center mt-3">
|
||||
<Button color="primary" onPress={validate}>
|
||||
{messages.submitTitle}
|
||||
</Button>
|
||||
{!isSignup && (
|
||||
{!isSignup && isDemoSite && (
|
||||
<Button
|
||||
className="ms-3 bg-gradient-to-tr from-pink-500 to-yellow-500 text-white shadow-lg"
|
||||
onPress={handleSignInAsGuest}
|
||||
|
||||
@@ -20,6 +20,7 @@ export default function Page(params: { locale: string }) {
|
||||
emailNotExist: t('email_not_exist'),
|
||||
signupError: t('signup_error'),
|
||||
signinError: t('signin_error'),
|
||||
demoPageWarning: t('demo_page_warning'),
|
||||
};
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -7,6 +7,7 @@ export default function Page(params: { locale: string }) {
|
||||
title: t('signup'),
|
||||
linkTitle: t('or_signin'),
|
||||
submitTitle: t('signup'),
|
||||
signInAsGuest: t('signin_as_guest'),
|
||||
email: t('email'),
|
||||
username: t('username'),
|
||||
password: t('password'),
|
||||
@@ -19,6 +20,7 @@ export default function Page(params: { locale: string }) {
|
||||
emailNotExist: t('email_not_exist'),
|
||||
signupError: t('signup_error'),
|
||||
signinError: t('signin_error'),
|
||||
demoPageWarning: t('demo_page_warning'),
|
||||
};
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -61,6 +61,7 @@ export type AuthMessages = {
|
||||
emailNotExist: string;
|
||||
signupError: string;
|
||||
signinError: string;
|
||||
demoPageWarning: string;
|
||||
};
|
||||
|
||||
export type AdminMessages = {
|
||||
|
||||
Reference in New Issue
Block a user