Skip to content

Commit

Permalink
[v1.7.0] Merge pull request #239 from bridge-core/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
solvedDev authored Jul 18, 2020
2 parents 9bbc7f6 + fa403d5 commit de988a5
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 72 deletions.
2 changes: 0 additions & 2 deletions app/renderer/src/AppCycle/startUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default async function startUp() {
CONNECTION.startListening()

setupDefaultMenus()
/* No longer needed - discord link on welcome screen
if (process.env.NODE_ENV !== 'development') {
let discord_msg = createNotification({
icon: 'mdi-discord',
Expand All @@ -35,7 +34,6 @@ export default async function startUp() {
},
})
}
*/

// Fetch the latest json/version data
fetchLatestJson().then(updateData => {
Expand Down
11 changes: 6 additions & 5 deletions app/renderer/src/UI/ContextMenu/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,19 @@ export const FILE_CONTEXT_MENU = async (
},
async (new_name: string) => {
const CLOSED = TabSystem.closeByPath(file_path)
const NEW_PATH = path.join(
const newPath = path.join(
path.dirname(file_path),
path.dirname(new_name),
path.basename(new_name)
)

await fs.mkdir(path.dirname(NEW_PATH), {
await fs.mkdir(path.dirname(newPath), {
recursive: true,
})
await fs.rename(file_path, NEW_PATH)
await fs.rename(file_path, newPath)

await file.update(
NEW_PATH,
newPath,
path.join(
path.dirname(file.path),
path.dirname(new_name),
Expand All @@ -90,7 +91,7 @@ export const FILE_CONTEXT_MENU = async (
)
await file.parent.refresh()

if (CLOSED) FileSystem.open(NEW_PATH)
if (CLOSED) FileSystem.open(newPath)
}
)
},
Expand Down
54 changes: 30 additions & 24 deletions app/renderer/src/UI/ProjectScreen/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@
@closeWindow="isVisible.value = false"
>
<template #default>
<ProjectCard
v-for="({
projectPath,
version,
name,
description,
author,
relativeProjectPath,
},
i) in LoadedProjects"
:key="projectPath"
:style="
`display: inline-block; margin-left: ${12 *
(i % 4 !==
0)}px; margin-bottom: 12px; width: calc(25% - 9px);`
"
:relativeProjectPath="relativeProjectPath"
:projectPath="projectPath"
:projectVersion="version"
:projectName="name"
:projectDescription="description"
:projectAuthor="author"
/>
<div class="card-container">
<ProjectCard
v-for="({
projectPath,
version,
name,
description,
author,
relativeProjectPath,
},
i) in LoadedProjects"
:key="projectPath"
:style="
`display: inline-block; margin-left: ${12 *
(i % 4 !== 0)}px; margin-bottom: 12px;`
"
:relativeProjectPath="relativeProjectPath"
:projectPath="projectPath"
:projectVersion="version"
:projectName="name"
:projectDescription="description"
:projectAuthor="author"
/>
</div>
</template>

<!-- <template #actions>
Expand Down Expand Up @@ -61,4 +62,9 @@ export default {
}
</script>

<style></style>
<style scoped>
.card-container {
display: grid;
grid-template-columns: repeat(4, minmax(150px, 25%));
}
</style>
20 changes: 14 additions & 6 deletions app/renderer/src/UI/Sidebar/Content/explorer/FileDisplayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
v-if="
first && file_explorer.children === 0 && !file_explorer.is_loading
"
>This directory has no content.</p>
>
This directory has no content.
</p>
<v-progress-linear v-else-if="file_explorer.is_loading" indeterminate />
<div :style="element_style" :class="element_class" v-else>
<draggable
Expand All @@ -16,7 +18,12 @@
>
<template v-for="file in file_explorer.children">
<!--LOADING-->
<v-skeleton-loader v-if="file.is_loading" :key="file.absolute_path" height="21" type="text" />
<v-skeleton-loader
v-if="file.is_loading"
:key="file.absolute_path"
height="21"
type="text"
/>
<!--FOLDER-->
<details
v-else-if="file.is_folder"
Expand All @@ -41,9 +48,9 @@
<v-icon class="open" small>mdi-folder-open</v-icon>
<v-icon class="closed" small>
{{
file.absolute_path.includes('cache')
? 'mdi-folder-lock'
: 'mdi-folder'
file.absolute_path.includes('cache')
? 'mdi-folder-lock'
: 'mdi-folder'
}}
</v-icon>
<span class="folder">{{ file.name }}</span>
Expand Down Expand Up @@ -198,9 +205,10 @@ export default {
path.join(this.file_explorer.absolute_path, name)
)
added.element.update(
this.file_explorer.absolute_path,
path.join(this.file_explorer.absolute_path, name),
this.file_explorer.path
)
added.element.parent = this.file_explorer
} catch (e) {
new InformationWindow(
'ERROR',
Expand Down
40 changes: 23 additions & 17 deletions app/renderer/src/UI/Sidebar/FileExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ export class FileExplorer {

async update(absolute_path: string, f_path: string) {
if (this.is_loading) await this.loading_promise
const newAbsolutePath = path.join(absolute_path, this.name)
if (!this.is_folder) {
await Promise.all([
OmegaCache.rename(this.absolute_path, newAbsolutePath),
LightningCache.rename(this.absolute_path, newAbsolutePath),
JSONFileMasks.rename(this.absolute_path, newAbsolutePath),
OmegaCache.rename(this.absolute_path, absolute_path),
LightningCache.rename(this.absolute_path, absolute_path),
JSONFileMasks.rename(this.absolute_path, absolute_path),
])
}

this.absolute_path = newAbsolutePath
this.absolute_path = absolute_path
this.name = path.basename(absolute_path)
this.path = path.join(f_path, this.name)

if (!this.loaded_children && this.is_folder) await this.load()
Expand Down Expand Up @@ -210,31 +210,37 @@ export class FileExplorer {
}
this.parent.updateUUID()
}
async duplicate(new_name: string, open = true) {
if (this.parent.find(new_name) !== undefined)
async duplicate(newName: string, open = true) {
if (this.parent.find(newName) !== undefined)
return new InformationWindow(
'Error',
`A file with the name "${new_name}" already exists`
`A file with the name "${newName}" already exists`
)
let new_path = path.join(path.dirname(this.absolute_path), new_name)
let newAbsolutePath = path.join(
path.dirname(this.absolute_path),
newName
)

await Promise.all([
OmegaCache.duplicate(this.absolute_path, new_path).catch(() => {}),
LightningCache.duplicate(this.absolute_path, new_path),
JSONFileMasks.duplicate(this.absolute_path, new_path),
fs.copyFile(this.absolute_path, new_path),
OmegaCache.duplicate(
this.absolute_path,
newAbsolutePath
).catch(() => {}),
LightningCache.duplicate(this.absolute_path, newAbsolutePath),
JSONFileMasks.duplicate(this.absolute_path, newAbsolutePath),
fs.copyFile(this.absolute_path, newAbsolutePath),
])

this.parent.children.push(
new FileExplorer(
this.parent,
path.join(this.parent.path, new_name),
new_path,
path.join(this.parent.path, newName),
newAbsolutePath,
false
)
)
if (open)
FileSystem.open(path.join(this.parent.absolute_path, new_name))
if (open) FileSystem.open(path.join(this.parent.absolute_path, newName))
this.parent.sort()
this.parent.updateUUID()
}
rename(val: string) {
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/editor/LightningCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default class LightningCache {
}
}

static async load(filePath?: string): Promise<LightningCacheData> {
static async load(): Promise<LightningCacheData> {
if (this.globalCache !== undefined) return this.globalCache

try {
Expand Down
5 changes: 1 addition & 4 deletions app/renderer/src/editor/OmegaCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,11 @@ export default class OmegaCache {
try {
await fsp.mkdir(path.dirname(newCachePath), { recursive: true })
} catch {}
console.log(oldCachePath, newCachePath)

try {
await fsp.copyFile(oldCachePath, newCachePath)
this.clear(old_path)
} catch (e) {
console.error(e)
}
} catch {}
}
static async duplicate(what: string, as: string) {
if (!this.mayBeCached(as)) return
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/editor/Themes/ThemeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class ThemeManager {
else this.plugin_themes[id] = theme
}

static applyTheme(id: string) {
static applyTheme(id = 'bridge.default.theme') {
this.current_theme = id
const theme =
this.themes[id] ||
Expand Down
2 changes: 2 additions & 0 deletions app/renderer/store/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ function setup() {
if (DATA.target_version !== undefined) save({ target_version: undefined })
if (DATA.text_auto_completions !== undefined)
save({ text_auto_completions: undefined })
if (DATA.global_theme === undefined)
save({ global_theme: 'bridge.default.theme' })
}
function save(settings: { [s: string]: any }) {
if (DATA) DATA = Object.assign(DATA, settings)
Expand Down
2 changes: 1 addition & 1 deletion app/shared/app_version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Current bridge. app version
*/
export default 'v1.7.0-pre10'
export default 'v1.7.0'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "1.7.0-pre10",
"version": "1.7.0",
"author": "solvedDev <[email protected]>",
"description": "A powerful add-on editor",
"license": "GNU",
Expand Down
23 changes: 13 additions & 10 deletions static/auto_completions/simple/sound_definitions.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"$placeholder": {
"category": [ "weather", "block", "hostile", "player", "neutral", "bucket", "record", "ui" ],
"min_distance": "$general.decimal",
"sounds": {
"$dynamic.list.next_index": {
"name": { "@meta": { "is_value": true }, "@import.value": "$dynamic.rp.sound_file" },
"stream": "$general.boolean",
"load_on_low_memory": "$general.boolean",
"volume": "$general.decimal",
"@import.value": "$dynamic.rp.sound_file"
"format_version": "$general.format_version",
"sound_definitions": {
"$placeholder": {
"category": [ "weather", "block", "hostile", "player", "neutral", "bucket", "record", "ui" ],
"min_distance": "$general.decimal",
"sounds": {
"$dynamic.list.next_index": {
"name": { "@meta": { "is_value": true }, "@import.value": "$dynamic.rp.sound_file" },
"stream": "$general.boolean",
"load_on_low_memory": "$general.boolean",
"volume": "$general.decimal",
"@import.value": "$dynamic.rp.sound_file"
}
}
}
}
Expand Down

0 comments on commit de988a5

Please sign in to comment.