This commit is contained in:
Parrot 2023-10-17 22:34:11 +00:00
commit 00d8726ca3
5 changed files with 30 additions and 37 deletions

View file

@ -13,20 +13,20 @@
[![build](https://github.com/Flow-Works/FlowOS-2.0/actions/workflows/build.yml/badge.svg)](https://github.com/Flow-Works/FlowOS-2.0/actions/workflows/build.yml) [![build](https://github.com/Flow-Works/FlowOS-2.0/actions/workflows/build.yml/badge.svg)](https://github.com/Flow-Works/FlowOS-2.0/actions/workflows/build.yml)
<br> <br>
<i>The future of Flow OS</i> <i>The future of FlowOS</i>
<br> <br>
<a href="https://docs.flow-works.me"><strong>Read the docs »</strong></a> <a href="https://docs.flow-works.me"><strong>Read the docs »</strong></a>
<br> <br>
</div> </div>
## What is Flow OS? ## What is FlowOS?
Flow OS is a web OS proxy made for the Titanium Network 2023 Proxathon. It's extremly customizable with an API to make your own apps, themes, and modules. FlowOS is a web OS proxy made for the Titanium Network 2023 Proxathon. It's extremly customizable with an API to make your own apps, themes, and modules.
## Getting Started ## Getting Started
To run Flow OS on your local machine, you need Node.js 16 or above. To run FlowOS on your local machine, you need Node.js 16 or above.
1. Clone the repository 1. Clone the repository
```bash ```bash
@ -44,7 +44,7 @@ npm run serve
## Made with ## Made with
Flow OS is made with the following software: FlowOS is made with the following software:
* [Filer](https://github.com/filerjs/filer) * [Filer](https://github.com/filerjs/filer)
* [Prism Code Editor](https://github.com/FIameCaster/prism-code-editor) * [Prism Code Editor](https://github.com/FIameCaster/prism-code-editor)
* [Vite](https://vitejs.dev) * [Vite](https://vitejs.dev)

View file

@ -34,7 +34,7 @@ export default class EditorApp implements App {
}) })
if (data != null) { if (data != null) {
win.setTitle('Editor - ' + data.path) win.setTitle(`Editor - ${data.path}`)
win.content.style.display = 'flex' win.content.style.display = 'flex'
win.content.style.flexDirection = 'column' win.content.style.flexDirection = 'column'
@ -99,33 +99,29 @@ export default class EditorApp implements App {
const fileBtn = win.content.querySelector('#file-open') const fileBtn = win.content.querySelector('#file-open')
const editBtn = win.content.querySelector('#edit-open') const editBtn = win.content.querySelector('#edit-open')
const toggleDropdown = function (id: string): void { const toggleDropdown = (id: string): void => {
const el = win.content.querySelector(`#${id}`) const el = win.content.querySelector(`#${id}`)
el?.classList.toggle('show') el?.classList.toggle('show')
} }
fileBtn?.addEventListener('click', function (e) { fileBtn?.addEventListener('click', (e) => {
e.stopPropagation() e.stopPropagation()
toggleDropdown('file') toggleDropdown('file')
}) })
editBtn?.addEventListener('click', function (e) { editBtn?.addEventListener('click', (e) => {
e.stopPropagation() e.stopPropagation()
toggleDropdown('edit') toggleDropdown('edit')
}) })
win.content.addEventListener('click', function () { win.content.addEventListener('click', () => {
const file = win.content.querySelector('#file') const file = (win.content.querySelector('#file') as HTMLElement)
const edit = win.content.querySelector('#edit') const edit = (win.content.querySelector('#edit') as HTMLElement)
if (file !== null) { if (file.classList.contains('show')) {
if (file.classList.contains('show')) { toggleDropdown('file')
toggleDropdown('file')
}
} }
if (edit !== null) { if (edit.classList.contains('show')) {
if (edit.classList.contains('show')) { toggleDropdown('edit')
toggleDropdown('edit')
}
} }
}) })

View file

@ -39,22 +39,22 @@ export default class FilesApp implements App {
if (back !== '<i class=\'bx bx-arrow-to-left\'></i>') { if (back !== '<i class=\'bx bx-arrow-to-left\'></i>') {
(win.content.querySelector('.back') as HTMLElement).onclick = async () => { (win.content.querySelector('.back') as HTMLElement).onclick = async () => {
if (dir.split('/')[1] === dir.replace('/', '')) { if (dir.split('/')[1] === dir.replace('/', '')) {
await setDir('/' + dir.split('/')[0]) await setDir(`/${dir.split('/')[0]}`)
} else { } else {
await setDir('/' + dir.split('/')[1]) await setDir(`/${dir.split('/')[1]}`)
} }
} }
} }
(win.content.querySelector('.file') as HTMLElement).onclick = async () => { (win.content.querySelector('.file') as HTMLElement).onclick = async () => {
const title: string = prompt('Enter file name') ?? 'new-file.txt' const title: string = prompt('Enter file name') ?? 'new-file.txt'
await window.fs.promises.open(dir + '/' + title, 'w') await window.fs.promises.open(`${dir}/${title}`, 'w')
await setDir(dir) await setDir(dir)
} }
(win.content.querySelector('.folder') as HTMLElement).onclick = async () => { (win.content.querySelector('.folder') as HTMLElement).onclick = async () => {
const title: string = prompt('Enter folder name') ?? 'new-folder' const title: string = prompt('Enter folder name') ?? 'new-folder'
await window.fs.promises.mkdir(dir + '/' + title) await window.fs.promises.mkdir(`${dir}/${title}`)
await setDir(dir) await setDir(dir)
} }

View file

@ -27,15 +27,16 @@ class StatusBar {
add (item: StatusItem): void { add (item: StatusItem): void {
if (this.items.some(x => x.meta.id === item.meta.id)) { if (this.items.some(x => x.meta.id === item.meta.id)) {
console.error(`Unable to register tool; ${item.meta.id} is already registered.`) console.error(`Unable to register tool; ${item.meta.id} is already registered.`)
} else { return
const element = document.createElement('div')
element.setAttribute('data-toolbar-id', item.meta.id)
this.items.push(item)
this.element.appendChild(element)
item.run(element)
} }
const element = document.createElement('div')
element.setAttribute('data-toolbar-id', item.meta.id)
this.items.push(item)
this.element.appendChild(element)
item.run(element)
} }
} }

View file

@ -185,11 +185,7 @@ class WM {
const max = Math.max(...indexes) const max = Math.max(...indexes)
if (max === -Infinity) { return max === -Infinity ? 0 : max
return 0
} else {
return max
}
} }
createWindow (config: FlowWindowConfig): FlowWindow { createWindow (config: FlowWindowConfig): FlowWindow {