feat: click on the app card to log in automatically (#1049)

This commit is contained in:
wenxuan70
2022-08-22 01:17:18 +08:00
committed by GitHub
parent 80a2263b18
commit fdf2b880cb
2 changed files with 18 additions and 4 deletions

View File

@ -27,15 +27,23 @@ class SingleCard extends React.Component {
};
}
wrappedAsSilentSigninLink(link) {
if (link.startsWith("http")) {
link += link.includes("?") ? "&silentSignin=1" : "?silentSignin=1";
}
return link;
}
renderCardMobile(logo, link, title, desc, time, isSingle) {
const gridStyle = {
width: "100vw",
textAlign: "center",
cursor: "pointer",
};
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
return (
<Card.Grid style={gridStyle} onClick={() => Setting.goToLinkSoft(this, link)}>
<Card.Grid style={gridStyle} onClick={() => Setting.goToLinkSoft(this, silentSigninLink)}>
<img src={logo} alt="logo" height={60} style={{marginBottom: "20px"}} />
<Meta
title={title}
@ -46,6 +54,8 @@ class SingleCard extends React.Component {
}
renderCard(logo, link, title, desc, time, isSingle) {
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
return (
<Col style={{paddingLeft: "20px", paddingRight: "20px", paddingBottom: "20px", marginBottom: "20px"}} span={6}>
<Card
@ -53,7 +63,7 @@ class SingleCard extends React.Component {
cover={
<img alt="logo" src={logo} style={{width: "100%", height: "210px", objectFit: "scale-down"}} />
}
onClick={() => Setting.goToLinkSoft(this, link)}
onClick={() => Setting.goToLinkSoft(this, silentSigninLink)}
style={isSingle ? {width: "320px"} : {width: "100%"}}
>
<Meta title={title} description={desc} />