From ae536ba58476981d1984b18b496966d6d442709f Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Wed, 18 Oct 2023 16:10:54 +0100 Subject: [PATCH] =?UTF-8?q?[=E2=9C=A8]=20Created=20basic=20manager=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/manager.ts | 40 ++++++++++++++++++++++++++++++++++++++++ src/flow.ts | 8 +++++--- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/apps/manager.ts diff --git a/src/apps/manager.ts b/src/apps/manager.ts new file mode 100644 index 0000000..cfc064f --- /dev/null +++ b/src/apps/manager.ts @@ -0,0 +1,40 @@ +import icon from '../assets/icons/manager.png' +import { App } from '../types.ts' +import { FlowWindow } from '../wm.ts' + +export default class ManagerApp implements App { + name = 'Manager' + pkg = 'flow.manager' + icon = icon + version = '1.0.0' + + async open (): Promise { + const win = window.wm.createWindow({ + title: this.name, + icon, + width: 350, + height: 500 + }) + + win.content.style.display = 'flex' + win.content.style.flexDirection = 'column' + win.content.style.gap = '10px' + win.content.style.padding = '10px' + win.content.style.background = 'var(--base)' + win.content.innerHTML = ` + ${window.flow.apps.map(app => { + return ` +
+ +
+

${app.name} ${(app.builtin ?? false) ? '(builtin)' : ''}

+

${app.pkg} (v${app.version})

+
+
+ ` + }).join('')} + ` + + return win + } +} diff --git a/src/flow.ts b/src/flow.ts index 83ce7e9..151deef 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -1,13 +1,14 @@ -import { App } from './types.ts' +import { App, LoadedApp } from './types.ts' class Flow { - apps: App[] = [] + apps: LoadedApp[] = [] appList = [ 'settings', 'music', 'files', 'editor', - 'info' + 'info', + 'manager' ] async init (): Promise { @@ -17,6 +18,7 @@ class Flow { for (const appPath of this.appList) { const { default: ImportedApp } = await import(`./apps/${appPath}.ts`) const app = new ImportedApp() + app.builtin = true window.preloader.setStatus(`importing default apps\n${appPath}`) this.add(app)