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