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

Merged
dpschen merged 1 commits from feature/hide-logo-on-links into main 2022-09-08 09:56:12 +00:00
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="container has-text-centered link-share-view">
<div class="column is-10 is-offset-1"> <div class="column is-10 is-offset-1">
<Logo class="logo"/> <Logo class="logo" v-if="logoVisible"/>
<h1 <h1
:class="{'m-0': !logoVisible}"
:style="{ 'opacity': currentList.title === '' ? '0': '1' }" :style="{ 'opacity': currentList.title === '' ? '0': '1' }"
class="title"> class="title">
{{ currentList.title === '' ? $t('misc.loading') : currentList.title }} {{ currentList.title === '' ? $t('misc.loading') : currentList.title }}
@ -31,6 +32,7 @@ import PoweredByLink from './PoweredByLink.vue'
const store = useStore() const store = useStore()
const currentList = computed(() => store.state.currentList) const currentList = computed(() => store.state.currentList)
const background = computed(() => store.state.background) const background = computed(() => store.state.background)
const logoVisible = computed(() => store.state.logoVisible)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

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

View File

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

View File

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