nicolium: apply this hotkey thing to new timeline

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-05 10:54:38 +01:00
parent 395553bc6b
commit 05b44067c2
4 changed files with 11 additions and 8 deletions

View File

@ -106,18 +106,16 @@ const Timeline: React.FC<ITimeline> = ({ query, contextType = 'public' }) => {
const { entries, queuedCount, fetchNextPage, dequeueEntries, isFetching, isPending } = query;
const handleMoveUp = (index: number) => {
const handleMoveUp = (index: number) =>
selectChild(index - 1, node, document.getElementById('status-list') ?? undefined);
};
const handleMoveDown = (index: number) => {
const handleMoveDown = (index: number) =>
selectChild(
index + 1,
node,
document.getElementById('status-list') ?? undefined,
entries.length,
);
};
const renderEntry = (entry: TimelineEntry, index: number) => {
if (entry.type === 'status') {

View File

@ -330,14 +330,16 @@ const Status: React.FC<IStatus> = React.memo((props) => {
const handleHotkeyMoveUp = () => {
if (onMoveUp) {
onMoveUp(status.id, featured);
return onMoveUp(status.id, featured);
}
return false;
};
const handleHotkeyMoveDown = () => {
if (onMoveDown) {
onMoveDown(status.id, featured);
return onMoveDown(status.id, featured);
}
return false;
};
const handleHotkeyToggleSensitive = () => {

View File

@ -6,8 +6,8 @@ import { Hotkeys } from '@/features/ui/components/hotkeys';
interface ITombstone {
id: string;
onMoveUp?: (statusId: string) => void;
onMoveDown?: (statusId: string) => void;
onMoveUp?: (statusId: string) => void | boolean;
onMoveDown?: (statusId: string) => void | boolean;
deleted?: boolean;
}

View File

@ -8,12 +8,15 @@ const selectChild = (
count?: number,
align?: 'start' | 'center' | 'end',
) => {
if (index < 0) return false;
if (count !== undefined && index === count) {
const loadMoreButton = node.querySelector<HTMLButtonElement>('.⁂-load-more');
if (loadMoreButton) {
loadMoreButton.focus({ preventScroll: false });
return;
}
return false;
}
const selector = `[data-index="${index}"] .focusable`;