mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 18:03:10 +02:00
wip: refactor(client): migrate components to composition api
This commit is contained in:
parent
901453ba7d
commit
2c47196600
1 changed files with 51 additions and 61 deletions
|
@ -3,36 +3,36 @@
|
||||||
<MkSpacer :content-max="600" :margin-min="20">
|
<MkSpacer :content-max="600" :margin-min="20">
|
||||||
<div class="_formRoot znqjceqz">
|
<div class="_formRoot znqjceqz">
|
||||||
<div id="debug"></div>
|
<div id="debug"></div>
|
||||||
<div ref="about" v-panel class="_formBlock about" :class="{ playing: easterEggEngine != null }">
|
<div ref="containerEl" v-panel class="_formBlock about" :class="{ playing: easterEggEngine != null }">
|
||||||
<img src="/client-assets/about-icon.png" alt="" class="icon" draggable="false" @load="iconLoaded" @click="gravity"/>
|
<img src="/client-assets/about-icon.png" alt="" class="icon" draggable="false" @load="iconLoaded" @click="gravity"/>
|
||||||
<div class="misskey">Misskey</div>
|
<div class="misskey">Misskey</div>
|
||||||
<div class="version">v{{ version }}</div>
|
<div class="version">v{{ version }}</div>
|
||||||
<span v-for="emoji in easterEggEmojis" :key="emoji.id" class="emoji" :data-physics-x="emoji.left" :data-physics-y="emoji.top" :class="{ _physics_circle_: !emoji.emoji.startsWith(':') }"><MkEmoji class="emoji" :emoji="emoji.emoji" :custom-emojis="$instance.emojis" :is-reaction="false" :normal="true" :no-style="true"/></span>
|
<span v-for="emoji in easterEggEmojis" :key="emoji.id" class="emoji" :data-physics-x="emoji.left" :data-physics-y="emoji.top" :class="{ _physics_circle_: !emoji.emoji.startsWith(':') }"><MkEmoji class="emoji" :emoji="emoji.emoji" :custom-emojis="$instance.emojis" :is-reaction="false" :normal="true" :no-style="true"/></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="_formBlock" style="text-align: center;">
|
<div class="_formBlock" style="text-align: center;">
|
||||||
{{ $ts._aboutMisskey.about }}<br><a href="https://misskey-hub.net/docs/misskey.html" target="_blank" class="_link">{{ $ts.learnMore }}</a>
|
{{ i18n.locale._aboutMisskey.about }}<br><a href="https://misskey-hub.net/docs/misskey.html" target="_blank" class="_link">{{ i18n.locale.learnMore }}</a>
|
||||||
</div>
|
</div>
|
||||||
<FormSection>
|
<FormSection>
|
||||||
<div class="_formLinks">
|
<div class="_formLinks">
|
||||||
<FormLink to="https://github.com/misskey-dev/misskey" external>
|
<FormLink to="https://github.com/misskey-dev/misskey" external>
|
||||||
<template #icon><i class="fas fa-code"></i></template>
|
<template #icon><i class="fas fa-code"></i></template>
|
||||||
{{ $ts._aboutMisskey.source }}
|
{{ i18n.locale._aboutMisskey.source }}
|
||||||
<template #suffix>GitHub</template>
|
<template #suffix>GitHub</template>
|
||||||
</FormLink>
|
</FormLink>
|
||||||
<FormLink to="https://crowdin.com/project/misskey" external>
|
<FormLink to="https://crowdin.com/project/misskey" external>
|
||||||
<template #icon><i class="fas fa-language"></i></template>
|
<template #icon><i class="fas fa-language"></i></template>
|
||||||
{{ $ts._aboutMisskey.translation }}
|
{{ i18n.locale._aboutMisskey.translation }}
|
||||||
<template #suffix>Crowdin</template>
|
<template #suffix>Crowdin</template>
|
||||||
</FormLink>
|
</FormLink>
|
||||||
<FormLink to="https://www.patreon.com/syuilo" external>
|
<FormLink to="https://www.patreon.com/syuilo" external>
|
||||||
<template #icon><i class="fas fa-hand-holding-medical"></i></template>
|
<template #icon><i class="fas fa-hand-holding-medical"></i></template>
|
||||||
{{ $ts._aboutMisskey.donate }}
|
{{ i18n.locale._aboutMisskey.donate }}
|
||||||
<template #suffix>Patreon</template>
|
<template #suffix>Patreon</template>
|
||||||
</FormLink>
|
</FormLink>
|
||||||
</div>
|
</div>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
<FormSection>
|
<FormSection>
|
||||||
<template #label>{{ $ts._aboutMisskey.contributors }}</template>
|
<template #label>{{ i18n.locale._aboutMisskey.contributors }}</template>
|
||||||
<div class="_formLinks">
|
<div class="_formLinks">
|
||||||
<FormLink to="https://github.com/syuilo" external>@syuilo</FormLink>
|
<FormLink to="https://github.com/syuilo" external>@syuilo</FormLink>
|
||||||
<FormLink to="https://github.com/AyaMorisawa" external>@AyaMorisawa</FormLink>
|
<FormLink to="https://github.com/AyaMorisawa" external>@AyaMorisawa</FormLink>
|
||||||
|
@ -44,20 +44,20 @@
|
||||||
<FormLink to="https://github.com/u1-liquid" external>@u1-liquid</FormLink>
|
<FormLink to="https://github.com/u1-liquid" external>@u1-liquid</FormLink>
|
||||||
<FormLink to="https://github.com/marihachi" external>@marihachi</FormLink>
|
<FormLink to="https://github.com/marihachi" external>@marihachi</FormLink>
|
||||||
</div>
|
</div>
|
||||||
<template #caption><MkLink url="https://github.com/misskey-dev/misskey/graphs/contributors">{{ $ts._aboutMisskey.allContributors }}</MkLink></template>
|
<template #caption><MkLink url="https://github.com/misskey-dev/misskey/graphs/contributors">{{ i18n.locale._aboutMisskey.allContributors }}</MkLink></template>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
<FormSection>
|
<FormSection>
|
||||||
<template #label><Mfm text="$[jelly ❤]"/> {{ $ts._aboutMisskey.patrons }}</template>
|
<template #label><Mfm text="$[jelly ❤]"/> {{ i18n.locale._aboutMisskey.patrons }}</template>
|
||||||
<div v-for="patron in patrons" :key="patron">{{ patron }}</div>
|
<div v-for="patron in patrons" :key="patron">{{ patron }}</div>
|
||||||
<template #caption>{{ $ts._aboutMisskey.morePatrons }}</template>
|
<template #caption>{{ i18n.locale._aboutMisskey.morePatrons }}</template>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { nextTick, onBeforeUnmount } from 'vue';
|
||||||
import { version } from '@/config';
|
import { version } from '@/config';
|
||||||
import FormLink from '@/components/form/link.vue';
|
import FormLink from '@/components/form/link.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
@ -65,6 +65,8 @@ import MkKeyValue from '@/components/key-value.vue';
|
||||||
import MkLink from '@/components/link.vue';
|
import MkLink from '@/components/link.vue';
|
||||||
import { physics } from '@/scripts/physics';
|
import { physics } from '@/scripts/physics';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import { defaultStore } from '@/store';
|
||||||
|
|
||||||
const patrons = [
|
const patrons = [
|
||||||
'まっちゃとーにゅ',
|
'まっちゃとーにゅ',
|
||||||
|
@ -145,58 +147,46 @@ const patrons = [
|
||||||
'蝉暮せせせ',
|
'蝉暮せせせ',
|
||||||
];
|
];
|
||||||
|
|
||||||
export default defineComponent({
|
let easterEggReady = false;
|
||||||
components: {
|
let easterEggEmojis = $ref([]);
|
||||||
FormSection,
|
let easterEggEngine = $ref(null);
|
||||||
FormLink,
|
const containerEl = $ref<HTMLElement>();
|
||||||
MkKeyValue,
|
|
||||||
MkLink,
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
function iconLoaded() {
|
||||||
return {
|
const emojis = defaultStore.state.reactions;
|
||||||
[symbols.PAGE_INFO]: {
|
const containerWidth = containerEl.offsetWidth;
|
||||||
title: this.$ts.aboutMisskey,
|
for (let i = 0; i < 32; i++) {
|
||||||
icon: null
|
easterEggEmojis.push({
|
||||||
},
|
id: i.toString(),
|
||||||
version,
|
top: -(128 + (Math.random() * 256)),
|
||||||
patrons,
|
left: (Math.random() * containerWidth),
|
||||||
easterEggReady: false,
|
emoji: emojis[Math.floor(Math.random() * emojis.length)],
|
||||||
easterEggEmojis: [],
|
});
|
||||||
easterEggEngine: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeUnmount() {
|
|
||||||
if (this.easterEggEngine) {
|
|
||||||
this.easterEggEngine.stop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
iconLoaded() {
|
|
||||||
const emojis = this.$store.state.reactions;
|
|
||||||
const containerWidth = this.$refs.about.offsetWidth;
|
|
||||||
for (let i = 0; i < 32; i++) {
|
|
||||||
this.easterEggEmojis.push({
|
|
||||||
id: i.toString(),
|
|
||||||
top: -(128 + (Math.random() * 256)),
|
|
||||||
left: (Math.random() * containerWidth),
|
|
||||||
emoji: emojis[Math.floor(Math.random() * emojis.length)],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.easterEggReady = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
gravity() {
|
|
||||||
if (!this.easterEggReady) return;
|
|
||||||
this.easterEggReady = false;
|
|
||||||
this.easterEggEngine = physics(this.$refs.about);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
easterEggReady = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function gravity() {
|
||||||
|
if (!easterEggReady) return;
|
||||||
|
easterEggReady = false;
|
||||||
|
easterEggEngine = physics(containerEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (easterEggEngine) {
|
||||||
|
easterEggEngine.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
[symbols.PAGE_INFO]: {
|
||||||
|
title: i18n.locale.aboutMisskey,
|
||||||
|
icon: null,
|
||||||
|
bg: 'var(--bg)',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue