mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
SidebarList: fix shortcuts
The SidebarList refactor that occurred to accomodate new-style DMs inadvertently broke the keyboard shortcuts to switch between channels. Revives this, and adds support for switching between DMs as well.
This commit is contained in:
parent
50e788825f
commit
c6e116ee50
@ -108,14 +108,19 @@ export function SidebarList(props: {
|
|||||||
const offset = backward ? -1 : 1;
|
const offset = backward ? -1 : 1;
|
||||||
|
|
||||||
const newIdx = modulo(idx+offset, ordered.length - 1);
|
const newIdx = modulo(idx+offset, ordered.length - 1);
|
||||||
const { metadata, resource } = associations[ordered[newIdx]];
|
const newChannel = ordered[newIdx];
|
||||||
const joined = graphKeys.has(resource.slice(7));
|
let path = '';
|
||||||
let path = '/~landscape/home';
|
if(newChannel.startsWith('~')) {
|
||||||
if ('graph' in metadata.config) {
|
path = `/~landscape/messages/dm/${newChannel}`;
|
||||||
path = getResourcePath(workspace, resource, joined, metadata.config.graph);
|
} else {
|
||||||
|
const { metadata, resource } = associations.graph[ordered[newIdx]];
|
||||||
|
const joined = graphKeys.has(resource.slice(7));
|
||||||
|
if ('graph' in metadata.config) {
|
||||||
|
path = getResourcePath(workspace, resource, joined, metadata.config.graph);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
history.push(path);
|
history.push(path);
|
||||||
}, [selected, history.push]);
|
}, [ordered, selected, history.push]);
|
||||||
|
|
||||||
useShortcut('cycleForward', useCallback((e: KeyboardEvent) => {
|
useShortcut('cycleForward', useCallback((e: KeyboardEvent) => {
|
||||||
cycleChannels(false);
|
cycleChannels(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user