gancio-upstream/components/Footer.vue

69 lines
2.7 KiB
Vue
Raw 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
2023-11-20 23:15:28 +01:00
v-menu(v-if='settings.enable_trusted_instances && trusted_instances?.length'
2022-07-01 15:55:09 +02:00
offset-y bottom open-on-hover transition="slide-y-transition")
template(v-slot:activator="{ on, attrs }")
v-btn.ml-1(v-bind='attrs' v-on='on' color='primary' text) {{ settings.trusted_instances_label || $t('admin.trusted_instances_label_default')}}
2024-01-23 09:11:17 +01:00
v-list(subheaders two-lines max-width=550)
2023-11-20 23:15:28 +01:00
v-list-item(v-for='instance in trusted_instances'
2022-07-01 15:55:09 +02:00
:key='instance.name'
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
2024-01-23 09:11:17 +01:00
v-list-item-title {{instance?.instance?.data?.metadata?.nodeLabel ?? instance?.object?.name ?? instance?.object?.preferredUsername }} - {{ instance?.object?.url ?? instance?.ap_id }}
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_instances: []
2021-05-19 16:17:48 +02:00
}
},
2023-11-20 23:15:28 +01:00
created () {
this.$root.$on('update_friendly_instances', this.$fetch)
},
async fetch () {
2024-03-18 09:55:22 +01:00
try {
this.trusted_instances = await this.$axios.$get('instances/trusted')
} catch (e) {
console.error('[Footer] Get trusted instances', e)
}
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>