gancio-upstream/components/Footer.vue

65 lines
2.5 KiB
Vue
Raw Permalink Normal View History

2020-07-25 21:41:22 +02:00
<template lang="pug">
2022-07-01 15:55:09 +02:00
v-footer(aria-label='Footer')
2021-05-19 16:17:48 +02:00
2022-07-01 15:55:09 +02:00
v-dialog(v-model='showFollowMe' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly')
FollowMe(@close='showFollowMe=false' is-dialog)
2021-05-19 16:17:48 +02:00
2022-07-01 15:55:09 +02:00
v-btn.ml-1(v-for='link in footerLinks'
:key='link.label' color='primary' text
:href='link.href' :to='link.to' :target="link.href && '_blank'") {{link.label}}
2020-11-17 00:31:55 +01:00
v-menu(v-if='settings.enable_federation && trusted_sources?.length' max-height=550
offset-y bottom transition="slide-y-transition")
2022-07-01 15:55:09 +02:00
template(v-slot:activator="{ on, attrs }")
v-btn.ml-1(v-bind='attrs' v-on='on' color='primary' text) {{ settings.trusted_sources_label || $t('admin.trusted_sources_label_default')}}
2024-01-23 09:11:17 +01:00
v-list(subheaders two-lines max-width=550)
v-list-item(v-for='instance in trusted_sources'
:key='instance.ap_id'
2022-07-01 15:55:09 +02:00
target='_blank'
2024-01-23 09:11:17 +01:00
:href='instance?.object?.url ?? instance?.ap_id'
2022-07-01 15:55:09 +02:00
two-line)
v-list-item-avatar
2023-12-22 14:50:53 +01:00
v-img(:src='instance?.object?.icon?.url ?? `${instance.url}/favicon.ico`')
2022-07-01 15:55:09 +02:00
v-list-item-content
v-list-item-title {{ instance?.object?.name ?? instance?.object?.preferredUsername }}
2024-01-23 09:11:17 +01:00
v-list-item-subtitle {{ instance?.object?.summary ?? instance?.instance?.data?.metadata?.nodeDescription }}
2020-11-17 00:31:55 +01:00
2022-07-01 15:55:09 +02:00
v-btn.ml-1(v-if='settings.enable_federation' color='primary' text rel='me' @click.prevent='showFollowMe=true') {{$t('event.interact_with_me')}}
2022-11-24 01:00:30 +01:00
v-spacer
v-btn(color='primary' text href='https://gancio.org' target='_blank' rel="noopener") Gancio <small>{{settings.version}}</small>
2020-07-25 21:41:22 +02:00
</template>
<script>
import { mapState } from 'vuex'
2021-05-19 16:17:48 +02:00
import FollowMe from '../components/FollowMe'
2020-07-25 21:41:22 +02:00
export default {
2021-05-19 16:17:48 +02:00
components: { FollowMe },
data () {
return {
2023-11-20 23:15:28 +01:00
showFollowMe: false,
trusted_sources: []
2021-05-19 16:17:48 +02:00
}
},
async created () {
this.$root.$on('update_trusted_sources', async () => {
2025-01-28 16:53:33 +01:00
this.trusted_sources = await this.$axios.$get('ap_actors/trusted').catch()
})
2025-01-28 16:53:33 +01:00
this.trusted_sources = await this.$axios.$get('ap_actors/trusted').catch()
2023-11-20 23:15:28 +01:00
},
computed: {
...mapState(['settings']),
footerLinks () {
2021-12-02 11:14:53 +01:00
if (!this.settings || !this.settings.footerLinks) return []
return this.settings.footerLinks.map(link => {
if (/^https?:\/\//.test(link.href)) {
2022-11-25 09:47:46 +01:00
return { href: link.href, label: link.label.startsWith('common.') ? this.$t(link.label) : link.label }
} else {
2022-11-25 09:47:46 +01:00
return { to: link.href, label: link.label.startsWith('common.') ? this.$t(link.label) : link.label }
}
})
}
}
2020-07-25 21:41:22 +02:00
}
</script>