More keyboard shortcuts for Catch-up
This commit is contained in:
parent
cd3ed64e48
commit
861ad83423
2 changed files with 72 additions and 2 deletions
|
@ -525,10 +525,13 @@
|
||||||
background-color: var(--bg-faded-color);
|
background-color: var(--bg-faded-color);
|
||||||
box-shadow: 0 8px 16px -8px var(--drop-shadow-color),
|
box-shadow: 0 8px 16px -8px var(--drop-shadow-color),
|
||||||
inset 0 1px var(--bg-color);
|
inset 0 1px var(--bg-color);
|
||||||
outline: 1px solid var(--outline-color);
|
|
||||||
text-shadow: 0 1px var(--bg-color);
|
text-shadow: 0 1px var(--bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover:not(:focus-visible) {
|
||||||
|
outline: 1px solid var(--outline-color);
|
||||||
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
filter: brightness(0.95);
|
filter: brightness(0.95);
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
@ -1091,6 +1094,20 @@
|
||||||
dd {
|
dd {
|
||||||
margin-block-end: 1em;
|
margin-block-end: 1em;
|
||||||
margin-inline: 1em;
|
margin-inline: 1em;
|
||||||
|
|
||||||
|
+ dd {
|
||||||
|
margin-block-start: -0.9em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kbd {
|
||||||
|
border-radius: 4px;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.2em 0.3em;
|
||||||
|
margin: 1px 0;
|
||||||
|
line-height: 1;
|
||||||
|
border: 1px solid var(--outline-color);
|
||||||
|
background-color: var(--bg-faded-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,18 +740,23 @@ function Catchup() {
|
||||||
'h, l',
|
'h, l',
|
||||||
(_, handler) => {
|
(_, handler) => {
|
||||||
// Go next/prev selectedAuthor in authorCountsList list
|
// Go next/prev selectedAuthor in authorCountsList list
|
||||||
|
const key = handler.keys[0];
|
||||||
if (selectedAuthor) {
|
if (selectedAuthor) {
|
||||||
const key = handler.keys[0];
|
|
||||||
const index = authorCountsList.indexOf(selectedAuthor);
|
const index = authorCountsList.indexOf(selectedAuthor);
|
||||||
if (key === 'h') {
|
if (key === 'h') {
|
||||||
if (index > 0 && index < authorCountsList.length) {
|
if (index > 0 && index < authorCountsList.length) {
|
||||||
setSelectedAuthor(authorCountsList[index - 1]);
|
setSelectedAuthor(authorCountsList[index - 1]);
|
||||||
|
scrollableRef.current?.focus();
|
||||||
}
|
}
|
||||||
} else if (key === 'l') {
|
} else if (key === 'l') {
|
||||||
if (index < authorCountsList.length - 1 && index >= 0) {
|
if (index < authorCountsList.length - 1 && index >= 0) {
|
||||||
setSelectedAuthor(authorCountsList[index + 1]);
|
setSelectedAuthor(authorCountsList[index + 1]);
|
||||||
|
scrollableRef.current?.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (key === 'l') {
|
||||||
|
setSelectedAuthor(authorCountsList[0]);
|
||||||
|
scrollableRef.current?.focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -761,6 +766,34 @@ function Catchup() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const escRef = useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
setSelectedAuthor(null);
|
||||||
|
scrollableRef.current?.focus();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
ignoreModifiers: true,
|
||||||
|
enableOnFormTags: ['input'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const dotRef = useHotkeys(
|
||||||
|
'.',
|
||||||
|
() => {
|
||||||
|
scrollableRef.current?.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{
|
||||||
|
preventDefault: true,
|
||||||
|
ignoreModifiers: true,
|
||||||
|
enableOnFormTags: ['input'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={(node) => {
|
ref={(node) => {
|
||||||
|
@ -768,6 +801,7 @@ function Catchup() {
|
||||||
jRef.current = node;
|
jRef.current = node;
|
||||||
kRef.current = node;
|
kRef.current = node;
|
||||||
hlRef.current = node;
|
hlRef.current = node;
|
||||||
|
escRef.current = node;
|
||||||
}}
|
}}
|
||||||
id="catchup-page"
|
id="catchup-page"
|
||||||
class="deck-container"
|
class="deck-container"
|
||||||
|
@ -1430,6 +1464,25 @@ function Catchup() {
|
||||||
Posts are grouped by authors, sorted by posts count per
|
Posts are grouped by authors, sorted by posts count per
|
||||||
author.
|
author.
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>Keyboard shortcuts</dt>
|
||||||
|
<dd>
|
||||||
|
<kbd>j</kbd>: Next post
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<kbd>k</kbd>: Previous post
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<kbd>l</kbd>: Next author
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<kbd>h</kbd>: Previous author
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<kbd>Enter</kbd>: Open post details
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<kbd>.</kbd>: Scroll to top
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue