|
@@ -16,7 +16,7 @@ import loggerFactory from '~/utils/logger';
|
|
|
import FormattedDistanceDate from '../FormattedDistanceDate';
|
|
import FormattedDistanceDate from '../FormattedDistanceDate';
|
|
|
|
|
|
|
|
import InfiniteScroll from './InfiniteScroll';
|
|
import InfiniteScroll from './InfiniteScroll';
|
|
|
-import { SidebarHeader } from './SidebarHeader';
|
|
|
|
|
|
|
+import { SidebarHeaderReloadButton } from './SidebarHeaderReloadButton';
|
|
|
|
|
|
|
|
import TagLabelsStyles from '../Page/TagLabels.module.scss';
|
|
import TagLabelsStyles from '../Page/TagLabels.module.scss';
|
|
|
import styles from './RecentChanges.module.scss';
|
|
import styles from './RecentChanges.module.scss';
|
|
@@ -134,9 +134,11 @@ const RecentChanges = (): JSX.Element => {
|
|
|
const PER_PAGE = 20;
|
|
const PER_PAGE = 20;
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const swr = useSWRInifinitexRecentlyUpdated();
|
|
const swr = useSWRInifinitexRecentlyUpdated();
|
|
|
|
|
+ const { data, error, mutate } = swr;
|
|
|
const [isRecentChangesSidebarSmall, setIsRecentChangesSidebarSmall] = useState(false);
|
|
const [isRecentChangesSidebarSmall, setIsRecentChangesSidebarSmall] = useState(false);
|
|
|
- const isEmpty = swr.data?.[0].length === 0;
|
|
|
|
|
- const isReachingEnd = isEmpty || (swr.data && swr.data[swr.data.length - 1]?.length < PER_PAGE);
|
|
|
|
|
|
|
+ const isEmpty = data?.[0].length === 0;
|
|
|
|
|
+ const isLoading = error == null && data === undefined;
|
|
|
|
|
+ const isReachingEnd = isEmpty || (data && data[data.length - 1]?.length < PER_PAGE);
|
|
|
const retrieveSizePreferenceFromLocalStorage = useCallback(() => {
|
|
const retrieveSizePreferenceFromLocalStorage = useCallback(() => {
|
|
|
if (window.localStorage.isRecentChangesSidebarSmall === 'true') {
|
|
if (window.localStorage.isRecentChangesSidebarSmall === 'true') {
|
|
|
setIsRecentChangesSidebarSmall(true);
|
|
setIsRecentChangesSidebarSmall(true);
|
|
@@ -155,7 +157,9 @@ const RecentChanges = (): JSX.Element => {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div data-testid="grw-recent-changes">
|
|
<div data-testid="grw-recent-changes">
|
|
|
- <SidebarHeader title='Recent Changes' hasButton onClick={swr.mutate} >
|
|
|
|
|
|
|
+ <div className="grw-sidebar-content-header p-3 d-flex">
|
|
|
|
|
+ <h3 className="text-nowrap">{t('Recent Changes')}</h3>
|
|
|
|
|
+ <SidebarHeaderReloadButton onClick={mutate}/>
|
|
|
<div className="d-flex align-items-center">
|
|
<div className="d-flex align-items-center">
|
|
|
<div className={`grw-recent-changes-resize-button ${styles['grw-recent-changes-resize-button']} custom-control custom-switch ml-1`}>
|
|
<div className={`grw-recent-changes-resize-button ${styles['grw-recent-changes-resize-button']} custom-control custom-switch ml-1`}>
|
|
|
<input
|
|
<input
|
|
@@ -169,7 +173,7 @@ const RecentChanges = (): JSX.Element => {
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </SidebarHeader>
|
|
|
|
|
|
|
+ </div>
|
|
|
<div className="grw-recent-changes p-3">
|
|
<div className="grw-recent-changes p-3">
|
|
|
<ul className="list-group list-group-flush">
|
|
<ul className="list-group list-group-flush">
|
|
|
<InfiniteScroll
|
|
<InfiniteScroll
|