You've already forked AstralRinth
forked from didirus/AstralRinth
Monorepo missing features (#1273)
* fix tauri config * fix package patch * regen pnpm lock * use new workflow * New GH actions * Update lockfile * update scripts * Fix build script * Fix missing deps * Fix assets eslint * Update libraries lint * Fix all lint configs * update lockfile * add fmt + clippy fails * Separate App Tauri portion * fix app features * Fix lints * install tauri cli * update lockfile * corepack, fix lints * add store path * fix unused import * Fix tests * Issue templates + port over tauri release * fix actions * fix before build command * Add X86 target * Update build matrix * finalize actions * make debug build smaller * Use debug build to make cache smaller * dummy commit * change proj name * update file name * Use release builds for less space use * Remove rust cache * Readd for app build * add merge queue trigger
This commit is contained in:
83
apps/app-frontend/src/main.js
Normal file
83
apps/app-frontend/src/main.js
Normal file
@@ -0,0 +1,83 @@
|
||||
import { createApp } from 'vue'
|
||||
import router from '@/routes'
|
||||
import App from '@/App.vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import '@modrinth/assets/omorphia.scss'
|
||||
import '@/assets/stylesheets/global.scss'
|
||||
import 'floating-vue/dist/style.css'
|
||||
import FloatingVue from 'floating-vue'
|
||||
import { get_opening_command, initialize_state } from '@/helpers/state'
|
||||
import loadCssMixin from './mixins/macCssFix.js'
|
||||
import { get } from '@/helpers/settings'
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { isDev } from './helpers/utils.js'
|
||||
import { createPlugin } from '@vintl/vintl/plugin'
|
||||
|
||||
const VIntlPlugin = createPlugin({
|
||||
controllerOpts: {
|
||||
defaultLocale: 'en-US',
|
||||
locale: 'en-US',
|
||||
locales: [
|
||||
{
|
||||
tag: 'en-US',
|
||||
meta: {
|
||||
displayName: 'American English',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
globalMixin: true,
|
||||
injectInto: [],
|
||||
})
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
let app = createApp(App)
|
||||
app.use(router)
|
||||
app.use(pinia)
|
||||
app.use(FloatingVue)
|
||||
app.mixin(loadCssMixin)
|
||||
app.use(VIntlPlugin)
|
||||
|
||||
const mountedApp = app.mount('#app')
|
||||
|
||||
const raw_invoke = async (plugin, fn, args) => {
|
||||
if (plugin === '') {
|
||||
await invoke(fn, args)
|
||||
} else {
|
||||
await invoke('plugin:' + plugin + '|' + fn, args)
|
||||
}
|
||||
}
|
||||
isDev()
|
||||
.then((dev) => {
|
||||
if (dev) {
|
||||
window.raw_invoke = raw_invoke
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
initialize_state()
|
||||
.then(() => {
|
||||
// First, redirect to other landing page if we have that setting
|
||||
get()
|
||||
.then((fetchSettings) => {
|
||||
if (fetchSettings?.default_page && fetchSettings?.default_page !== 'Home') {
|
||||
router.push({ name: fetchSettings?.default_page })
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
.finally(() => {
|
||||
mountedApp.initialize()
|
||||
get_opening_command().then((command) => {
|
||||
console.log(JSON.stringify(command)) // change me to use whatever FE command handler is made
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Failed to initialize app', err)
|
||||
mountedApp.failure(err)
|
||||
})
|
||||
Reference in New Issue
Block a user