Skip to content

Commit

Permalink
feat: add ranking entry
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Mar 28, 2020
1 parent 3111179 commit 8d35f27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
16 changes: 11 additions & 5 deletions src/containers/GalleryContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ListSubheader
} from '@material-ui/core';
import { Menu as MenuIcon, Done as DoneIcon } from '@material-ui/icons';
import H from 'history';
import DocumentTitle from 'react-document-title';
import { FormattedMessage, injectIntl, InjectedIntl } from 'react-intl';

Expand Down Expand Up @@ -62,6 +63,7 @@ interface IGalleryContainerProps extends WithStyles<typeof styles> {
dispatch: Dispatch<IGalleryAction> & TGalleryThunkDispatch;
intl: InjectedIntl;
gallery: IGalleryState;
location: H.Location;
}

interface IGalleryContainerState {
Expand Down Expand Up @@ -90,10 +92,14 @@ class GalleryContainer extends React.Component<
this.onSearch(this.props.gallery.word);
this.props.dispatch(GalleryActions.setFromIllust(false));
} else {
const cachedWord = Storage.get('word');
this.props.dispatch(
GalleryActions.setWord(cachedWord ? cachedWord : 'ranking')
);
if (this.props.location.search === '?entry=ranking') {
this.props.dispatch(GalleryActions.setWord('ranking'));
} else {
const cachedWord = Storage.get('word');
this.props.dispatch(
GalleryActions.setWord(cachedWord ? cachedWord : 'ranking')
);
}

if (this.props.gallery.items.length === 0) {
this.fetchSource(true);
Expand Down Expand Up @@ -192,7 +198,7 @@ class GalleryContainer extends React.Component<
);
}

onHeaderClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
onHeaderClick = (event: React.MouseEvent<HTMLDivElement>) => {
const target = event.target as HTMLDivElement;
const tagName = target.tagName.toLowerCase();

Expand Down
8 changes: 2 additions & 6 deletions src/containers/IllustContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,10 @@ class IllustContainer extends React.Component<
return this.props.illust.items[this.illustId];
}

onBackClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
onBackClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault();
event.stopPropagation();
if (this.props.history.length > 1) {
this.props.history.goBack();
} else {
this.props.history.push('/');
}
this.props.history.push('/');
};

// @autobind
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"sourceMap": true,
"baseUrl": ".",
"strictPropertyInitialization": false,
"types": ["webpack-env"],
"paths": {
"@/*": ["src/*"]
}
Expand Down

0 comments on commit 8d35f27

Please sign in to comment.