implement optional confetti on announcements
This commit is contained in:
parent
69f3c8a58e
commit
45bf8262aa
12 changed files with 60 additions and 1 deletions
|
|
@ -70,6 +70,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkSwitch v-model="announcement.needConfirmationToRead" :helpText="i18n.ts._announcement.needConfirmationToReadDescription">
|
||||
{{ i18n.ts._announcement.needConfirmationToRead }}
|
||||
</MkSwitch>
|
||||
<MkSwitch v-model="announcement.confetti" :helpText="i18n.ts._announcement.confettiDescription">
|
||||
{{ i18n.ts._announcement.confetti }}
|
||||
</MkSwitch>
|
||||
<p v-if="announcement.reads">{{ i18n.tsx.nUsersRead({ n: announcement.reads }) }}</p>
|
||||
</div>
|
||||
</MkFolder>
|
||||
|
|
@ -127,6 +130,7 @@ function add() {
|
|||
forExistingUsers: false,
|
||||
silence: false,
|
||||
needConfirmationToRead: false,
|
||||
confetti: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import * as os from '@/os.js';
|
||||
|
|
@ -57,6 +57,7 @@ import { definePage } from '@/page.js';
|
|||
import { $i } from '@/i.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { updateCurrentAccountPartial } from '@/accounts.js';
|
||||
import { confetti } from '@/utility/confetti.js';
|
||||
|
||||
const props = defineProps<{
|
||||
announcementId: string;
|
||||
|
|
@ -67,11 +68,22 @@ const error = ref<any>(null);
|
|||
const path = computed(() => props.announcementId);
|
||||
|
||||
function fetch() {
|
||||
console.log("aaa");
|
||||
announcement.value = null;
|
||||
misskeyApi('announcements/show', {
|
||||
announcementId: props.announcementId,
|
||||
}).then(async _announcement => {
|
||||
console.log("bbbb");
|
||||
announcement.value = _announcement;
|
||||
console.log("cccc");
|
||||
console.log(announcement.value.confetti);
|
||||
console.log(announcement.value.isRead);
|
||||
if (announcement.value.confetti && !announcement.value.isRead) {
|
||||
console.log("dddd");
|
||||
confetti({
|
||||
duration: 1000 * 3,
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
error.value = err;
|
||||
});
|
||||
|
|
@ -106,6 +118,9 @@ definePage(() => ({
|
|||
title: announcement.value ? announcement.value.title : i18n.ts.announcements,
|
||||
icon: 'ti ti-speakerphone',
|
||||
}));
|
||||
|
||||
onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue