Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import React from 'react' import { withTranslation, WithTranslation } from 'react-i18next' import Icon from 'components/Common/Icon' import ListView from 'components/PageList/ListView' import Crowi from 'client/util/Crowi' interface Props extends WithTranslation { crowi: Crowi } interface State { pages: [] loading: boolean } class RecentlyViewedPageList extends React.Component<Props, State> { constructor(props) { super(props) this.state = { pages: [], loading: true, } } async componentDidMount() { const { pages } = await this.props.crowi.apiGet('/user/recentlyViewed', {}) this.setState({ pages, loading: false }) } render() { const { t } = this.props const { pages, loading } = this.state return ( <div className="grouped-page-list"> <h6> <Icon name="history" /> <span className="title">{t('Recently Viewed Pages')}</span> </h6> {loading ? <Icon name="loading" spin /> : pages.length === 0 ? 'No recently viewed pages' : <ListView pages={pages} />} </div> ) } } export default withTranslation()(RecentlyViewedPageList) |