2018-12-12 06:06:05 +02:00
|
|
|
<template>
|
2018-12-23 07:35:18 +02:00
|
|
|
<router-link class="ldlomzub" :to="`/${ canonical }`" v-user-preview="canonical">
|
2018-12-12 06:06:05 +02:00
|
|
|
<span class="me" v-if="isMe">{{ $t('@.you') }}</span>
|
|
|
|
<span class="main">
|
|
|
|
<span class="username">@{{ username }}</span>
|
|
|
|
<span class="host" :class="{ fade: $store.state.settings.contrastedAcct }" v-if="(host != localHost) || $store.state.settings.showFullAcct">@{{ toUnicode(host) }}</span>
|
|
|
|
</span>
|
|
|
|
</router-link>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../../i18n';
|
|
|
|
import { toUnicode } from 'punycode';
|
|
|
|
import { host as localHost } from '../../../config';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n(),
|
|
|
|
props: {
|
|
|
|
username: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
localHost
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
canonical(): string {
|
2019-04-07 15:50:36 +03:00
|
|
|
return this.host === localHost ? `@${this.username}` : `@${this.username}@${toUnicode(this.host)}`;
|
2018-12-12 06:06:05 +02:00
|
|
|
},
|
|
|
|
isMe(): boolean {
|
2019-04-15 14:41:56 +03:00
|
|
|
return this.$store.getters.isSignedIn && (
|
|
|
|
`@${this.username}@${toUnicode(this.host)}` === `@${this.$store.state.i.username}@${toUnicode(localHost)}`.toLowerCase()
|
|
|
|
);
|
2018-12-12 06:06:05 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toUnicode
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.ldlomzub
|
|
|
|
color var(--mfmMention)
|
|
|
|
|
|
|
|
> .me
|
|
|
|
pointer-events none
|
|
|
|
user-select none
|
|
|
|
padding 0 4px
|
2018-12-30 06:19:06 +02:00
|
|
|
background var(--mfmMention)
|
2018-12-30 07:00:57 +02:00
|
|
|
border solid var(--lineWidth) var(--mfmMention)
|
2018-12-12 06:06:05 +02:00
|
|
|
border-radius 4px 0 0 4px
|
2018-12-30 06:19:06 +02:00
|
|
|
color var(--mfmMentionForeground)
|
2018-12-12 06:06:05 +02:00
|
|
|
|
|
|
|
& + .main
|
|
|
|
padding 0 4px
|
2018-12-30 07:00:57 +02:00
|
|
|
border solid var(--lineWidth) var(--mfmMention)
|
2018-12-12 06:06:05 +02:00
|
|
|
border-radius 0 4px 4px 0
|
|
|
|
|
|
|
|
> .main
|
|
|
|
> .host.fade
|
|
|
|
opacity 0.5
|
|
|
|
|
|
|
|
</style>
|