[⚡] Add search bar functionality #39
This commit is contained in:
parent
446f6fe58d
commit
22de1591af
3 changed files with 34 additions and 6 deletions
|
|
@ -6,7 +6,7 @@ export default class SettingsApp implements App {
|
||||||
meta = {
|
meta = {
|
||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
pkg: 'flow.settings',
|
pkg: 'flow.settings',
|
||||||
icon: icon,
|
icon,
|
||||||
version: '1.0.0'
|
version: '1.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,18 +144,20 @@ launcher {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin: 40px;
|
margin: 40px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
|
flex-wrap: wrap;
|
||||||
grid-template-rows: repeat(auto-fit, minmax(200px, 1fr));
|
|
||||||
gap: 40px;
|
gap: 40px;
|
||||||
|
|
||||||
app {
|
app {
|
||||||
|
flex: 1 0 21%;
|
||||||
|
flex-grow: 0;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
height: max-content;
|
min-width: 125px;
|
||||||
|
max-width: 125px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
|
|
||||||
28
src/wm.ts
28
src/wm.ts
|
|
@ -223,7 +223,33 @@ class WM {
|
||||||
this.launcher.innerHTML = `
|
this.launcher.innerHTML = `
|
||||||
<input placeholder="Search"/>
|
<input placeholder="Search"/>
|
||||||
<apps></apps>
|
<apps></apps>
|
||||||
`
|
`;
|
||||||
|
|
||||||
|
(this.launcher.querySelector('input') as HTMLInputElement).onkeyup = () => {
|
||||||
|
(this.launcher.querySelector('apps') as HTMLElement).innerHTML = ''
|
||||||
|
if ((this.launcher.querySelector('input') as HTMLInputElement).value !== '') {
|
||||||
|
window.flow.apps.filter(x => x.meta.name.toLowerCase().includes((this.launcher.querySelector('input') as HTMLInputElement).value.toLowerCase())).forEach((app) => {
|
||||||
|
const appElement = document.createElement('app')
|
||||||
|
appElement.onclick = async () => {
|
||||||
|
await window.flow.openApp(app.meta.pkg)
|
||||||
|
this.toggleLauncher()
|
||||||
|
}
|
||||||
|
appElement.innerHTML = `<img src="${app.meta.icon}"><div>${app.meta.name}</div>`
|
||||||
|
this.launcher.querySelector('apps')?.appendChild(appElement)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
window.flow.apps.forEach((app) => {
|
||||||
|
window.preloader.setStatus(`adding apps to app launcher\n${app.meta.name}`)
|
||||||
|
const appElement = document.createElement('app')
|
||||||
|
appElement.onclick = async () => {
|
||||||
|
await window.flow.openApp(app.meta.pkg)
|
||||||
|
window.wm.toggleLauncher()
|
||||||
|
}
|
||||||
|
appElement.innerHTML = `<img src="${app.meta.icon}"><div>${app.meta.name}</div>`
|
||||||
|
window.wm.launcher.querySelector('apps')?.appendChild(appElement)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.launcher.onclick = (e) => {
|
this.launcher.onclick = (e) => {
|
||||||
if (e.target !== e.currentTarget) return
|
if (e.target !== e.currentTarget) return
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue