leap: restore app index, remove from default

This commit is contained in:
Matilde Park 2020-10-08 18:30:55 -04:00
parent 8559d9d7de
commit a2fbf8c51c
3 changed files with 27 additions and 7 deletions

View File

@ -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;

View File

@ -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')];
}

View File

@ -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;