2023-08-26 09:33:05 +00:00
|
|
|
import App from './App.svelte';
|
2023-08-25 20:33:11 +00:00
|
|
|
|
2024-11-01 20:10:28 +00:00
|
|
|
import { WindowSetTitle } from "../wailsjs/runtime/runtime"
|
|
|
|
|
|
|
|
|
|
import {currentProject, needProjectSave} from './stores.js';
|
|
|
|
|
|
2023-08-26 09:33:05 +00:00
|
|
|
// Load dictionaries
|
|
|
|
|
import { addMessages, init } from 'svelte-i18n';
|
|
|
|
|
|
|
|
|
|
// Import dictionaries
|
|
|
|
|
import en from './lang/en.json';
|
|
|
|
|
|
|
|
|
|
// Add dictionaries to svelte-i18n
|
|
|
|
|
addMessages('en', en);
|
|
|
|
|
|
|
|
|
|
// Initialize svelte-i18n dictionaries
|
|
|
|
|
init({
|
|
|
|
|
fallbackLocale: 'en',
|
|
|
|
|
initialLocale: 'en',
|
2024-11-01 20:10:28 +00:00
|
|
|
});
|
2023-08-26 09:33:05 +00:00
|
|
|
|
|
|
|
|
// Create the main app
|
2023-08-25 20:33:11 +00:00
|
|
|
const app = new App({
|
2023-08-26 09:33:05 +00:00
|
|
|
target: document.body,
|
|
|
|
|
});
|
2023-08-25 20:33:11 +00:00
|
|
|
|
2024-11-01 20:10:28 +00:00
|
|
|
// Set the initial title
|
|
|
|
|
WindowSetTitle("DMXConnect")
|
|
|
|
|
|
|
|
|
|
// When the current project data is modified, pass it to unsaved and change the title
|
|
|
|
|
let title;
|
|
|
|
|
currentProject.subscribe(value => {
|
|
|
|
|
needProjectSave.set(true)
|
|
|
|
|
title = value.Name
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// If the project need to be saved, show the information in the title
|
|
|
|
|
needProjectSave.subscribe(value => {
|
|
|
|
|
if (value) {
|
|
|
|
|
console.log(`<!> The current project need to be save`);
|
|
|
|
|
WindowSetTitle("DMXConnect - " + title + " (unsaved)")
|
|
|
|
|
} else {
|
|
|
|
|
WindowSetTitle("DMXConnect - " + title)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2023-08-26 09:33:05 +00:00
|
|
|
export default app;
|