mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-10 16:08:52 +01:00
If beyond 12 hours, allow last catch up's end timing
This commit is contained in:
parent
5e56ba9fb9
commit
e35e02593a
1 changed files with 26 additions and 3 deletions
|
@ -191,6 +191,7 @@ function Catchup() {
|
||||||
|
|
||||||
const [posts, setPosts] = useState([]);
|
const [posts, setPosts] = useState([]);
|
||||||
const catchupRangeRef = useRef();
|
const catchupRangeRef = useRef();
|
||||||
|
const catchupLastRef = useRef();
|
||||||
const NS = useMemo(() => getCurrentAccountNS(), []);
|
const NS = useMemo(() => getCurrentAccountNS(), []);
|
||||||
const handleCatchupClick = useCallback(async ({ duration } = {}) => {
|
const handleCatchupClick = useCallback(async ({ duration } = {}) => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
@ -925,7 +926,15 @@ function Catchup() {
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (range < RANGES[RANGES.length - 1].value) {
|
if (range < RANGES[RANGES.length - 1].value) {
|
||||||
const duration = range * 60 * 60 * 1000;
|
let duration;
|
||||||
|
if (
|
||||||
|
range === RANGES[RANGES.length - 1].value &&
|
||||||
|
catchupLastRef.current?.checked
|
||||||
|
) {
|
||||||
|
duration = Date.now() - lastCatchupEndAt;
|
||||||
|
} else {
|
||||||
|
duration = range * 60 * 60 * 1000;
|
||||||
|
}
|
||||||
handleCatchupClick({ duration });
|
handleCatchupClick({ duration });
|
||||||
} else {
|
} else {
|
||||||
handleCatchupClick();
|
handleCatchupClick();
|
||||||
|
@ -935,11 +944,25 @@ function Catchup() {
|
||||||
Catch up
|
Catch up
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{lastCatchupRange && range > lastCatchupRange && (
|
{lastCatchupRange && range > lastCatchupRange ? (
|
||||||
<p class="catchup-info">
|
<p class="catchup-info">
|
||||||
<Icon icon="info" /> Overlaps with your last catch-up
|
<Icon icon="info" /> Overlaps with your last catch-up
|
||||||
</p>
|
</p>
|
||||||
)}
|
) : range === RANGES[RANGES.length - 1].value &&
|
||||||
|
lastCatchupEndAt ? (
|
||||||
|
<p class="catchup-info">
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
switch
|
||||||
|
checked
|
||||||
|
ref={catchupLastRef}
|
||||||
|
/>{' '}
|
||||||
|
Until the last catch-up (
|
||||||
|
{dtf.format(new Date(lastCatchupEndAt))})
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
<p class="insignificant">
|
<p class="insignificant">
|
||||||
<small>
|
<small>
|
||||||
Note: your instance might only show a maximum of 800 posts in
|
Note: your instance might only show a maximum of 800 posts in
|
||||||
|
|
Loading…
Reference in a new issue