mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 02:09:24 +02:00
Moved Modal t set instance url to a separate dedicated file
SetInstanceModal.vue
This commit is contained in:
parent
8beb08d677
commit
1d7ad6978a
15 changed files with 205 additions and 103 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<div id="app" :key="String($store.state.instance.instanceUrl)">
|
||||
<!-- here, we display custom stylesheets, if any -->
|
||||
<link
|
||||
v-for="url in customStylesheets"
|
||||
|
@ -8,40 +8,16 @@
|
|||
:href="url"
|
||||
:key="url"
|
||||
>
|
||||
<div class="ui main text container instance-chooser" v-if="!$store.state.instance.instanceUrl">
|
||||
<div class="ui padded segment">
|
||||
<h1 class="ui header">
|
||||
<translate>Choose your instance</translate>
|
||||
</h1>
|
||||
<form class="ui form" @submit.prevent="$store.dispatch('instance/setUrl', instanceUrl)">
|
||||
<p>
|
||||
<translate>You need to select an instance in order to continue</translate>
|
||||
</p>
|
||||
<div class="ui action input">
|
||||
<input type="text" v-model="instanceUrl">
|
||||
<button type="submit" class="ui button">
|
||||
<translate>Submit</translate>
|
||||
</button>
|
||||
</div>
|
||||
<p>
|
||||
<translate>Suggested choices</translate>
|
||||
</p>
|
||||
<div class="ui bulleted list">
|
||||
<div class="ui item" v-for="url in suggestedInstances">
|
||||
<a @click="instanceUrl = url; $store.dispatch('instance/setUrl', url)">{{ url }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<template v-else>
|
||||
<template>
|
||||
<sidebar></sidebar>
|
||||
<set-instance-modal @update:show="showSetInstanceModal = $event" :show="showSetInstanceModal"></set-instance-modal>
|
||||
<service-messages v-if="messages.length > 0"/>
|
||||
<router-view :key="$route.fullPath"></router-view>
|
||||
<div class="ui fitted divider"></div>
|
||||
<app-footer
|
||||
:version="version"
|
||||
@show:shortcuts-modal="showShortcutsModal = !showShortcutsModal"
|
||||
@show:set-instance-modal="showSetInstanceModal = !showSetInstanceModal"
|
||||
></app-footer>
|
||||
<playlist-modal v-if="$store.state.auth.authenticated"></playlist-modal>
|
||||
<filter-modal v-if="$store.state.auth.authenticated"></filter-modal>
|
||||
|
@ -66,6 +42,7 @@ import locales from './locales'
|
|||
import PlaylistModal from '@/components/playlists/PlaylistModal'
|
||||
import FilterModal from '@/components/moderation/FilterModal'
|
||||
import ShortcutsModal from '@/components/ShortcutsModal'
|
||||
import SetInstanceModal from '@/components/SetInstanceModal'
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
|
@ -76,7 +53,8 @@ export default {
|
|||
PlaylistModal,
|
||||
ShortcutsModal,
|
||||
GlobalEvents,
|
||||
ServiceMessages
|
||||
ServiceMessages,
|
||||
SetInstanceModal,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
@ -84,6 +62,7 @@ export default {
|
|||
nodeinfo: null,
|
||||
instanceUrl: null,
|
||||
showShortcutsModal: false,
|
||||
showSetInstanceModal: false,
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
@ -131,12 +110,6 @@ export default {
|
|||
self.nodeinfo = response.data
|
||||
})
|
||||
},
|
||||
switchInstance () {
|
||||
let confirm = window.confirm(this.$gettext('This will erase your local data and disconnect you, do you want to continue?'))
|
||||
if (confirm) {
|
||||
this.$store.commit('instance/instanceUrl', null)
|
||||
}
|
||||
},
|
||||
autodetectLanguage () {
|
||||
let userLanguage = navigator.language || navigator.userLanguage
|
||||
let available = locales.locales.map(e => { return e.code })
|
||||
|
@ -257,7 +230,6 @@ export default {
|
|||
console.log('No momentjs locale available for', shortLocale)
|
||||
})
|
||||
})
|
||||
console.log(moment.locales())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue