Merge pull request #3264 from urbit/mp/omni-tweak

omnibox: two UX tweaks
This commit is contained in:
matildepark 2020-08-09 22:58:30 -04:00 committed by GitHub
commit 974a88385a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,18 @@ export class OmniboxResult extends Component {
hovered: false
};
this.setHover = this.setHover.bind(this);
this.result = React.createRef();
}
componentDidUpdate(prevProps) {
const { props, state } = this;
if (prevProps &&
!state.hovered &&
prevProps.selected !== props.selected &&
props.selected === props.link
) {
this.result.current.scrollIntoView({ block: 'nearest' });
}
}
setHover(boolean) {
@ -55,6 +67,7 @@ export class OmniboxResult extends Component {
}
onClick={navigate}
width="100%"
ref={this.result}
>
{this.state.hovered || selected === link ? (
<>

View File

@ -100,6 +100,8 @@ export default function index(associations, apps) {
const obj = result(apps[e].type.basic.title, apps[e].type.basic.linkedUrl, apps[e].type.basic.title, null);
applications.push(obj);
});
// add groups separately
applications.push(result('Groups', '/~groups', 'groups', null));
index.set('apps', applications);
return index;