Project tree view and creation (#203)

* Implement creating and importing new projects

* Add downloading a zip of a project

* Project validation (WIP)

* Add project side panel, remove project pages

* Project file saving

* Add file tree actions to rename and delete

* Fix file creation auto focus

* Add button to save file from menu

* Add project creation

* Fix specificity on version switcher button

* Update default version to 1.19

* List project files by type, remember project and delete project
This commit is contained in:
Misode
2022-06-14 16:48:55 +02:00
committed by GitHub
parent 4942729e7c
commit 90eac0f9b8
39 changed files with 1132 additions and 267 deletions

View File

@@ -1,7 +1,7 @@
import { getCurrentUrl, Link, route } from 'preact-router'
import { Btn, BtnMenu, Icons, Octicon } from '.'
import config from '../../config.json'
import { useLocale, useTheme, useTitle, useVersion } from '../contexts'
import { useLocale, useProject, useTheme, useTitle, useVersion } from '../contexts'
import { checkVersion } from '../services'
import { cleanUrl, getGenerator } from '../Utils'
@@ -15,8 +15,10 @@ export function Header() {
const { lang, locale, changeLocale: changeLanguage } = useLocale()
const { theme, changeTheme } = useTheme()
const { version } = useVersion()
const { projects, project, changeProject } = useProject()
const { title } = useTitle()
const gen = getGenerator(getCurrentUrl())
const url = getCurrentUrl()
const gen = getGenerator(url)
return <header>
<div class="title">
@@ -29,6 +31,11 @@ export function Header() {
<Btn label={locale(g.partner ? `partner.${g.partner}.${g.id}` : g.id)} active={g.id === gen.id} onClick={() => route(cleanUrl(g.url))} />
)}
</BtnMenu>}
{!gen && url.match(/\/?project\/?$/) && <BtnMenu icon="chevron_down" tooltip={locale('switch_project')}>
{projects.map(p =>
<Btn label={p.name} active={p.name === project.name} onClick={() => changeProject(p.name)} />
)}
</BtnMenu>}
</div>
<nav>
<ul>