mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
Merge pull request #3687 from urbit/mp/leap/apps
leap: restore app index, remove from default
This commit is contained in:
commit
fb1fe8094f
@ -4,6 +4,7 @@ import { cite } from '~/logic/lib/util';
|
||||
['commands', []],
|
||||
['subscriptions', []],
|
||||
['groups', []],
|
||||
['apps', []],
|
||||
['other', []]
|
||||
]);
|
||||
|
||||
@ -28,6 +29,29 @@ const commandIndex = function (currentGroup) {
|
||||
return commands;
|
||||
};
|
||||
|
||||
const appIndex = function (apps) {
|
||||
// all apps are indexed from launch data
|
||||
// indexed into 'apps'
|
||||
const applications = [];
|
||||
Object.keys(apps)
|
||||
.filter((e) => {
|
||||
return apps[e]?.type?.basic;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return a.localeCompare(b);
|
||||
})
|
||||
.map((e) => {
|
||||
const obj = result(
|
||||
apps[e].type.basic.title,
|
||||
apps[e].type.basic.linkedUrl,
|
||||
apps[e].type.basic.title,
|
||||
null
|
||||
);
|
||||
applications.push(obj);
|
||||
});
|
||||
return applications;
|
||||
};
|
||||
|
||||
const otherIndex = function() {
|
||||
const other = [];
|
||||
other.push(result('Home', '/~landscape/home', 'home', null));
|
||||
@ -91,6 +115,7 @@ export default function index(associations, apps, currentGroup, groups) {
|
||||
indexes.set('commands', commandIndex(currentGroup));
|
||||
indexes.set('subscriptions', subscriptions);
|
||||
indexes.set('groups', landscape);
|
||||
indexes.set('apps', appIndex(apps));
|
||||
indexes.set('other', otherIndex());
|
||||
|
||||
return indexes;
|
||||
|
@ -55,7 +55,7 @@ export class Omnibox extends Component {
|
||||
}
|
||||
|
||||
getSearchedCategories() {
|
||||
return ['commands', 'groups', 'subscriptions', 'other'];
|
||||
return ['commands', 'groups', 'subscriptions', 'apps', 'other'];
|
||||
}
|
||||
|
||||
control(evt) {
|
||||
@ -106,9 +106,6 @@ export class Omnibox extends Component {
|
||||
if (!this.state) {
|
||||
return [category, []];
|
||||
}
|
||||
if (category === 'apps') {
|
||||
return ['apps', this.state.index.get('apps')];
|
||||
}
|
||||
if (category === 'other') {
|
||||
return ['other', this.state.index.get('other')];
|
||||
}
|
||||
|
@ -31,9 +31,7 @@ export class OmniboxResult extends Component {
|
||||
|
||||
let graphic = <div />;
|
||||
if (defaultApps.includes(icon.toLowerCase()) || icon.toLowerCase() === 'links') {
|
||||
icon = (icon === 'Dojo') ? 'ChevronEast' : icon;
|
||||
icon = (icon === 'Link') ? 'Links' : icon;
|
||||
|
||||
graphic = <Icon display="inline-block" verticalAlign="middle" icon={icon} mr='2' size='16px' color={iconFill} />;
|
||||
} else if (icon === 'logout') {
|
||||
graphic = <Icon display="inline-block" verticalAlign="middle" icon='ArrowWest' mr='2' size='16px' color={iconFill} />;
|
||||
@ -42,7 +40,7 @@ export class OmniboxResult extends Component {
|
||||
} else if (icon === 'home') {
|
||||
graphic = <Icon display='inline-block' verticalAlign='middle' icon='Circle' mr='2' size='16px' color={iconFill} />;
|
||||
} else {
|
||||
graphic = <Icon verticalAlign="middle" mr='2' size="16px" color={iconFill} />;
|
||||
graphic = <Icon icon='NullIcon' verticalAlign="middle" mr='2' size="16px" color={iconFill} />;
|
||||
}
|
||||
|
||||
return graphic;
|
||||
|
Loading…
Reference in New Issue
Block a user