mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 01:53:08 +02:00
enhance(client): donation dialog
This commit is contained in:
parent
d2d77b5dc1
commit
d99be6697e
5 changed files with 123 additions and 8 deletions
|
@ -920,6 +920,10 @@ like: "いいね!"
|
||||||
unlike: "いいねを解除"
|
unlike: "いいねを解除"
|
||||||
numberOfLikes: "いいね数"
|
numberOfLikes: "いいね数"
|
||||||
show: "表示"
|
show: "表示"
|
||||||
|
neverShow: "今後表示しない"
|
||||||
|
remindMeLater: "また後で"
|
||||||
|
didYouLikeMisskey: "Misskeyを気に入っていただけましたか?"
|
||||||
|
pleaseDonate: "Misskeyは{host}が使用している無料のソフトウェアです。これからも開発を続けられるように、ぜひ寄付をお願いします!"
|
||||||
|
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。"
|
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。"
|
||||||
|
|
109
packages/frontend/src/components/MkDonation.vue
Normal file
109
packages/frontend/src/components/MkDonation.vue
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
<template>
|
||||||
|
<div class="_panel _shadow" :class="$style.root">
|
||||||
|
<!-- TODO: インスタンス運営者が任意のテキストとリンクを設定できるようにする -->
|
||||||
|
<div :class="$style.icon">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-pig-money" width="40" height="40" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M15 11v.01"></path>
|
||||||
|
<path d="M5.173 8.378a3 3 0 1 1 4.656 -1.377"></path>
|
||||||
|
<path d="M16 4v3.803a6.019 6.019 0 0 1 2.658 3.197h1.341a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-1.342c-.336 .95 -.907 1.8 -1.658 2.473v2.027a1.5 1.5 0 0 1 -3 0v-.583a6.04 6.04 0 0 1 -1 .083h-4a6.04 6.04 0 0 1 -1 -.083v.583a1.5 1.5 0 0 1 -3 0v-2l.001 -.027a6 6 0 0 1 3.999 -10.473h2.5l4.5 -3h.001z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div :class="$style.main">
|
||||||
|
<div :class="$style.title">{{ i18n.ts.didYouLikeMisskey }}</div>
|
||||||
|
<div :class="$style.text">
|
||||||
|
<I18n :src="i18n.ts.pleaseDonate" tag="span">
|
||||||
|
<template #host>
|
||||||
|
{{ $instance.name ?? host }}
|
||||||
|
</template>
|
||||||
|
</I18n>
|
||||||
|
<div style="margin-top: 0.2em;">
|
||||||
|
<MkLink target="_blank" url="https://misskey-hub.net/docs/donate.html">{{ i18n.ts.learnMore }}</MkLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="_buttons">
|
||||||
|
<MkButton @click="close">{{ i18n.ts.remindMeLater }}</MkButton>
|
||||||
|
<MkButton @click="neverShow">{{ i18n.ts.neverShow }}</MkButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="_button" :class="$style.close" @click="close"><i class="ti ti-x"></i></button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, shallowRef } from 'vue';
|
||||||
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
import MkLink from '@/components/MkLink.vue';
|
||||||
|
import { host } from '@/config';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { miLocalStorage } from '@/local-storage';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: 'closed'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const zIndex = os.claimZIndex('low');
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
miLocalStorage.setItem('latestDonationInfoShownAt', Date.now().toString());
|
||||||
|
emit('closed');
|
||||||
|
}
|
||||||
|
|
||||||
|
function neverShow() {
|
||||||
|
miLocalStorage.setItem('neverShowDonationInfo', 'true')
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
position: fixed;
|
||||||
|
z-index: v-bind(zIndex);
|
||||||
|
bottom: var(--margin);
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc(100% - (var(--margin) * 2));
|
||||||
|
max-width: 500px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 25px;
|
||||||
|
width: 100px;
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.icon {
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 450px) {
|
||||||
|
.icon {
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
padding: 25px 25px 25px 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
right: 8px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin: 0.7em 0 1em 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -357,6 +357,14 @@ import { miLocalStorage } from './local-storage';
|
||||||
}
|
}
|
||||||
miLocalStorage.setItem('lastUsed', Date.now().toString());
|
miLocalStorage.setItem('lastUsed', Date.now().toString());
|
||||||
|
|
||||||
|
const latestDonationInfoShownAt = miLocalStorage.getItem('latestDonationInfoShownAt');
|
||||||
|
const neverShowDonationInfo = miLocalStorage.getItem('neverShowDonationInfo');
|
||||||
|
if (neverShowDonationInfo !== 'true' && (new Date($i.createdAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3)))) {
|
||||||
|
if (latestDonationInfoShownAt == null || (new Date(latestDonationInfoShownAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 30)))) {
|
||||||
|
popup(defineAsyncComponent(() => import('@/components/MkDonation.vue')), {}, {}, 'closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ('Notification' in window) {
|
if ('Notification' in window) {
|
||||||
// 許可を得ていなかったらリクエスト
|
// 許可を得ていなかったらリクエスト
|
||||||
if (Notification.permission === 'default') {
|
if (Notification.permission === 'default') {
|
||||||
|
|
|
@ -4,6 +4,8 @@ type Keys =
|
||||||
'instance' |
|
'instance' |
|
||||||
'account' |
|
'account' |
|
||||||
'accounts' |
|
'accounts' |
|
||||||
|
'latestDonationInfoShownAt' |
|
||||||
|
'neverShowDonationInfo' |
|
||||||
'lastUsed' |
|
'lastUsed' |
|
||||||
'lang' |
|
'lang' |
|
||||||
'drafts' |
|
'drafts' |
|
||||||
|
|
|
@ -86,14 +86,6 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
where: 'account',
|
where: 'account',
|
||||||
default: [] as string[],
|
default: [] as string[],
|
||||||
},
|
},
|
||||||
latestDonateDialogShowAt: {
|
|
||||||
where: 'account',
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
neverShowDonateDialog: {
|
|
||||||
where: 'account',
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
menu: {
|
menu: {
|
||||||
where: 'deviceAccount',
|
where: 'deviceAccount',
|
||||||
|
|
Loading…
Reference in a new issue