tweak design

This commit is contained in:
kakkokari-gtyih 2024-11-02 19:07:33 +09:00
parent e694c0e163
commit d69e3516f4
2 changed files with 24 additions and 8 deletions

View file

@ -91,7 +91,10 @@ async function onClick() {
text: i18n.tsx.unfollowConfirm({ name: props.user.name || props.user.username }), text: i18n.tsx.unfollowConfirm({ name: props.user.name || props.user.username }),
}); });
if (canceled) return; if (canceled) {
wait.value = false;
return;
}
await misskeyApi('following/delete', { await misskeyApi('following/delete', {
userId: props.user.id, userId: props.user.id,
@ -125,7 +128,10 @@ async function onClick() {
}); });
hasPendingFollowRequestFromYou.value = true; hasPendingFollowRequestFromYou.value = true;
if ($i == null) return; if ($i == null) {
wait.value = false;
return;
}
claimAchievement('following1'); claimAchievement('following1');

View file

@ -29,6 +29,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton class="command" rounded primary @click="accept(displayUser(req))"><i class="ti ti-check"/> {{ i18n.ts.accept }}</MkButton> <MkButton class="command" rounded primary @click="accept(displayUser(req))"><i class="ti ti-check"/> {{ i18n.ts.accept }}</MkButton>
<MkButton class="command" rounded danger @click="reject(displayUser(req))"><i class="ti ti-x"/> {{ i18n.ts.reject }}</MkButton> <MkButton class="command" rounded danger @click="reject(displayUser(req))"><i class="ti ti-x"/> {{ i18n.ts.reject }}</MkButton>
</div> </div>
<div v-else class="commands">
<MkButton class="command" rounded danger @click="cancel(displayUser(req))"><i class="ti ti-x"/> {{ i18n.ts.cancel }}</MkButton>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -41,11 +44,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { shallowRef, computed, ref } from 'vue'; import { shallowRef, computed, ref } from 'vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { userPage, acct } from '@/filters/user.js'; import { userPage, acct } from '@/filters/user.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import * as os from '@/os.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
@ -65,14 +69,20 @@ const pagination = computed(() => tab.value === 'list'
}, },
); );
function accept(user) { function accept(user: Misskey.entities.UserLite) {
misskeyApi('following/requests/accept', { userId: user.id }).then(() => { os.apiWithDialog('following/requests/accept', { userId: user.id }).then(() => {
paginationComponent.value?.reload(); paginationComponent.value?.reload();
}); });
} }
function reject(user) { function reject(user: Misskey.entities.UserLite) {
misskeyApi('following/requests/reject', { userId: user.id }).then(() => { os.apiWithDialog('following/requests/reject', { userId: user.id }).then(() => {
paginationComponent.value?.reload();
});
}
function cancel(user: Misskey.entities.UserLite) {
os.apiWithDialog('following/requests/cancel', { userId: user.id }).then(() => {
paginationComponent.value?.reload(); paginationComponent.value?.reload();
}); });
} }
@ -95,7 +105,7 @@ const headerTabs = computed(() => [
}, },
]); ]);
const tab = ref($i?.isLocked || !$i.hasPendingSentFollowRequest ? 'list' : 'sent'); const tab = ref(($i?.isLocked || !$i?.hasPendingSentFollowRequest) ? 'list' : 'sent');
definePageMetadata(() => ({ definePageMetadata(() => ({
title: i18n.ts.followRequests, title: i18n.ts.followRequests,