Skip to content

Commit

Permalink
fix: 登录页面增加关闭按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
moshangqi committed Dec 1, 2023
1 parent 7ac93b9 commit 1e1d82f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/background/core/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ export default {
tabs.query({ status: 'complete' }, res => {
for (const tab of res) {
if (tab.id) {
tabs.sendMessage(tab.id, message, res1 => {
resolve(res1);
});
try {
tabs.sendMessage(tab.id, message, res1 => {
resolve(res1);
});
} catch (e) {
// 吞掉抛错
}
}
}
});
Expand Down
8 changes: 8 additions & 0 deletions src/components/AccountLayout/Login.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
border-left: 1px solid @border-color;
background: @white;
justify-content: center;
position: relative;

.content {
padding: 0 70px;
Expand Down Expand Up @@ -48,4 +49,11 @@
}
}
}

.closeWrapper {
position: absolute;
right: 16px;
top: 16px;
color: @text-color-secondary;
}
}
12 changes: 12 additions & 0 deletions src/components/AccountLayout/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { __i18n } from '@/isomorphic/i18n';
import LinkHelper from '@/isomorphic/link-helper';
import { VERSION } from '@/config';
import YuqueLogo from '@/assets/images/yuque-logo.png';
import { isRunningInjectPage } from '@/core/uitl';
import LarkIcon from '../LarkIcon';
import Typography from '../Typography';
import styles from './Login.module.less';

interface ILoginProps {
Expand Down Expand Up @@ -39,6 +42,15 @@ function Login(props: ILoginProps) {

return (
<div className={styles.wrapper}>
{isRunningInjectPage && (
<Typography
type="iconButton"
className={styles.closeWrapper}
onClick={() => backgroundBridge.sidePanel.close()}
>
<LarkIcon name="close-outline" />
</Typography>
)}
<div className={styles.content}>
<div className={styles.welcome}>
<img width="60" src={YuqueLogo} alt="yuque logo" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function AccountLayout(props: IAccountLayoutProps) {

return (
<AccountContext.Provider value={providerValue as any}>
{isLogined ? (
{isLogined && !forceUpgradeHtml ? (
props.children
) : (
<Login onLoginSuccess={setUser} forceUpgradeHtml={forceUpgradeHtml} />
Expand Down

0 comments on commit 1e1d82f

Please sign in to comment.