Skip to content

Commit

Permalink
Feat: 広告のidをコピーできるように
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea committed Jan 28, 2025
1 parent e424b21 commit c18697a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/frontend/src/pages/admin/ads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<div>
<div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad">
<MkAd v-if="ad.url" :key="ad.id" :specify="ad"/>
<MkInput v-if="ad.id !== ''" v-model="ad.id" :readonly="true">
<template #label>ID</template>
</MkInput>
<div v-if="ad.id !== '' && ad.id " class="_gaps_s">
<MkInput v-model="ad.id" :readonly="true">
<template #label>ID</template>
</MkInput>
<MkButton @click="copyAdId(ad.id)">
<i class="ti ti-clipboard"></i>
{{ i18n.ts.copy }}
</MkButton>
</div>
<MkInput v-model="ad.url" type="url">
<template #label>URL</template>
</MkInput>
Expand Down Expand Up @@ -103,6 +109,7 @@ import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';

const ads = ref<Misskey.entities.Ad[]>([]);

Expand Down Expand Up @@ -248,6 +255,11 @@ function refresh() {
});
}

function copyAdId(id) {
copyToClipboard(id);
os.success();
}

refresh();

const headerActions = computed(() => [{
Expand Down

0 comments on commit c18697a

Please sign in to comment.