nicolium: apply this hotkey thing to new timeline
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -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') {
|
||||
|
||||
@ -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 = () => {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user