Skip to content

Commit

Permalink
feat: アバターデコレーションをフロントからアップロードできるように
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-mai committed Jun 14, 2024
1 parent 6b365ea commit 217e35a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/frontend/src/pages/avatar-decorations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #caption>{{ avatarDecoration.description }}</template>

<div class="_gaps_m">
<MkButton rounded style="margin: 0 auto;" @click="selectImage(avatarDecoration, $event)">{{ i18n.ts.selectFile }}</MkButton>
<MkInput v-model="avatarDecoration.name">
<template #label>{{ i18n.ts.name }}</template>
</MkInput>
Expand Down Expand Up @@ -44,9 +45,17 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
import { selectFile } from '@/scripts/select-file.js';

const avatarDecorations = ref<Misskey.entities.AdminAvatarDecorationsListResponse>([]);

// ファイル選択
async function selectImage(decoration, ev) {
let file = await selectFile(ev.currentTarget ?? ev.target, null);
decoration.name = file.name.replace(/\.(.+)$/, '');
decoration.url = file.url;
}

function add() {
avatarDecorations.value.unshift({
_id: Math.random().toString(36),
Expand Down

0 comments on commit 217e35a

Please sign in to comment.