Skip to content

Commit

Permalink
Format code, ready to release
Browse files Browse the repository at this point in the history
Signed-off-by: Harry Chen <[email protected]>
  • Loading branch information
Harry-Chen authored and xxr3376 committed Feb 20, 2019
1 parent 7223b32 commit 97459f3
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 43 deletions.
31 changes: 16 additions & 15 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const initialState = {
};

class App extends React.PureComponent<AppProps, typeof initialState> {

public state = initialState;

private inputRef: React.RefObject<HTMLDivElement>;
Expand Down Expand Up @@ -83,7 +82,7 @@ class App extends React.PureComponent<AppProps, typeof initialState> {
<>
<CssBaseline />
{/* sidebar */}
<AppBar position="fixed" >
<AppBar position="fixed">
<Toolbar>
<IconButton
color="inherit"
Expand Down Expand Up @@ -111,9 +110,7 @@ class App extends React.PureComponent<AppProps, typeof initialState> {
open={!this.props.paneHidden}
>
<div className={styles.sidebar_wrapper}>
<div
className={styles.sidebar_header}
>
<div className={styles.sidebar_header}>
<div className={styles.sidebar_header_content}>
<Toolbar className={styles.sidebar_header_left}>
<IconButton
Expand All @@ -131,8 +128,9 @@ class App extends React.PureComponent<AppProps, typeof initialState> {
</Typography>
</Toolbar>
<Toolbar
className={classnames(styles.sidebar_header_right,
{ [styles.sidebar_filter_shown]: this.state.filterShown })}
className={classnames(styles.sidebar_header_right, {
[styles.sidebar_filter_shown]: this.state.filterShown,
})}
>
<Typography variant="h6" className={styles.sidebar_cardlist_name} noWrap={true}>
{this.props.cardListTitle}
Expand All @@ -145,13 +143,15 @@ class App extends React.PureComponent<AppProps, typeof initialState> {
>
<FontAwesomeIcon
icon="filter"
className={classnames(styles.filter_icon,
{ [styles.filter_icon_shown]: !this.state.filterShown })}
className={classnames(styles.filter_icon, {
[styles.filter_icon_shown]: !this.state.filterShown,
})}
/>
<FontAwesomeIcon
icon="times"
className={classnames(styles.filter_icon,
{ [styles.filter_icon_shown]: this.state.filterShown })}
className={classnames(styles.filter_icon, {
[styles.filter_icon_shown]: this.state.filterShown,
})}
/>
</IconButton>
<div className={styles.filter_input}>
Expand Down Expand Up @@ -191,9 +191,7 @@ class App extends React.PureComponent<AppProps, typeof initialState> {
[styles.pane_fullscreen]: this.props.paneHidden,
})}
>
<Toolbar>

</Toolbar>
<Toolbar />
<DetailPane />
</div>
{/* dialogs */}
Expand Down Expand Up @@ -230,4 +228,7 @@ const mapDispatchToProps = (dispatch: Dispatch<any>): Partial<AppProps> => ({
},
});

export default connect(mapStateToProps, mapDispatchToProps)(App);
export default connect(
mapStateToProps,
mapDispatchToProps,
)(App);
9 changes: 7 additions & 2 deletions src/components/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ const mapStateToProps = (state): Partial<CardListProps> => {
return {
type: ui.cardTypeFilter,
course: ui.cardCourseFilter,
...generateCardList(data, data.lastUpdateTime,
ui.cardTypeFilter, ui.cardCourseFilter, ui.titleFilter),
...generateCardList(
data,
data.lastUpdateTime,
ui.cardTypeFilter,
ui.cardCourseFilter,
ui.titleFilter,
),
title: ui.cardListTitle,
threshold: ui.cardVisibilityThreshold,
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/ContentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ContentDetail extends React.PureComponent<ContentDetailProps, never> {
<div className={styles.content_detail_lines}>
<table>
<tbody>
{this.generateLine('课程名称', content.courseName)}
{isHomework ? this.generateDetailsForHomework(homework) : null}
{isNotification ? this.generateDetailsForNotification(notification) : null}
{this.generateLine('课程名称', content.courseName)}
{isHomework ? this.generateDetailsForHomework(homework) : null}
{isNotification ? this.generateDetailsForNotification(notification) : null}
</tbody>
</table>
</div>
Expand Down
6 changes: 1 addition & 5 deletions src/components/ContentIgnoreSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ class ContentIgnoreSetting extends React.PureComponent<ContentIgnoreSettingProps
checked={s.ignore[type]}
onChange={() => {
this.props.dispatch(
toggleContentIgnore(
s.course.id,
type,
!s.ignore[type],
),
toggleContentIgnore(s.course.id, type, !s.ignore[type]),
);
}}
/>
Expand Down
16 changes: 11 additions & 5 deletions src/components/DetailPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ class DetailPane extends React.PureComponent<DetailPaneProps, never> {
} else if (this.props.content !== undefined) {
return <ContentDetail content={this.props.content} />;
} else {
return <div style={{
height: 'calc(100% - 64px)',
width: '100%',
position: 'relative',
}}><Iframe url={this.props.url} /></div>;
return (
<div
style={{
height: 'calc(100% - 64px)',
width: '100%',
position: 'relative',
}}
>
<Iframe url={this.props.url} />
</div>
);
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/dialogs/LoginDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ class LoginDialog extends React.PureComponent<ILoginDialogProps, never> {
我们对凭据进行了简单的加密,但并不能完全防止其被第三方读取。
在长时间不使用或者出借计算机时,请务必退出登录,以免您的凭据被泄露。
<br />
如果您选择登录,则视为您已经阅读并同意<a href={'about.html'} target={'_blank'}>此页面</a>中的所有内容。
否则,请立刻停止使用并从 Chrome 中卸载本插件。
如果您选择登录,则视为您已经阅读并同意
<a href={'about.html'} target={'_blank'}>
此页面
</a>
中的所有内容。 否则,请立刻停止使用并从 Chrome 中卸载本插件。
</DialogContentText>
</DialogContent>
<DialogContent>
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const loadApp = () => {
ReactDOM.render(
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App/>
<App />
</PersistGate>
</Provider>,
document.querySelector('#main'),
Expand All @@ -38,7 +38,7 @@ const loadApp = () => {
.then(() => {
store.dispatch<any>(refreshIfNeeded());
})
.catch((e) => {
.catch(e => {
console.error(e);
store.dispatch(toggleLoginDialog(false));
store.dispatch(toggleNetworkErrorDialog(true));
Expand Down
5 changes: 3 additions & 2 deletions src/redux/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export const generateCardList = (
oldCards = newCards;

if (title !== undefined) {
newCards = newCards.filter(l => l.title
.toLocaleLowerCase().includes(title.toLocaleLowerCase()));
newCards = newCards.filter(l =>
l.title.toLocaleLowerCase().includes(title.toLocaleLowerCase()),
);
}

return {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/console.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const MESSAGE_FORMAT = 'color: blue; font-size: larger';

export const printWelcomeMessage = () => {
console.log('%c欢迎使用 Learn Helper!', MESSAGE_FORMAT);
console.log('%c诚邀一起参与开发工作,详见 GitHub Harry-Chen/Learn-Project', MESSAGE_FORMAT);
};
const MESSAGE_FORMAT = 'color: blue; font-size: larger';

export const printWelcomeMessage = () => {
console.log('%c欢迎使用 Learn Helper!', MESSAGE_FORMAT);
console.log('%c诚邀一起参与开发工作,详见 GitHub Harry-Chen/Learn-Project', MESSAGE_FORMAT);
};
4 changes: 3 additions & 1 deletion src/utils/pubsuffix_stub.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports.getPublicSuffix = function getPublicSuffix(domain) { return null };
module.exports.getPublicSuffix = function getPublicSuffix(domain) {
return null;
};

0 comments on commit 97459f3

Please sign in to comment.