Skip to content

Commit 8ce8597

Browse files
committed
feat: update demo organization flow
1 parent 7c83597 commit 8ce8597

14 files changed

Lines changed: 242 additions & 92 deletions

File tree

ui/dashboard/src/@locales/en/auth.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@
2828
"organization-name": "Organization name",
2929
"owner-email": "Owner email",
3030
"demo-agree-terms": "I agree to the Privacy Notice and consent to using my information as described above.",
31-
"privacy-notice": "Privacy Notice"
31+
"privacy-notice": "Privacy Notice",
32+
"demo-organization": "Demo Organization",
33+
"sign-in-title": "Sign In",
34+
"sign-in-to-bucketeer": "Sign in to Bucketeer",
35+
"sign-in-with-google": "Sign in with Google",
36+
"sign-in-with-email": "Sign in with Email"
3237
}

ui/dashboard/src/@locales/en/message.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@
5454
"empty-segment": "No segments found. Please <comp>create</comp> a segment first.",
5555
"demo-not-available": "The Demo feature is not available at the moment.",
5656
"demo-available": "Authenticate with Google and get started!",
57-
"demo-privacy-description": "We collect your name and email address to analyze demo usage, and we may contact you for feedback about Bucketeer.<br />We will not share your information with any third parties. For any questions or to delete your information, please contact us via Slack.",
58-
"required-agreement-terms": "Agreement to the Terms of Use and Privacy Policy is required to proceed."
57+
"demo-privacy-description": "We collect your name and email address to analyze demo usage, and we may contact you for feedback about Bucketeer.<br />We will not share your information with any third parties. For any questions or to delete your information, please contact us via <comp>Slack</comp>.",
58+
"required-agreement-terms": "The agreement to the Terms of Use and Privacy Policy is required to proceed."
5959
}

ui/dashboard/src/@locales/ja/auth.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@
2828
"organization-name": "組織名",
2929
"owner-email": "オーナーのメールアドレス",
3030
"demo-agree-terms": "上記のプライバシー通知を読み、内容に同意します。",
31-
"privacy-notice": "プライバシー通知"
31+
"privacy-notice": "プライバシー通知",
32+
"demo-organization": "デモ 組織",
33+
"sign-in-title": "サインイン",
34+
"sign-in-to-bucketeer": "Bucketeerにサインイン",
35+
"sign-in-with-google": "メールでサインイン",
36+
"sign-in-with-email": "Googleでサインイン"
3237
}

ui/dashboard/src/@locales/ja/message.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@
5454
"empty-segment": "セグメントがありません。先に<comp>作成</comp>してください。",
5555
"demo-not-available": "現在、デモ機能はご利用いただけません。",
5656
"demo-available": "Googleで認証してデモをスタート!",
57-
"demo-privacy-description": "デモの利用状況を分析し、必要に応じてBucketeerに関するご意見を伺うため、お名前とメールアドレスを収集しています。.<br />ご提供いただいた情報を第三者に共有することはありません。ご質問や情報の削除をご希望の場合は、Slackからご連絡ください",
58-
"required-agreement-terms": "続行するには、利用規約とプライバシーポリシーに同意する必要があります"
57+
"demo-privacy-description": "デモの利用状況を分析し、必要に応じてBucketeerに関するご意見を伺うため、お名前とメールアドレスを収集しています。.<br />ご提供いただいた情報を第三者に共有することはありません。ご質問や情報の削除をご希望の場合は、<comp>Slack</comp>からご連絡ください",
58+
"required-agreement-terms": "利用規約およびプライバシーポリシーへの同意が必要です"
5959
}

