mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
🎨
This commit is contained in:
parent
187b44c7f3
commit
758e054c92
@ -1,13 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<MkA class="ldlomzub" :class="{ isMe }" :to="url" v-user-preview="canonical" v-if="url.startsWith('/')">
|
<MkA v-if="url.startsWith('/')" class="ldlomzub" :class="{ isMe }" :to="url" v-user-preview="canonical" :style="{ background: bg }">
|
||||||
<span class="me" v-if="isMe">{{ $ts.you }}</span>
|
|
||||||
<img class="icon" :src="`/avatar/@${username}@${host}`" alt="">
|
<img class="icon" :src="`/avatar/@${username}@${host}`" alt="">
|
||||||
<span class="main">
|
<span class="main">
|
||||||
<span class="username">@{{ username }}</span>
|
<span class="username">@{{ username }}</span>
|
||||||
<span class="host" v-if="(host != localHost) || $store.state.showFullAcct">@{{ toUnicode(host) }}</span>
|
<span class="host" v-if="(host != localHost) || $store.state.showFullAcct">@{{ toUnicode(host) }}</span>
|
||||||
</span>
|
</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
<a class="ldlomzub" :href="url" target="_blank" rel="noopener" v-else>
|
<a v-else class="ldlomzub" :href="url" target="_blank" rel="noopener" :style="{ background: bg }">
|
||||||
<span class="main">
|
<span class="main">
|
||||||
<span class="username">@{{ username }}</span>
|
<span class="username">@{{ username }}</span>
|
||||||
<span class="host">@{{ toUnicode(host) }}</span>
|
<span class="host">@{{ toUnicode(host) }}</span>
|
||||||
@ -17,10 +16,11 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { toUnicode } from 'punycode/';
|
import * as tinycolor from 'tinycolor2';
|
||||||
|
import { toUnicode } from 'punycode';
|
||||||
import { host as localHost } from '@client/config';
|
import { host as localHost } from '@client/config';
|
||||||
import { wellKnownServices } from '../../well-known-services';
|
import { wellKnownServices } from '../../well-known-services';
|
||||||
import * as os from '@client/os';
|
import { $i } from '@client/account';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -33,53 +33,46 @@ export default defineComponent({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
|
setup(props) {
|
||||||
|
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;
|
||||||
|
|
||||||
|
const wellKnown = wellKnownServices.find(x => x[0] === props.host);
|
||||||
|
const url = wellKnown ? wellKnown[1](props.username) : `/${canonical}`;
|
||||||
|
|
||||||
|
const isMe = $i && (
|
||||||
|
`@${props.username}@${toUnicode(props.host)}` === `@${$i.username}@${toUnicode(localHost)}`.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
|
const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue(isMe ? '--mentionMe' : '--mention'));
|
||||||
|
bg.setAlpha(0.20);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
localHost
|
localHost,
|
||||||
|
isMe,
|
||||||
|
url,
|
||||||
|
canonical,
|
||||||
|
toUnicode,
|
||||||
|
bg: bg.toRgbString(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
url(): string {
|
|
||||||
const wellKnown = wellKnownServices.find(x => x[0] === this.host);
|
|
||||||
if (wellKnown) {
|
|
||||||
return wellKnown[1](this.username);
|
|
||||||
} else {
|
|
||||||
return `/${this.canonical}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
canonical(): string {
|
|
||||||
return this.host === localHost ? `@${this.username}` : `@${this.username}@${toUnicode(this.host)}`;
|
|
||||||
},
|
|
||||||
isMe(): boolean {
|
|
||||||
return this.$i && (
|
|
||||||
`@${this.username}@${toUnicode(this.host)}` === `@${this.$i.username}@${toUnicode(localHost)}`.toLowerCase()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toUnicode
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.ldlomzub {
|
.ldlomzub {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 8px 4px 4px;
|
||||||
|
border-radius: 999px;
|
||||||
color: var(--mention);
|
color: var(--mention);
|
||||||
|
|
||||||
&.isMe {
|
&.isMe {
|
||||||
color: var(--mentionMe);
|
color: var(--mentionMe);
|
||||||
}
|
}
|
||||||
|
|
||||||
> .me {
|
|
||||||
pointer-events: none;
|
|
||||||
user-select: none;
|
|
||||||
font-size: 70%;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .icon {
|
> .icon {
|
||||||
width: 1.5em;
|
width: 1.5em;
|
||||||
margin: 0 0.2em;
|
margin: 0 0.2em 0 0;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
navBg: '#fff',
|
navBg: '#fff',
|
||||||
panel: '#fff',
|
panel: '#fff',
|
||||||
panelHeaderDivider: '@divider',
|
panelHeaderDivider: '@divider',
|
||||||
|
mentionMe: 'rgb(0, 179, 70)',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user