Skip to content

Commit d337aba

Browse files
Merge branch 'dev' into 'main'
feat: update doclink See merge request locker/web-selfhosted!141
2 parents 77b6894 + 1d5a8c3 commit d337aba

6 files changed

Lines changed: 56 additions & 11 deletions

File tree

src/components/items/DocLink.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, { useMemo } from 'react';
2+
import { useSelector } from 'react-redux';
3+
4+
import {
5+
ArrowRightOutlined,
6+
} from '@ant-design/icons';
7+
8+
import common from '../../utils/common';
9+
import global from '../../config/global';
10+
11+
function DocLink(props) {
12+
const { className, docKey, title, showIcon = true } = props
13+
const locale = useSelector((state) => state.system.locale);
14+
const linkUrl = useMemo(() => {
15+
const localeLinks = global.urls.DOC_LINKS[locale] || global.urls.DOC_LINKS.en
16+
return localeLinks[docKey] || global.urls[docKey]
17+
}, [locale, docKey])
18+
return <span
19+
className={`flex items-center text-primary cursor-pointer ${className}`}
20+
onClick={() => common.openNewTab(linkUrl)}
21+
>
22+
<span>
23+
{title}
24+
{
25+
showIcon && <ArrowRightOutlined className='ml-2'/>
26+
}
27+
</span>
28+
</span>
29+
}
30+
31+
export default DocLink;

src/components/items/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import NotifyButton from "./NotifyButton";
1111
import PolicyResult from "./PolicyResult";
1212
import UserInfo from "./UserInfo";
1313
import Attachment from "./Attachment";
14+
import DocLink from "./DocLink";
1415

1516
const itemsComponents = {
1617
FilterTime,
@@ -25,7 +26,8 @@ const itemsComponents = {
2526
NotifyButton,
2627
PolicyResult,
2728
UserInfo,
28-
Attachment
29+
Attachment,
30+
DocLink
2931
}
3032

3133
export default itemsComponents

src/components/modals/EncryptionUpdate.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212

1313
import itemsComponents from "../items";
1414

15-
import global from "../../config/global";
15+
import common from "../../utils/common";
1616

1717
const EncryptionUpdateModal = (props) => {
1818
const { RouterLink } = itemsComponents;
@@ -52,7 +52,7 @@ const EncryptionUpdateModal = (props) => {
5252
type="primary"
5353
size="large"
5454
onClick={() => {
55-
global.navigate(global.keys.SETTINGS_SECURITY);
55+
common.encryptionUpdateNow();
5656
onClose();
5757
}}
5858
>

src/config/urls.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ export default {
66
CHROME_LINK: 'https://support.locker.io/articles/Import-from-Google-Chrome-3418bcd6e1ea48b6a891d1f828e46ebb',
77
FIREFOX_LINK: 'https://support.locker.io/articles/Import-from-Firefox-1995673b585a4a7f98192abdea06a0e6',
88
ONE_PASSWORD_LINK: 'https://support.locker.io/articles/Import-from-1Password-50b668a9f5ab439a9c10f05df5de8544',
9-
DOWNLOAD_DESKTOP_URL: 'https://locker.io/passwords/download'
9+
DOWNLOAD_DESKTOP_URL: 'https://locker.io/passwords/download',
10+
DOC_LINKS: {
11+
vi: {
12+
SECURITY_UPGRADE_URL: 'https://locker.io/vi/blog/nang-cap-bao-mat-khoa-chinh-master-key'
13+
},
14+
en: {
15+
SECURITY_UPGRADE_URL: 'https://locker.io/blog/master-key-security-upgrade'
16+
}
17+
}
1018
}

src/pages/admin/settings/components/security/drawers/UpdateEncryptionSettings.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import userServices from '../../../../../../services/user';
2828
import authServices from '../../../../../../services/auth';
2929

3030
function UpdateEncryptionSettingsDrawer(props) {
31-
const { RouterLink } = itemsComponents;
31+
const { DocLink } = itemsComponents;
3232
const { ConfirmEncryptionUpdateModal } = securityModalsComponents;
3333
const {
3434
visible = false,
@@ -150,11 +150,10 @@ function UpdateEncryptionSettingsDrawer(props) {
150150
{t('form_data.note3')}
151151
</li>
152152
</ul>
153-
<RouterLink
154-
className={'font-semibold'}
155-
label={t('form_data.explore_more')}
156-
icon={<ArrowRightOutlined />}
157-
onClick={() => {}}
153+
<DocLink
154+
className="font-semibold"
155+
title={t('form_data.explore_more')}
156+
docKey="SECURITY_UPGRADE_URL"
158157
/>
159158
</div>}
160159
type={'warning'}

src/utils/common/other.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ const getDuplicateObjects = (arr) => {
221221
return duplicates
222222
}
223223

224+
const encryptionUpdateNow = () => {
225+
global.navigate(global.keys.SETTINGS_SECURITY);
226+
}
227+
224228
export default {
225229
isDiff,
226230
isEmpty,
@@ -248,5 +252,6 @@ export default {
248252
openDesktopApp,
249253
allRouters,
250254
allMenus,
251-
getDuplicateObjects
255+
getDuplicateObjects,
256+
encryptionUpdateNow
252257
}

0 commit comments

Comments
 (0)