ui/dashboard/src/app/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import APIKeysPage from 'pages/api-keys';
6161
import AuditLogsPage from 'pages/audit-logs';
6262
import DebuggerPage from 'pages/debugger';
6363
import AccessDemoPage from 'pages/demo';
64+
import CreateDemoPage from 'pages/demo/demo-create';
6465
import MembersPage from 'pages/members';
6566
import NotFoundPage from 'pages/not-found';
6667
import NotificationsPage from 'pages/notifications';
@@ -115,6 +116,10 @@ function App() {
115116
element={<SignInEmailPage />}
116117
/>
117118
<Route path={PAGE_PATH_DEMO_SITE} element={<AccessDemoPage />} />
119+
<Route
120+
path={`${PAGE_PATH_DEMO_SITE}/new`}
121+
element={<CreateDemoPage />}
122+
/>
118123
<Route path={`${PAGE_PATH_ROOT}*`} element={<Root />} />
119124
</Routes>
120125
</AuthProvider>

ui/dashboard/src/assets/logos/logo-primary.svg

Lines changed: 10 additions & 23 deletions
Loading

ui/dashboard/src/auth/auth-demo-callback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const AuthDemoCallbackPage: FC = memo(() => {
2323
const response = await exchangeDemoToken(payload);
2424
if (response.demoCreationToken) {
2525
setDemoTokenStorage(response.demoCreationToken);
26-
navigate(PAGE_PATH_DEMO_SITE);
26+
navigate(`${PAGE_PATH_DEMO_SITE}/new`);
2727
}
2828
} catch (error) {
2929
setIsGoogleAuthError(true);

ui/dashboard/src/components/checkbox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ const Checkbox = forwardRef(
2929

3030
return (
3131
<div
32-
className={cn('flex w-fit items-center gap-x-2', {
32+
className={cn('flex w-fit items-start gap-x-2', {
3333
'w-full justify-between': isExpand,
3434
'flex-row-reverse': isReverse
3535
})}
3636
>
37-
<div className="flex-center size-5">
37+
<div className="flex-center size-5 mt-0.5">
3838
<CheckboxPrimitive.Root
3939
className={cn(
4040
'flex-center size-5 rounded border border-gray-500 transition-colors duration-200',
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { useEffect } from 'react';
2+
import { Trans } from 'react-i18next';
3+
import { Link, useNavigate } from 'react-router-dom';
4+
import { useQueryDemoSiteStatus } from '@queries/demo-site-status';
5+
import { PAGE_PATH_DEMO_SITE } from 'constants/routing';
6+
import { useTranslation } from 'i18n';
7+
import { getDemoTokenStorage } from 'storage/demo-token';
8+
import { IconBackspace } from '@icons';
9+
import AuthWrapper from 'pages/signin/elements/auth-wrapper';
10+
import Button from 'components/button';
11+
import Icon from 'components/icon';
12+
import DemoForm from './demo-form';
13+
14+
const CreateDemoPage = () => {
15+
const navigate = useNavigate();
16+
const { t } = useTranslation(['common', 'auth', 'message']);
17+
18+
const demoAuthToken = getDemoTokenStorage();
19+
const { data: demoSiteStatusData, isSuccess } = useQueryDemoSiteStatus();
20+
21+
const isDemoSiteEnabled = demoSiteStatusData?.isDemoSiteEnabled;
22+
23+
useEffect(() => {
24+
if (!demoAuthToken || (isSuccess && !isDemoSiteEnabled)) {
25+
navigate(PAGE_PATH_DEMO_SITE);
26+
}
27+
}, [isDemoSiteEnabled]);
28+
29+
return (
30+
<AuthWrapper>
31+
<div className="-mt-2">
32+
<Button
33+
variant="secondary-2"
34+
onClick={() => navigate(PAGE_PATH_DEMO_SITE)}
35+
className="p-2 h-auto"
36+
>
37+
<Icon icon={IconBackspace} size="sm" />
38+
</Button>
39+
<h1 className="text-gray-900 typo-head-bold-huge mt-8">
40+
{t('auth:demo-organization')}
41+
</h1>
42+
43+
<h3 className="text-gray-900 typo-head-light-medium mt-6">
44+
{t('auth:privacy-notice')}
45+
</h3>
46+
<div className="text-gray-600 typo-para-medium mt-2">
47+
<Trans
48+
i18nKey="message:demo-privacy-description"
49+
components={{
50+
comp: (
51+
<Link
52+
target="_blank"
53+
to={`https://app.slack.com/client/T08PSQ7BQ/C043026BME1`}
54+
className="text-primary-500 underline"
55+
/>
56+
)
57+
}}
58+
/>
59+
</div>
60+
<DemoForm isDemoSiteEnabled={isDemoSiteEnabled} />
61+
</div>
62+
</AuthWrapper>
63+
);
64+
};
65+
66+
export default CreateDemoPage;

ui/dashboard/src/pages/demo/demo-form.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Checkbox from 'components/checkbox';
1515
import Form from 'components/form';
1616
import Input from 'components/input';
1717

18-
interface AccessDemoForm {
18+
interface CreateDemoForm {
1919
organizationName: string;
2020
organizationUrlCode: string;
2121
isAgree: boolean;
@@ -39,13 +39,7 @@ const formSchema = ({ requiredMessage, translation }: FormSchemaProps) =>
3939
.required(requiredMessage)
4040
});
4141

42-
const DemoForm = ({
43-
isDemoSiteEnabled,
44-
onDemoAuthenticated
45-
}: {
46-
isDemoSiteEnabled?: boolean;
47-
onDemoAuthenticated: (v: boolean) => void;
48-
}) => {
42+
const DemoForm = ({ isDemoSiteEnabled }: { isDemoSiteEnabled?: boolean }) => {
4943
const { errorNotify, notify } = useToast();
5044
const navigate = useNavigate();
5145

@@ -65,7 +59,7 @@ const DemoForm = ({
6559
formState: { isDirty, isValid, isSubmitting }
6660
} = form;
6761

68-
const onSubmit: SubmitHandler<AccessDemoForm> = async values => {
62+
const onSubmit: SubmitHandler<CreateDemoForm> = async values => {
6963
try {
7064
const response = await organizationDemoCreator({
7165
name: values.organizationName,
@@ -84,7 +78,6 @@ const DemoForm = ({
8478
}
8579
} catch (error) {
8680
if ((error as AxiosError).status === 401) {
87-
onDemoAuthenticated(false);
8881
clearDemoTokenStorage();
8982
}
9083
errorNotify(error);

0 commit comments

Comments
 (0)