Skip to content

Commit 9b58d62

Browse files
tbrandtbrandaws
andauthored
Switching visibility of email (#1140)
Co-authored-by: Taichiro Suzuki <[email protected]>
1 parent 7b95838 commit 9b58d62

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

packages/web/public/locales/translation/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ setting:
728728
login_status: Login status
729729
rag_enabled: RAG (Amazon Kendra) Enabled
730730
rag_kb_enabled: RAG (Knowledge Base) Enabled
731+
show_email: Show Email
731732
show_tools: Show Tools
732733
show_use_case_builder: Show Use Case Builder
733734
typing_animation: Typing Animation

packages/web/public/locales/translation/ja.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ setting:
630630
login_status: ログイン状態
631631
rag_enabled: RAG (Amazon Kendra) 有効
632632
rag_kb_enabled: RAG (Knowledge Base) 有効
633+
show_email: メールアドレスの表示
633634
show_tools: ツールの表示
634635
show_use_case_builder: ユースケースビルダーの表示
635636
typing_animation: タイピングアニメーション

packages/web/src/components/DrawerBase.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import useVersion from '../hooks/useVersion';
66
import IconWithDot from './IconWithDot';
77
import { PiGear } from 'react-icons/pi';
88
import { fetchAuthSession } from 'aws-amplify/auth';
9+
import useUserSetting from '../hooks/useUserSetting';
910

1011
type Props = BaseProps & {
1112
builderMode?: boolean;
@@ -14,6 +15,7 @@ type Props = BaseProps & {
1415

1516
const DrawerBase: React.FC<Props> = (props) => {
1617
const { getHasUpdate } = useVersion();
18+
const { settingShowEmail } = useUserSetting();
1719

1820
// The first argument is not required, but if it is not included, the request will not be made, so 'user' string is entered
1921
const { data } = useSWR('user', () => {
@@ -36,12 +38,9 @@ const DrawerBase: React.FC<Props> = (props) => {
3638
className={`bg-aws-squid-ink flex h-screen w-64 flex-col justify-between text-sm text-white print:hidden`}>
3739
<div className="flex h-full flex-col">
3840
{props.children}
39-
<div className="flex flex-none items-center justify-between gap-2 border-t border-gray-400 px-3 py-2">
40-
<Link
41-
to={settingUrl}
42-
className="mr-2 overflow-x-hidden hover:brightness-75">
43-
<span className="text-sm">{email}</span>
44-
</Link>
41+
<div className="flex flex-none items-center justify-between gap-x-2 border-t border-gray-400 px-3 py-2">
42+
{settingShowEmail && <div className="text-sm">{email}</div>}
43+
<div></div>
4544
<Link to={settingUrl}>
4645
<IconWithDot showDot={hasUpdate}>
4746
<PiGear className="text-lg" />

packages/web/src/hooks/useUserSetting.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const useUserSetting = () => {
99
'showTools',
1010
true
1111
);
12+
const [settingShowEmail, setSettingShowEmail] = useLocalStorageBoolean(
13+
'showEmail',
14+
true
15+
);
1216

1317
return {
1418
settingTypingAnimation,
@@ -17,6 +21,8 @@ const useUserSetting = () => {
1721
setSettingShowUseCaseBuilder,
1822
settingShowTools,
1923
setSettingShowTools,
24+
settingShowEmail,
25+
setSettingShowEmail,
2026
};
2127
};
2228

packages/web/src/pages/Setting.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ const Setting = () => {
6363
setSettingShowUseCaseBuilder,
6464
settingShowTools,
6565
setSettingShowTools,
66+
settingShowEmail,
67+
setSettingShowEmail,
6668
} = useUserSetting();
6769

6870
const onClickSignout = useCallback(() => {
@@ -145,6 +147,16 @@ const Setting = () => {
145147
/>
146148
}></SettingItem>
147149

150+
<SettingItem
151+
name={t('setting.items.show_email')}
152+
value={
153+
<Switch
154+
checked={settingShowEmail}
155+
label=""
156+
onSwitch={setSettingShowEmail}
157+
/>
158+
}></SettingItem>
159+
148160
<SettingItem
149161
name={t('setting.items.login_status')}
150162
value={

0 commit comments

Comments
 (0)