This commit is contained in:
syuilo 2024-09-24 17:48:49 +09:00
parent 6ee55e1ab3
commit 423bfc8798
3 changed files with 22 additions and 23 deletions

View File

@ -11,8 +11,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-else-if="isExpired" style="color: var(--error)">{{ i18n.ts.expired }}</span> <span v-else-if="isExpired" style="color: var(--error)">{{ i18n.ts.expired }}</span>
<span v-else style="color: var(--success)">{{ i18n.ts.unused }}</span> <span v-else style="color: var(--success)">{{ i18n.ts.unused }}</span>
</template> </template>
<template #footer>
<div class="_buttons">
<MkButton v-if="!invite.used && !isExpired" primary rounded @click="copyInviteCode()"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton>
<MkButton v-if="!invite.used || moderator" danger rounded @click="deleteCode()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
</template>
<div class="_gaps_s" :class="$style.root"> <div :class="$style.root">
<div :class="$style.items"> <div :class="$style.items">
<div> <div>
<div :class="$style.label">{{ i18n.ts.invitationCode }}</div> <div :class="$style.label">{{ i18n.ts.invitationCode }}</div>
@ -49,10 +55,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<div><MkTime :time="invite.createdAt" mode="absolute"/></div> <div><MkTime :time="invite.createdAt" mode="absolute"/></div>
</div> </div>
</div> </div>
<div :class="$style.buttons">
<MkButton v-if="!invite.used && !isExpired" primary rounded @click="copyInviteCode()"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton>
<MkButton v-if="!invite.used || moderator" danger rounded @click="deleteCode()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
</div> </div>
</MkFolder> </MkFolder>
</template> </template>
@ -121,9 +123,4 @@ function copyInviteCode() {
width: var(--height); width: var(--height);
height: var(--height); height: var(--height);
} }
.buttons {
display: flex;
gap: 8px;
}
</style> </style>

View File

@ -65,18 +65,18 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkTextarea v-model="ad.memo"> <MkTextarea v-model="ad.memo">
<template #label>{{ i18n.ts.memo }}</template> <template #label>{{ i18n.ts.memo }}</template>
</MkTextarea> </MkTextarea>
<div class="buttons"> <div class="_buttons">
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"> <MkButton inline primary style="margin-right: 12px;" @click="save(ad)">
<i <i
class="ti ti-device-floppy" class="ti ti-device-floppy"
></i> {{ i18n.ts.save }} ></i> {{ i18n.ts.save }}
</MkButton> </MkButton>
<MkButton class="button" inline danger @click="remove(ad)"> <MkButton inline danger @click="remove(ad)">
<i class="ti ti-trash"></i> {{ i18n.ts.remove }} <i class="ti ti-trash"></i> {{ i18n.ts.remove }}
</MkButton> </MkButton>
</div> </div>
</div> </div>
<MkButton class="button" @click="more()"> <MkButton @click="more()">
<i class="ti ti-reload"></i>{{ i18n.ts.more }} <i class="ti ti-reload"></i>{{ i18n.ts.more }}
</MkButton> </MkButton>
</div> </div>

View File

@ -29,8 +29,16 @@ SPDX-License-Identifier: AGPL-3.0-only
<i v-else-if="announcement.icon === 'success'" class="ti ti-check" style="color: var(--success);"></i> <i v-else-if="announcement.icon === 'success'" class="ti ti-check" style="color: var(--success);"></i>
</template> </template>
<template #caption>{{ announcement.text }}</template> <template #caption>{{ announcement.text }}</template>
<template #footer>
<div class="_buttons">
<MkButton rounded primary @click="save(announcement)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
<MkButton v-if="announcement.id != null && announcement.isActive" rounded @click="archive(announcement)"><i class="ti ti-check"></i> {{ i18n.ts._announcement.end }} ({{ i18n.ts.archive }})</MkButton>
<MkButton v-if="announcement.id != null && !announcement.isActive" rounded @click="unarchive(announcement)"><i class="ti ti-restore"></i> {{ i18n.ts.unarchive }}</MkButton>
<MkButton v-if="announcement.id != null" rounded danger @click="del(announcement)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
</template>
<div class="_gaps_m"> <div class="_gaps">
<MkInput v-model="announcement.title"> <MkInput v-model="announcement.title">
<template #label>{{ i18n.ts.title }}</template> <template #label>{{ i18n.ts.title }}</template>
</MkInput> </MkInput>
@ -64,16 +72,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._announcement.needConfirmationToRead }} {{ i18n.ts._announcement.needConfirmationToRead }}
</MkSwitch> </MkSwitch>
<p v-if="announcement.reads">{{ i18n.tsx.nUsersRead({ n: announcement.reads }) }}</p> <p v-if="announcement.reads">{{ i18n.tsx.nUsersRead({ n: announcement.reads }) }}</p>
<div class="buttons _buttons">
<MkButton class="button" inline primary @click="save(announcement)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
<MkButton v-if="announcement.id != null && announcement.isActive" class="button" inline @click="archive(announcement)"><i class="ti ti-check"></i> {{ i18n.ts._announcement.end }} ({{ i18n.ts.archive }})</MkButton>
<MkButton v-if="announcement.id != null && !announcement.isActive" class="button" inline @click="unarchive(announcement)"><i class="ti ti-restore"></i> {{ i18n.ts.unarchive }}</MkButton>
<MkButton v-if="announcement.id != null" class="button" inline danger @click="del(announcement)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
</div> </div>
</MkFolder> </MkFolder>
<MkLoading v-if="loadingMore"/> <MkLoading v-if="loadingMore"/>
<MkButton class="button" @click="more()"> <MkButton @click="more()">
<i class="ti ti-reload"></i>{{ i18n.ts.more }} <i class="ti ti-reload"></i>{{ i18n.ts.more }}
</MkButton> </MkButton>
</template> </template>
@ -170,7 +172,7 @@ function more() {
loadingMore.value = true; loadingMore.value = true;
misskeyApi('admin/announcements/list', { misskeyApi('admin/announcements/list', {
status: announcementsStatus.value, status: announcementsStatus.value,
untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id,
}).then(announcementResponse => { }).then(announcementResponse => {
announcements.value = announcements.value.concat(announcementResponse); announcements.value = announcements.value.concat(announcementResponse);
loadingMore.value = false; loadingMore.value = false;