Skip to content

Commit 9b31af2

Browse files
authored
Merge pull request #10 from HirotoShioi/small-fix
SIgnin sign out toast
2 parents fc01d5f + 5785aae commit 9b31af2

File tree

6 files changed

+53
-24
lines changed

6 files changed

+53
-24
lines changed

apps/frontend/public/locales/en/translation.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"auth": {
3+
"signedOut": "Signed out",
4+
"signedOutDescription": "You have been signed out",
5+
"signedIn": "Signed in",
6+
"signedInDescription": "You have been signed in"
7+
},
28
"settings": {
39
"title": "Settings",
410
"deleteDatabase": "Delete Database",

apps/frontend/public/locales/ja/translation.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"auth": {
3+
"signedOut": "サインアウトしました",
4+
"signedOutDescription": "サインアウトしました",
5+
"signedIn": "サインインしました",
6+
"signedInDescription": "サインインしました"
7+
},
28
"settings": {
39
"title": "設定",
410
"deleteDatabase": "データベースを削除",

apps/frontend/src/App.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
createBrowserRouter,
3-
redirect,
4-
RouterProvider,
5-
} from "react-router";
1+
import { createBrowserRouter, redirect, RouterProvider } from "react-router";
62
import ErrorPage from "@/pages/error-page";
73
import Root from "@/routes/root";
84
import Providers from "@/providers/providers";
@@ -16,6 +12,9 @@ import { fetchAuthSession } from "aws-amplify/auth";
1612
import EditTemplatePage from "./pages/edit-template/page";
1713
import AgentPage from "./pages/agent/page";
1814
import PolicyPage from "./pages/policy/page";
15+
import { TooltipProvider } from "@radix-ui/react-tooltip";
16+
import { AlertProvider } from "./components/alert";
17+
import { Toaster } from "./components/ui/toaster";
1918

2019
async function redirectIfAuthenticated() {
2120
const session = await fetchAuthSession();
@@ -83,7 +82,12 @@ const router = createBrowserRouter([
8382
export default function App() {
8483
return (
8584
<Providers>
86-
<RouterProvider router={router} />
85+
<TooltipProvider delayDuration={0}>
86+
<AlertProvider>
87+
<RouterProvider router={router} />
88+
<Toaster />
89+
</AlertProvider>
90+
</TooltipProvider>
8791
</Providers>
8892
);
8993
}

apps/frontend/src/pages/chat/components/chat-message.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ function ChatMessage({ message }: ChatMessageProps) {
5959
<div className="md:max-w-3xl xl:max-w-[48rem]">
6060
<div className="flex text-center w-full">
6161
<div className="w-full p-4">
62-
{message.toolInvocations.map((toolInvocation, index) => {
63-
return (
64-
<ToolMessage key={index} toolInvocation={toolInvocation} />
65-
);
66-
})}
62+
{message.toolInvocations
63+
.slice(0, 1)
64+
.map((toolInvocation, index) => {
65+
return (
66+
<ToolMessage key={index} toolInvocation={toolInvocation} />
67+
);
68+
})}
6769
</div>
6870
</div>
6971
</div>

apps/frontend/src/routes/root.tsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1-
import { AlertProvider } from "@/components/alert";
2-
import { Toaster } from "@/components/ui/toaster";
3-
import { TooltipProvider } from "@/components/ui/tooltip";
1+
import { useToast } from "@/hooks/use-toast";
42
import { Hub } from "aws-amplify/utils";
53
import { useEffect } from "react";
4+
import { useTranslation } from "react-i18next";
65
import { Outlet, useNavigate } from "react-router";
76

87
export default function Root() {
98
const navigate = useNavigate();
9+
const { toast } = useToast();
10+
const { t } = useTranslation();
1011
useEffect(() => {
1112
Hub.listen("auth", (data) => {
1213
if (data.payload.event === "signedOut") {
14+
toast({
15+
title: t("auth.signedOut"),
16+
description: t("auth.signedOutDescription"),
17+
});
1318
navigate("/");
1419
}
1520
if (data.payload.event === "signedIn") {
21+
toast({
22+
title: t("auth.signedIn"),
23+
description: t("auth.signedInDescription"),
24+
});
1625
navigate("/");
1726
}
1827
});
19-
}, [navigate]);
28+
}, [navigate, toast, t]);
2029
return (
2130
<div className=" min-h-screen">
22-
<TooltipProvider delayDuration={0}>
23-
<AlertProvider>
24-
<Outlet />
25-
<Toaster />
26-
</AlertProvider>
27-
</TooltipProvider>
31+
<Outlet />
2832
</div>
2933
);
3034
}

infra/aws/cognito.tf

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ resource "aws_cognito_user_pool" "this" {
66
email_sending_account = "COGNITO_DEFAULT"
77
}
88
username_attributes = ["email"]
9-
admin_create_user_config {
10-
allow_admin_create_user_only = true
11-
}
9+
1210
password_policy {
1311
temporary_password_validity_days = 7
1412
minimum_length = 8
@@ -17,6 +15,15 @@ resource "aws_cognito_user_pool" "this" {
1715
require_symbols = true
1816
require_uppercase = true
1917
}
18+
admin_create_user_config {
19+
allow_admin_create_user_only = true
20+
21+
invite_message_template {
22+
email_subject = "【Medical Assistant】アカウント招待のお知らせ"
23+
email_message = "<html><body style='font-family: sans-serif; padding: 20px; color: #333;'><h2 style='color: #2c5282;'>Medical Assistant へようこそ</h2><p>Medical Assistantをご利用いただき、ありがとうございます。</p><p>仮パスワードが発行されましたので、以下の情報でログインをお願いいたします。</p><div style='background: #f7fafc; padding: 15px; border-radius: 5px; margin: 20px 0;'><p><strong>ログインURL:</strong><br><a href='https://medical-assistant.pages.dev/sign-in'>https://medical-assistant.pages.dev/sign-in</a></p><p><strong>メールアドレス:</strong><br>{username}</p><p><strong>パスワード:</strong><br>{####}</p></div><p style='color: #e53e3e;'>※初回ログイン時にパスワードの変更が必要です。</p></body></html>"
24+
sms_message = "Username: {username}\nYour verification code is {####}"
25+
}
26+
}
2027
}
2128

2229
resource "aws_cognito_user_pool_client" "this" {

0 commit comments

Comments
 (0)