Frontend: Magnetar emoji URL hinting
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
This commit is contained in:
parent
7eed5d6b62
commit
3efc376f2b
|
@ -9,11 +9,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {} from "vue";
|
import * as Misskey from "calckey-js";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reaction: string;
|
reaction: string;
|
||||||
customEmojis?: any[]; // TODO
|
customEmojis?: Pick<Misskey.entities.CustomEmoji, "name" | "url">[];
|
||||||
noStyle?: boolean;
|
noStyle?: boolean;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,7 +14,12 @@
|
||||||
<XReactionIcon
|
<XReactionIcon
|
||||||
class="icon"
|
class="icon"
|
||||||
:reaction="reaction"
|
:reaction="reaction"
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="[
|
||||||
|
...note.emojis,
|
||||||
|
typeof url !== 'undefined'
|
||||||
|
? { name: reaction, url: url }
|
||||||
|
: undefined,
|
||||||
|
]"
|
||||||
/>
|
/>
|
||||||
<span class="count">{{ count }}</span>
|
<span class="count">{{ count }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -34,6 +39,7 @@ import { magReactionSelf } from "@/scripts-mag/mag-util";
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reaction: string;
|
reaction: string;
|
||||||
count: number;
|
count: number;
|
||||||
|
url?: string;
|
||||||
isInitial: boolean;
|
isInitial: boolean;
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
: Object.entries(note.reactions)"
|
: Object.entries(note.reactions)"
|
||||||
:key="magReactionPairToLegacy(r)[0]"
|
:key="magReactionPairToLegacy(r)[0]"
|
||||||
:reaction="magReactionPairToLegacy(r)[0]"
|
:reaction="magReactionPairToLegacy(r)[0]"
|
||||||
|
:url="'url' in r[0] ? r[0]['url'] : undefined"
|
||||||
:count="magReactionPairToLegacy(r)[1]"
|
:count="magReactionPairToLegacy(r)[1]"
|
||||||
:is-initial="initialReactions.has(magReactionPairToLegacy(r)[0])"
|
:is-initial="initialReactions.has(magReactionPairToLegacy(r)[0])"
|
||||||
:note="note"
|
:note="note"
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed } from "vue";
|
||||||
import { CustomEmoji } from "calckey-js/built/entities";
|
import * as Misskey from "calckey-js";
|
||||||
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
||||||
import { char2filePath } from "@/scripts/twemoji-base";
|
import { char2filePath } from "@/scripts/twemoji-base";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
@ -32,7 +32,7 @@ const props = defineProps<{
|
||||||
emoji: string;
|
emoji: string;
|
||||||
normal?: boolean;
|
normal?: boolean;
|
||||||
noStyle?: boolean;
|
noStyle?: boolean;
|
||||||
customEmojis?: CustomEmoji[];
|
customEmojis?: Pick<Misskey.entities.CustomEmoji, "name" | "url">[];
|
||||||
isReaction?: boolean;
|
isReaction?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -45,17 +45,19 @@ const ce = computed(() => props.customEmojis ?? instance.emojis ?? []);
|
||||||
const customEmoji = computed(() =>
|
const customEmoji = computed(() =>
|
||||||
isCustom.value
|
isCustom.value
|
||||||
? ce.value.find(
|
? ce.value.find(
|
||||||
(x) => x.name === props.emoji.substr(1, props.emoji.length - 2)
|
(x) => x.name === props.emoji.substring(1, props.emoji.length - 1)
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
const url = computed(() => {
|
const url = computed(() => {
|
||||||
if (char.value) {
|
if (char.value) {
|
||||||
return char2filePath(char.value);
|
return char2filePath(char.value);
|
||||||
} else {
|
} else if (customEmoji?.value?.url) {
|
||||||
return defaultStore.state.disableShowingAnimatedImages
|
return defaultStore.state.disableShowingAnimatedImages
|
||||||
? getStaticImageUrl(customEmoji.value.url)
|
? getStaticImageUrl(customEmoji.value.url)
|
||||||
: customEmoji.value.url;
|
: customEmoji.value.url;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const alt = computed(() =>
|
const alt = computed(() =>
|
||||||
|
|
|
@ -173,6 +173,8 @@ export function magConvertReaction(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reaction.match(/^:.+:$/)) {
|
if (reaction.match(/^:.+:$/)) {
|
||||||
|
reaction = reaction.replaceAll(/(^:) | (:$)/, "");
|
||||||
|
|
||||||
const [name, host] = reaction.split("@");
|
const [name, host] = reaction.split("@");
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
|
|
Loading…
Reference in New Issue