Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

Merge branch 'feat/ui-1.0.4' into feat/ui-1.1.0

haitao(lj)e8246433a206
diff --cc i18n/en_US.yaml
index 26b134b2,8905cd56..39bdb986
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@@ -746,13 -737,6 +748,13 @@@ ui
lang:
label: Interface Language
text: User interface language. It will change when you refresh the page.
+ my_logins:
+ title: My Logins
- lable: Log in or sign up on this site using these accounts.
++ label: Log in or sign up on this site using these accounts.
+ modal_title: Remove Login
+ modal_content: Are you sure you want to remove this login from your account?
+ modal_confirm_btn: Remove
+ remove_success: Removed successfully
toast:
update: update success
update_password: Password changed successfully.
diff --cc i18n/zh_CN.yaml
index 08024eac,a02320ef..bec25ac8
--- a/i18n/zh_CN.yaml
+++ b/i18n/zh_CN.yaml
@@@ -969,11 -977,10 +974,11 @@@ ui
tos: 服务条款
privacy: 隐私政策
seo: SEO
- customize: Customize
- themes: Themes
+ customize: 自定义
+ themes: 主题
css-html: CSS/HTML
- login: Login
+ login: 登录
+ website_welcome: 欢迎来到 {{site_name}}
admin:
admin_header:
title: 后台管理
diff --cc ui/src/components/index.ts
index 2696e511,49340cf7..99c78e6b
--- a/ui/src/components/index.ts
+++ b/ui/src/components/index.ts
@@@ -32,7 -32,7 +32,8 @@@ import CustomizeTheme from './Customize
import PageTags from './PageTags';
import QuestionListLoader from './QuestionListLoader';
import TagsLoader from './TagsLoader';
+import WelcomeTitle from './WelcomeTitle';
+ import Counts from './Counts';
export {
Avatar,
@@@ -71,6 -71,6 +72,7 @@@
PageTags,
QuestionListLoader,
TagsLoader,
+ WelcomeTitle,
+ Counts,
};
export type { EditorRef, JSONSchema, UISchema };
diff --cc ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx
index 87f27ca4,00000000..74fb662e
mode 100644,000000..100644
--- a/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx
+++ b/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx
@@@ -1,70 -1,0 +1,70 @@@
+import { memo } from 'react';
+import { Button } from 'react-bootstrap';
+import { useTranslation } from 'react-i18next';
+
+import { Modal } from '@/components';
+import { useOauthConnectorInfoByUser, userOauthUnbind } from '@/services';
+import { useToast } from '@/hooks';
+
+const Index = () => {
+ const { data, mutate } = useOauthConnectorInfoByUser();
+ const toast = useToast();
+
+ const { t } = useTranslation('translation', {
+ keyPrefix: 'settings.my_logins',
+ });
+
+ const deleteLogins = (e, item) => {
+ if (!item.binding) {
+ return;
+ }
+ e.preventDefault();
+ Modal.confirm({
+ title: t('modal_title'),
+ content: t('modal_content'),
+ confirmBtnVariant: 'danger',
+ confirmText: t('modal_confirm_btn'),
+ onConfirm: () => {
+ userOauthUnbind({ external_id: item.external_id }).then(() => {
+ mutate();
+ toast.onShow({
+ msg: t('remove_success'),
+ variant: 'success',
+ });
+ });
+ },
+ });
+ };
+
+ if (!data?.length) return null;
+ return (
+ <div className="mt-5">
+ <div className="form-label">{t('title')}</div>
- <small className="form-text mt-0">{t('lable')}</small>
++ <small className="form-text mt-0">{t('label')}</small>
+
+ <div className="d-grid gap-2 mt-3">
+ {data?.map((item) => {
+ return (
+ <div key={item.name}>
+ <Button
+ variant={item.binding ? 'outline-danger' : 'outline-secondary'}
+ href={item.link}
+ onClick={(e) => deleteLogins(e, item)}>
+ <img
+ src={`data:image/svg+xml;base64,${item.icon}`}
+ alt=""
+ width={16}
+ height={16}
+ className="btnSvg me-2"
+ />
+ <span> {item.name}</span>
+ </Button>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ );
+};
+
+export default memo(Index);