feat(link shares): hide the logo if a query parameter was passed

This commit is contained in:
kolaente 2022-09-07 21:49:14 +02:00 committed by Gitea
parent b8d77a617b
commit 63f5f446fd
5 changed files with 18 additions and 5 deletions

View file

@ -6,8 +6,9 @@
>
<div class="container has-text-centered link-share-view">
<div class="column is-10 is-offset-1">
<Logo class="logo"/>
<Logo class="logo" v-if="logoVisible"/>
<h1
:class="{'m-0': !logoVisible}"
:style="{ 'opacity': currentList.title === '' ? '0': '1' }"
class="title">
{{ currentList.title === '' ? $t('misc.loading') : currentList.title }}
@ -31,6 +32,7 @@ import PoweredByLink from './PoweredByLink.vue'
const store = useStore()
const currentList = computed(() => store.state.currentList)
const background = computed(() => store.state.background)
const logoVisible = computed(() => store.state.logoVisible)
</script>
<style lang="scss" scoped>

View file

@ -9,7 +9,7 @@ import {
HAS_TASKS,
KEYBOARD_SHORTCUTS_ACTIVE,
LOADING,
LOADING_MODULE,
LOADING_MODULE, LOGO_VISIBLE,
MENU_ACTIVE,
QUICK_ACTIONS_ACTIVE,
} from './mutation-types'
@ -62,6 +62,7 @@ export const store = createStore<RootStoreState>({
menuActive: true,
keyboardShortcutsActive: false,
quickActionsActive: false,
logoVisible: true,
}),
mutations: {
[LOADING](state, loading) {
@ -100,6 +101,9 @@ export const store = createStore<RootStoreState>({
[BLUR_HASH](state, blurHash) {
state.blurHash = blurHash
},
[LOGO_VISIBLE](state, visible: boolean) {
state.logoVisible = visible
},
},
actions: {
async [CURRENT_LIST]({state, commit}, {list, forceUpdate = false}) {

View file

@ -7,5 +7,6 @@ export const KEYBOARD_SHORTCUTS_ACTIVE = 'keyboardShortcutsActive'
export const QUICK_ACTIONS_ACTIVE = 'quickActionsActive'
export const BACKGROUND = 'background'
export const BLUR_HASH = 'blurHash'
export const LOGO_VISIBLE = 'logoVisible'
export const CONFIG = 'config'

View file

@ -15,6 +15,7 @@ export interface RootStoreState {
menuActive: boolean,
keyboardShortcutsActive: boolean,
quickActionsActive: boolean,
logoVisible: boolean,
}
export interface AttachmentState {

View file

@ -40,6 +40,7 @@ import {useI18n} from 'vue-i18n'
import {useTitle} from '@vueuse/core'
import Message from '@/components/misc/message.vue'
import {LOGO_VISIBLE} from '@/store/mutation-types'
const {t} = useI18n({useScope: 'global'})
useTitle(t('sharing.authenticating'))
@ -59,14 +60,14 @@ function useAuth() {
async function authenticate() {
authenticateWithPassword.value = false
errorMessage.value = ''
if (authLinkShare.value) {
// FIXME: push to 'list.list' since authenticated?
return
}
// TODO: no password
loading.value = true
try {
@ -74,6 +75,10 @@ function useAuth() {
hash: route.params.share,
password: password.value,
})
const logoVisible = route.query.logoVisible
? route.query.logoVisible === 'true'
: true
store.commit(LOGO_VISIBLE, logoVisible)
router.push({name: 'list.list', params: {listId}})
} catch (e: any) {
if (e.response?.data?.code === 13001) {