Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force show update notification modal & fix login page text #3512

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/web/i18n/en/account_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"avatar_selection_exception": "Abnormal avatar selection",
"balance": "balance",
"billing_standard": "Standards",
"bind_notification_error": "Abnormal binding notification account",
"bind_notification_hint": "Please bind the notification receiving account to ensure that you can normally receive notifications such as package expiration reminders and ensure the normal operation of your services.",
"bind_notification_success": "Binding notification account successful",
"cancel": "Cancel",
"change": "change",
"choose_avatar": "Click to select avatar",
Expand Down Expand Up @@ -40,7 +37,6 @@
"month": "moon",
"new_password": "New Password",
"notification_receiving": "Notify",
"notification_receiving_hint": "Notification reception",
"old_password": "Old Password",
"openai_account_configuration": "OpenAI account configuration",
"openai_account_setting_exception": "Setting OpenAI account exception",
Expand Down
8 changes: 7 additions & 1 deletion packages/web/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,12 @@
"support.user.User self info": "Profile",
"support.user.auth.Sending Code": "Sending Code",
"support.user.captcha_placeholder": "Please enter the verification code",
"support.user.info.notification_receiving_hint": "Notification reception",
"support.user.info.bind_notification_hint": "Please bind the notification receiving account to ensure that you can receive notifications such as package expiration reminders, etc., to ensure the normal operation of your service.",
"support.user.info.verification_code": "Verification Code",
"support.user.info.code_required": "Verification code cannot be empty",
"support.user.info.bind_notification_error": "Abnormal binding notification account",
"support.user.info.bind_notification_success": "Binding notification account successful",
"support.user.inform.System message": "System Message",
"support.user.login.Email": "Email",
"support.user.login.Github": "GitHub Login",
Expand All @@ -1047,7 +1053,7 @@
"support.user.login.Provider error": "Login Error, Please Try Again",
"support.user.login.Username": "Username",
"support.user.login.Wechat": "WeChat Login",
"support.user.login.can_not_login": "Cannot Log In, Click to Contact",
"support.user.login.can_not_login": "Cannot log in? Click here to contact us",
"support.user.login.error": "Login Error",
"support.user.login.security_failed": "Security Verification Failed",
"support.user.login.wx_qr_login": "WeChat QR Code Login",
Expand Down
14 changes: 7 additions & 7 deletions packages/web/i18n/en/login.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"Chinese_ip_tip": "It is detected that you are a mainland Chinese IP, click to jump to visit the mainland China version.",
"Login": "Login",
"agree": "agree",
"cookies_tip": " This website uses cookies to provide a better service experience. By continuing to use the site, you agree to our Cookie Policy.",
"forget_password": "Find password",
"forget_password": "Find Password",
"login_failed": "Login failed",
"login_success": "Login successful",
"no_remind": "Don't remind again",
"password_condition": "Password maximum 60 characters",
"password_tip": "Password must be at least 6 characters long and contain at least two combinations: numbers, letters, or special characters",
"policy_tip": "By useing, you agree to our",
"privacy": "Privacy policy",
"privacy_policy": "Privacy Policy",
"policy_tip": "By using this service, you agree to our",
"privacy": "Privacy Policy",
"redirect": "Jump",
"register": "Register",
"root_password_placeholder": "The root user password is the value of the environment variable DEFAULT_ROOT_PSW",
"terms": "Terms",
"use_root_login": "Log in as root user"
"use_root_login": "Log in as root user",
"agree": "agree",
"cookies_tip": " This website uses cookies to provide a better service experience. By continuing to use the site, you agree to our Cookie Policy.",
"privacy_policy": "Privacy Policy"
}
3 changes: 1 addition & 2 deletions packages/web/i18n/en/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"login.Dingtalk": "DingTalk Login",
"manage_team": "Manage team",
"name": "Name",
"notification.Bind Notification Pipe Hint": "Please bind a notification receiving account to ensure you receive notifications such as plan expiration reminders, ensuring your service runs smoothly.",
"notification.remind_owner_bind": "Please remind the creator to bind a notification account",
"operations": "Actions",
"owner": "owner",
Expand Down Expand Up @@ -67,7 +66,7 @@
"register.confirm": "Confirm Registration",
"register.register_account": "Register {{account}} Account",
"register.success": "Registration Successful",
"register.to_login": "Already have an account? Login",
"register.to_login": "Already have an account? Go to Login",
"search_user": "Search Username",
"sso_auth_failed": "SSO authentication failed",
"synchronization.button": "Sync Now",
Expand Down
4 changes: 0 additions & 4 deletions packages/web/i18n/zh-CN/account_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"avatar_selection_exception": "头像选择异常",
"balance": "余额",
"billing_standard": "计费标准",
"bind_notification_error": "绑定通知账号异常",
"bind_notification_hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。",
"bind_notification_success": "绑定通知账号成功",
"cancel": "取消",
"change": "变更",
"choose_avatar": "点击选择头像",
Expand Down Expand Up @@ -40,7 +37,6 @@
"month": "月",
"new_password": "新密码",
"notification_receiving": "通知接收",
"notification_receiving_hint": "通知接收",
"old_password": "旧密码",
"package_and_usage": "套餐与用量",
"package_details": "套餐详情",
Expand Down
6 changes: 6 additions & 0 deletions packages/web/i18n/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,12 @@
"support.user.auth.Sending Code": "正在发送",
"support.user.captcha_placeholder": "请输入验证码",
"support.user.inform.System message": "系统消息",
"support.user.info.notification_receiving_hint": "通知接收",
"support.user.info.bind_notification_hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。",
"support.user.info.verification_code": "验证码",
"support.user.info.code_required": "验证码不能为空",
"support.user.info.bind_notification_success": "绑定通知账号成功",
"support.user.info.bind_notification_error": "绑定通知账号异常",
"support.user.login.Email": "邮箱",
"support.user.login.Github": "GitHub 登录",
"support.user.login.Google": "Google 登录",
Expand Down
1 change: 0 additions & 1 deletion packages/web/i18n/zh-CN/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"login.Dingtalk": "钉钉登录",
"manage_team": "管理团队",
"name": "名称",
"notification.Bind Notification Pipe Hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。",
"notification.remind_owner_bind": "请提醒创建者绑定通知账号",
"operations": "操作",
"owner": "所有者",
Expand Down
4 changes: 0 additions & 4 deletions packages/web/i18n/zh-Hant/account_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"avatar_selection_exception": "頭像選擇異常",
"balance": "餘額",
"billing_standard": "計費標準",
"bind_notification_error": "綁定通知帳號異常",
"bind_notification_hint": "請綁定通知接收帳號,確保您能正常接收套餐過期提醒等通知,保障您的服務正常運作。",
"bind_notification_success": "綁定通知帳號成功",
"cancel": "取消",
"change": "變更",
"choose_avatar": "點選選擇頭像",
Expand Down Expand Up @@ -40,7 +37,6 @@
"month": "月",
"new_password": "新密碼",
"notification_receiving": "通知接收",
"notification_receiving_hint": "通知接收",
"old_password": "舊密碼",
"openai_account_configuration": "OpenAI 帳號配置",
"openai_account_setting_exception": "設定 OpenAI 帳號異常",
Expand Down
6 changes: 6 additions & 0 deletions packages/web/i18n/zh-Hant/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,12 @@
"support.user.auth.Sending Code": "正在傳送驗證碼",
"support.user.captcha_placeholder": "請輸入驗證碼",
"support.user.inform.System message": "系統訊息",
"support.user.info.notification_receiving_hint": "通知接收",
"support.user.info.bind_notification_hint": "請綁定通知接收帳號,確保您能正常接收套餐過期提醒等通知,保障您的服務正常運作。",
"support.user.info.verification_code": "驗證碼",
"support.user.info.code_required": "驗證碼不能為空",
"support.user.info.bind_notification_success": "綁定通知帳號成功",
"support.user.info.bind_notification_error": "綁定通知帳號異常",
"support.user.login.Email": "電子郵件",
"support.user.login.Github": "GitHub 登入",
"support.user.login.Google": "Google 登入",
Expand Down
1 change: 0 additions & 1 deletion packages/web/i18n/zh-Hant/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"login.Dingtalk": "釘釘登入",
"manage_team": "管理團隊",
"name": "名稱",
"notification.Bind Notification Pipe Hint": "請綁定通知接收帳號,以確保您能正常接收方案到期提醒等通知,保障您的服務正常運作。",
"notification.remind_owner_bind": "請提醒建立者綁定通知帳號",
"operations": "操作",
"owner": "擁有者",
Expand Down
13 changes: 12 additions & 1 deletion projects/app/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const UpdateInviteModal = dynamic(() => import('@/components/support/user/team/U
const NotSufficientModal = dynamic(() => import('@/components/support/wallet/NotSufficientModal'));
const SystemMsgModal = dynamic(() => import('@/components/support/user/inform/SystemMsgModal'));
const ImportantInform = dynamic(() => import('@/components/support/user/inform/ImportantInform'));
const UpdateNotification = dynamic(
() => import('@/components/support/user/inform/UpdateNotificationModal')
);

const pcUnShowLayoutRoute: Record<string, boolean> = {
'/': true,
Expand Down Expand Up @@ -50,7 +53,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
const { Loading } = useLoading();
const { loading, feConfigs, isNotSufficientModal } = useSystemStore();
const { isPc } = useSystem();
const { userInfo } = useUserStore();
const { userInfo, isUpdateNotification, setIsUpdateNotification } = useUserStore();
const { setUserDefaultLng } = useI18nLng();

const isChatPage = useMemo(
Expand All @@ -68,6 +71,11 @@ const Layout = ({ children }: { children: JSX.Element }) => {

const isHideNavbar = !!pcUnShowLayoutRoute[router.pathname];

const showUpdateNotification =
isUpdateNotification &&
!userInfo?.team.notificationAccount &&
!!userInfo?.team.permission.isOwner;

useMount(() => {
setUserDefaultLng();
});
Expand Down Expand Up @@ -115,6 +123,9 @@ const Layout = ({ children }: { children: JSX.Element }) => {
{!!userInfo && <UpdateInviteModal />}
{isNotSufficientModal && <NotSufficientModal />}
{!!userInfo && <SystemMsgModal />}
{showUpdateNotification && (
<UpdateNotification onClose={() => setIsUpdateNotification(false)} />
)}
{!!userInfo && importantInforms.length > 0 && (
<ImportantInform informs={importantInforms} refetch={refetchUnRead} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
initUserInfo();
onClose();
},
successToast: t('account_info:bind_notification_success'),
errorToast: t('account_info:bind_notification_error')
successToast: t('common:support.user.info.bind_notification_success'),
errorToast: t('common:support.user.info.bind_notification_error')
}
);

Expand All @@ -49,9 +49,9 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
?.map((item) => {
switch (item) {
case 'email':
return t('account_info:email_label');
return t('common:support.user.login.Email');
case 'phone':
return t('account_info:phone_label');
return t('common:support.user.login.Phone number');
}
})
.join('/');
Expand All @@ -62,16 +62,16 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
isOpen
iconSrc="common/settingLight"
w={'32rem'}
title={t('account_info:notification_receiving_hint')}
title={t('common:support.user.info.notification_receiving_hint')}
>
<ModalBody px={10}>
<Flex flexDirection="column">
<HStack px="6" py="3" color="primary.600" bgColor="primary.50" borderRadius="md">
<Icon name="common/info" w="1rem" />
<Box fontSize={'sm'}>{t('account_info:bind_notification_hint')}</Box>
<Box fontSize={'sm'}>{t('common:support.user.info.bind_notification_hint')}</Box>
</HStack>
<Flex mt="4" alignItems="center">
<Box flex={'0 0 70px'}>{t('account_info:user_account')}</Box>
<Box flex={'0 0 70px'}>{t('common:user.Account')}</Box>
<Input
flex={1}
bg={'myGray.50'}
Expand All @@ -80,27 +80,27 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
></Input>
</Flex>
<Flex mt="6" alignItems="center" position={'relative'}>
<Box flex={'0 0 70px'}>{t('account_info:verification_code')}</Box>
<Box flex={'0 0 70px'}>{t('common:support.user.info.verification_code')}</Box>
<Input
flex={1}
bg={'myGray.50'}
{...register('verifyCode', { required: true })}
placeholder={t('account_info:code_required')}
placeholder={t('common:support.user.info.code_required')}
></Input>
<SendCodeBox username={account} />
</Flex>
</Flex>
</ModalBody>
<ModalFooter>
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
{t('account_info:cancel')}
{t('common:common.Cancel')}
</Button>
<Button
isLoading={isLoading}
isDisabled={!account || !verifyCode}
onClick={handleSubmit((data) => onSubmit(data))}
>
{t('account_info:confirm')}
{t('common:common.Confirm')}
</Button>
</ModalFooter>
</MyModal>
Expand Down
4 changes: 3 additions & 1 deletion projects/app/src/pages/account/info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import TeamSelector from '../components/TeamSelector';
const StandDetailModal = dynamic(() => import('./components/standardDetailModal'), { ssr: false });
const ConversionModal = dynamic(() => import('./components/ConversionModal'));
const UpdatePswModal = dynamic(() => import('./components/UpdatePswModal'));
const UpdateNotification = dynamic(() => import('./components/UpdateNotificationModal'));
const UpdateNotification = dynamic(
() => import('@/components/support/user/inform/UpdateNotificationModal')
);
const CommunityModal = dynamic(() => import('@/components/CommunityModal'));

const ModelPriceModal = dynamic(() =>
Expand Down
13 changes: 12 additions & 1 deletion projects/app/src/web/support/user/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ type State = {
systemMsgReadId: string;
setSysMsgReadId: (id: string) => void;

isUpdateNotification: boolean;
setIsUpdateNotification: (val: boolean) => void;

userInfo: UserType | null;
isTeamAdmin: boolean;
initUserInfo: () => Promise<UserType>;
Expand Down Expand Up @@ -50,6 +53,13 @@ export const useUserStore = create<State>()(
});
},

isUpdateNotification: true,
setIsUpdateNotification(val: boolean) {
set((state) => {
state.isUpdateNotification = val;
});
},

userInfo: null,
isTeamAdmin: false,
async initUserInfo() {
Expand Down Expand Up @@ -156,7 +166,8 @@ export const useUserStore = create<State>()(
{
name: 'userStore',
partialize: (state) => ({
systemMsgReadId: state.systemMsgReadId
systemMsgReadId: state.systemMsgReadId,
isUpdateNotification: state.isUpdateNotification
})
}
)
Expand Down
Loading