Skip to content

Commit

Permalink
Merge pull request #27 from n1lsqn/2023.12.2.papi.3_icondecoFE
Browse files Browse the repository at this point in the history
2023.12.2.papi.3 icondeco fe
  • Loading branch information
n1lsqn authored Jan 6, 2024
2 parents 44d6c33 + 1a8c397 commit 2b19db7
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Feat: KaTeXの実装
- Feat: ロールにチャンネルが使えるかどうかの権限を追加
- Feat: CWに何も書かなくても投稿できるようにする
- Feat: アイコンデコレーションを輸入する

## 2023.12.2

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "2023.12.2.papi.2",
"version": "2023.12.2.papi.3",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/pages/avatar-decorations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkFolder>
</div>
</MkFolder>
<br>
<MkFolder>
<template #label>リモート</template>
<div class="_gaps">
Expand Down
132 changes: 123 additions & 9 deletions packages/frontend/src/pages/settings/avatar-decoration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ SPDX-License-Identifier: AGPL-3.0-only

<div v-if="$i.avatarDecorations.length > 0" v-panel :class="$style.current" class="_gaps_s">
<div>{{ i18n.ts.inUse }}</div>

<div :class="$style.decorations">
<XDecoration
v-for="(avatarDecoration, i) in $i.avatarDecorations"
Expand All @@ -29,14 +28,28 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton danger @click="detachAllDecorations">{{ i18n.ts.detachAll }}</MkButton>
</div>

<div :class="$style.decorations">
<XDecoration
v-for="avatarDecoration in avatarDecorations"
:key="avatarDecoration.id"
:decoration="avatarDecoration"
@click="openDecoration(avatarDecoration)"
/>
</div>
<MkFolder>
<template #label>ローカル</template>
<div :class="$style.decorations">
<XDecoration
v-for="localAvatarDecoration in localAvatarDecorations"
:key="localAvatarDecoration.id"
:decoration="localAvatarDecoration"
@click="openLocalDecoration(localAvatarDecoration)"
/>
</div>
</MkFolder>
<MkFolder>
<template #label>リモート</template>
<div :class="$style.decorations">
<XDecoration
v-for="remoteAvatarDecoration in remoteAvatarDecorations"
:key="remoteAvatarDecoration.id"
:decoration="remoteAvatarDecoration"
@click="openRemoteDecoration(remoteAvatarDecoration)"
/>
</div>
</MkFolder>
</div>
<div v-else>
<MkLoading/>
Expand All @@ -54,15 +67,115 @@ import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import MkInfo from '@/components/MkInfo.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
const loading = ref(true);
const avatarDecorations = ref<Misskey.entities.GetAvatarDecorationsResponse>([]);
const localAvatarDecorations = ref<Misskey.entities.GetAvatarDecorationsResponse>([]);
const remoteAvatarDecorations = ref<Misskey.entities.GetAvatarDecorationsResponse>([]);
os.api('get-avatar-decorations').then(_avatarDecorations => {
avatarDecorations.value = _avatarDecorations;
_avatarDecorations.forEach(item => {
if (item.name.includes('import_')) {
remoteAvatarDecorations.value.push(item);
} else {
localAvatarDecorations.value.push(item);
}
});
loading.value = false;
});
function openLocalDecoration(avatarDecoration, index?: number) {
os.popup(defineAsyncComponent(() => import('./avatar-decoration.dialog.vue')), {
decoration: avatarDecoration,
usingIndex: index,
}, {
'attach': async (payload) => {
const decoration = {
id: avatarDecoration.id,
angle: payload.angle,
flipH: payload.flipH,
offsetX: payload.offsetX,
offsetY: payload.offsetY,
};
const update = [...$i.avatarDecorations, decoration];
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
'update': async (payload) => {
const decoration = {
id: avatarDecoration.id,
angle: payload.angle,
flipH: payload.flipH,
offsetX: payload.offsetX,
offsetY: payload.offsetY,
};
const update = [...$i.avatarDecorations];
update[index] = decoration;
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
'detach': async () => {
const update = [...$i.avatarDecorations];
update.splice(index, 1);
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
}, 'closed');
}
function openRemoteDecoration(avatarDecoration, index?: number) {
os.popup(defineAsyncComponent(() => import('./avatar-decoration.dialog.vue')), {
decoration: avatarDecoration,
usingIndex: index,
}, {
'attach': async (payload) => {
const decoration = {
id: avatarDecoration.id,
angle: payload.angle,
flipH: payload.flipH,
offsetX: payload.offsetX,
offsetY: payload.offsetY,
};
const update = [...$i.avatarDecorations, decoration];
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
'update': async (payload) => {
const decoration = {
id: avatarDecoration.id,
angle: payload.angle,
flipH: payload.flipH,
offsetX: payload.offsetX,
offsetY: payload.offsetY,
};
const update = [...$i.avatarDecorations];
update[index] = decoration;
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
'detach': async () => {
const update = [...$i.avatarDecorations];
update.splice(index, 1);
await os.apiWithDialog('i/update', {
avatarDecorations: update,
});
$i.avatarDecorations = update;
},
}, 'closed');
}
function openDecoration(avatarDecoration, index?: number) {
os.popup(defineAsyncComponent(() => import('./avatar-decoration.dialog.vue')), {
decoration: avatarDecoration,
Expand Down Expand Up @@ -108,6 +221,7 @@ function openDecoration(avatarDecoration, index?: number) {
}, 'closed');
}
function detachAllDecorations() {
os.confirm({
type: 'warning',
Expand Down

0 comments on commit 2b19db7

Please sign in to comment.