mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
ab35cdb92f
commit 56e4933c639ff32ea18470ae1534fa4d06b448e3 Author: root <root@git.maharshi.ninja> Date: Tue Jan 4 11:09:22 2022 +0530 Also format dates commit 01d379537b2e41819e2093b33dfd2a026bcb7281 Author: root <root@git.maharshi.ninja> Date: Sun Jan 2 13:48:36 2022 +0530 Another Bengali translation update commit 53063d4265f85db7be14135ffaa095647f233841 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 11:41:44 2022 +0530 Standardize to BCP47 and adjust commit 1b48f79cce411f8d18cf9e5059916b1c50719cd5 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 11:17:28 2022 +0530 Localized number formatting + Bengali translations update commit 6b3e30db37338334f03d98b92d124741446fb470 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 10:41:27 2022 +0530 Fix fontloading commit 5b08962971f8edb5030bc5ba79972bbb209b3d31 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 10:38:29 2022 +0530 Even more standardization commit bc6a4dfb335647472ea091b302b627f475bed879 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 10:25:29 2022 +0530 Rename as per BCP-47 and standardize commit 106f84fa0486d19504fd244aaab41f9cd4a8a513 Author: root <root@git.maharshi.ninja> Date: Sat Jan 1 10:13:32 2022 +0530 i18n on steroids
199 lines
4.7 KiB
Vue
199 lines
4.7 KiB
Vue
<template>
|
|
<v-app :style="bgStyles">
|
|
<v-app-bar
|
|
app
|
|
color="primary"
|
|
dark
|
|
v-if="$vuetify.breakpoint.width > 1675"
|
|
>
|
|
<!-- ^^^ The above breakpoint is manually determined to be the minimum sustainable width where everything works w/o overlapping -->
|
|
<!-- Might need changing when buttons change -->
|
|
<v-row dense align="center" justify="center">
|
|
<v-col md="1" v-for="link in links" :key="link.id">
|
|
<v-btn
|
|
text
|
|
link
|
|
min-width="100%"
|
|
:to="link.to"
|
|
>
|
|
{{ $t(link.name) }}
|
|
</v-btn>
|
|
</v-col>
|
|
<v-col md="1">
|
|
<AuthenticationModal />
|
|
</v-col>
|
|
<v-col cols="auto" class="ml-2">
|
|
<v-btn icon @click="toggleDarkMode"><v-icon>mdi-brightness-6</v-icon></v-btn>
|
|
</v-col>
|
|
<v-col md="2">
|
|
<v-select
|
|
class="mt-6"
|
|
dense
|
|
:items="languageOptions"
|
|
label="Language"
|
|
:value="$i18n.locale"
|
|
@input="changeLocale"
|
|
outlined
|
|
/>
|
|
</v-col>
|
|
<v-col>
|
|
<SearchMenu />
|
|
</v-col>
|
|
</v-row>
|
|
</v-app-bar>
|
|
<div v-else>
|
|
<v-navigation-drawer
|
|
v-model="drawer"
|
|
app
|
|
>
|
|
<v-list nav>
|
|
<v-list-item
|
|
v-for="link in links"
|
|
:key="link.id"
|
|
link
|
|
:to="link.to"
|
|
>
|
|
{{ $t(link.name) }}
|
|
</v-list-item>
|
|
<AuthenticationModal :list-mode="true" />
|
|
</v-list>
|
|
<v-switch
|
|
dense
|
|
class="mx-2 mt-0 pt-0"
|
|
:input-value="$store.getters['prefs/getPreferenceBoolean']('darkMode', false)"
|
|
@change="toggleDarkMode"
|
|
label="Dark Mode"
|
|
/>
|
|
<v-select
|
|
dense
|
|
:items="languageOptions"
|
|
label="Language"
|
|
:value="$i18n.locale"
|
|
@input="changeLocale"
|
|
outlined
|
|
class="mx-2"
|
|
/>
|
|
<SearchMenu class="mx-2" />
|
|
</v-navigation-drawer>
|
|
|
|
<v-app-bar app color="primary" dark>
|
|
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
|
|
|
|
<v-toolbar-title>Piped Material</v-toolbar-title>
|
|
</v-app-bar>
|
|
</div>
|
|
|
|
<v-main>
|
|
<router-view />
|
|
</v-main>
|
|
</v-app>
|
|
</template>
|
|
|
|
<script>
|
|
import SearchMenu from '@/routes/SearchMenu'
|
|
import { changeLocale } from '@/plugins/i18n'
|
|
import AuthenticationModal from '@/components/AuthenticationModal'
|
|
|
|
export default {
|
|
name: 'App',
|
|
components: {
|
|
AuthenticationModal,
|
|
SearchMenu
|
|
},
|
|
metaInfo () {
|
|
return {
|
|
title: this.$t('titles.homepage'),
|
|
// all titles will be injected into this template
|
|
titleTemplate: '%s - Piped'
|
|
}
|
|
},
|
|
|
|
data: () => ({
|
|
languageOptions: [
|
|
{ value: 'en', text: 'English' },
|
|
{ value: 'fr', text: 'French' },
|
|
{ value: 'de', text: 'German' },
|
|
{ value: 'el', text: 'Greek' },
|
|
{ value: 'zh-Hans', text: 'Chinese (Simplified, only loads the font)' },
|
|
{ value: 'zh-Hant', text: 'Chinese (Traditional)' },
|
|
{ value: 'ja', text: 'Japanese (only loads fonts)' },
|
|
{ value: 'ko', text: 'Korean (only loads fonts)' },
|
|
{ value: 'ru', text: 'Russian (only loads fonts)' },
|
|
{ value: 'lt', text: 'Lithuanian' },
|
|
{ value: 'ml', text: 'Malayalam' },
|
|
{ value: 'nb-NO', text: 'Norwegian Bokmål' },
|
|
{ value: 'tr', text: 'Turkish' },
|
|
{ value: 'bn-Beng', text: 'Bengali (বাংলা)' }
|
|
// Incomplete, DO NOT USE
|
|
/* { value: 'bn_latn', text: 'Bengali (Latin)' }, */
|
|
].sort((a, b) => {
|
|
return a.text.localeCompare(b.text)
|
|
}),
|
|
drawer: false
|
|
}),
|
|
|
|
computed: {
|
|
bgStyles () {
|
|
return {
|
|
backgroundColor: this.$vuetify.theme.dark ? '#282828' : '#fbf1c7'
|
|
}
|
|
},
|
|
|
|
links () {
|
|
const links = [
|
|
{
|
|
id: 'trending',
|
|
name: 'titles.trending',
|
|
to: '/trending'
|
|
},
|
|
{
|
|
id: 'prefs',
|
|
name: 'titles.preferences',
|
|
to: '/preferences'
|
|
},
|
|
{
|
|
id: 'watch-history',
|
|
name: 'titles.history',
|
|
to: '/watch-history'
|
|
}
|
|
]
|
|
|
|
if (this.$store.getters['auth/isCurrentlyAuthenticated']) {
|
|
links.splice(0, 0, {
|
|
id: 'feed',
|
|
name: 'titles.feed',
|
|
to: '/feed'
|
|
})
|
|
}
|
|
|
|
return links
|
|
}
|
|
},
|
|
|
|
watch: {
|
|
'$store.state.prefs.prefs.darkMode' (newVal) {
|
|
this.$vuetify.theme.dark = newVal
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
changeLocale (lang) {
|
|
return changeLocale(lang)
|
|
},
|
|
|
|
toggleDarkMode () {
|
|
this.$vuetify.theme.dark = !this.$vuetify.theme.dark
|
|
this.$store.commit('prefs/setPrefs', {
|
|
id: 'darkMode',
|
|
value: this.$vuetify.theme.dark
|
|
})
|
|
}
|
|
},
|
|
|
|
created () {
|
|
this.$store.dispatch('prefs/loadState')
|
|
this.$store.dispatch('auth/initializeAuth')
|
|
}
|
|
}
|
|
</script>
|