Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leap: QoL improvements for Talk expats #3237

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions ui/src/components/Leap/useLeap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import ShapesIcon from '../icons/ShapesIcon';
import NotebookIcon from '../icons/NotebookIcon';
import PeopleIcon from '../icons/PeopleIcon';
import GridIcon from '../icons/GridIcon';
import useActiveTab from '../Sidebar/util';

interface LeapContext {
isOpen: boolean;
Expand Down Expand Up @@ -110,6 +111,7 @@ export default function useLeap() {
[mutuals]
);
const menuOptions = app === 'Talk' ? talkMenuOptions : groupsMenuOptions;
const tab = useActiveTab();

const menu =
inputValue === ''
Expand Down Expand Up @@ -220,13 +222,7 @@ export default function useLeap() {
},
...filteredShips.map(([patp, contact], idx) => {
const onSelect = () => {
if (app === 'Talk') {
navigate(`/dm/${patp}`);
} else {
modalNavigate(`/profile/${preSig(patp)}`, {
state: { backgroundLocation: location },
});
}
navigate(`/dm/${patp}`);
setSelectedIndex(0);
setInputValue('');
setIsOpen(false);
Expand All @@ -242,18 +238,15 @@ export default function useLeap() {
0,
LEAP_DESCRIPTION_TRUNCATE_LENGTH
),
to: `/profile/${patp}`,
to: `/dm/${patp}`,
resultIndex: idx,
};
}),
];
}, [
app,
contacts,
inputValue,
isDMUnread,
location,
modalNavigate,
navigate,
preSiggedMutuals,
dms,
Expand Down Expand Up @@ -351,8 +344,10 @@ export default function useLeap() {
},
...filteredChannels.map(({ groupFlag, group, channel, nest }, idx) => {
const [chType, chFlag] = nestToFlag(nest);
const loc = `/groups/${groupFlag}/channels/${nest}`;
const nav = tab === 'messages' ? `/dm${loc}` : loc;
const onSelect = () => {
navigate(`/groups/${groupFlag}/channels/${nest}`);
navigate(nav);
setSelectedIndex(0);
setInputValue('');
setIsOpen(false);
Expand All @@ -377,7 +372,7 @@ export default function useLeap() {
input: inputValue,
title: channel.meta.title,
subtitle: group.meta.title,
to: `/groups/${groupFlag}/channels/chat/${chFlag}`,
to: nav,
resultIndex:
idx +
(shipResults.length > LEAP_RESULT_TRUNCATE_SIZE
Expand All @@ -387,6 +382,7 @@ export default function useLeap() {
}),
];
}, [
tab,
currentGroupFlag,
groups,
inputValue,
Expand Down
Loading