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
+9
View File
@@ -8,6 +8,8 @@ import { fetchData } from './DataFetcher'
export const VersionIds = ['1.15', '1.16', '1.17', '1.18', '1.18.2', '1.19'] as const
export type VersionId = typeof VersionIds[number]
export const DEFAULT_VERSION: VersionId = '1.19'
export type BlockStateRegistry = {
[block: string]: {
properties?: {
@@ -49,6 +51,7 @@ const versionGetter: {
export let CachedDecorator: INode<any>
export let CachedFeature: INode<any>
export let CachedCollections: CollectionRegistry
export let CachedSchemas: SchemaRegistry
async function getVersion(id: VersionId): Promise<VersionData> {
if (!Versions[id]) {
@@ -121,6 +124,12 @@ export async function getBlockStates(version: VersionId): Promise<BlockStateRegi
return versionData.blockStates
}
export async function getSchemas(version: VersionId): Promise<SchemaRegistry> {
const versionData = await getVersion(version)
CachedSchemas = versionData.schemas
return versionData.schemas
}
export function checkVersion(versionId: string, minVersionId: string | undefined, maxVersionId?: string) {
const version = config.versions.findIndex(v => v.id === versionId)
const minVersion = minVersionId ? config.versions.findIndex(v => v.id === minVersionId) : 0