mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 03:40:25 +01:00
共通化
This commit is contained in:
parent
5dba738a4a
commit
c580f5e4cd
3 changed files with 36 additions and 40 deletions
|
@ -5,10 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-for="file in note.files">
|
<template v-for="file in note.files">
|
||||||
<div v-if="file.isSensitive && !showingFiles.includes(file.id)" :class="[$style.sensitive, { [$style.square]: square }]" @click="showingFiles.push(file.id)">
|
<div v-if="file.isSensitive && !showingFiles.includes(file.id)" :class="[$style.img, { [$style.square]: square }]" @click="showingFiles.push(file.id)">
|
||||||
<div>
|
<!-- TODO: 画像以外のファイルに対応 -->
|
||||||
<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div>
|
<ImgWithBlurhash :class="$style.sensitiveImg" :hash="file.blurhash" :src="thumbnail(file)" :title="file.name" :forceBlurhash="true"/>
|
||||||
<div>{{ i18n.ts.clickToShow }}</div>
|
<div :class="$style.sensitive">
|
||||||
|
<div>
|
||||||
|
<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div>
|
||||||
|
<div>{{ i18n.ts.clickToShow }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkA v-else :class="[$style.img, { [$style.square]: square }]" :to="notePage(note)">
|
<MkA v-else :class="[$style.img, { [$style.square]: square }]" :to="notePage(note)">
|
||||||
|
@ -50,7 +54,8 @@ function thumbnail(image: Misskey.entities.DriveFile): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
height: 220px;
|
position: relative;
|
||||||
|
height: 128px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
|
||||||
|
@ -65,8 +70,25 @@ function thumbnail(image: Misskey.entities.DriveFile): string {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sensitiveImg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
filter: brightness(0.7);
|
||||||
|
}
|
||||||
|
|
||||||
.sensitive {
|
.sensitive {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
font-size: 0.8em;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
|
||||||
import MkMedias from '@/components/MkMedias.vue';
|
import MkMedias from '@/components/MkNoteMediaGrid.vue';
|
||||||
import MkPagination from '@/components/MkPagination.vue';
|
import MkPagination from '@/components/MkPagination.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
|
@ -9,25 +9,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #header>{{ i18n.ts.files }}</template>
|
<template #header>{{ i18n.ts.files }}</template>
|
||||||
<div :class="$style.root">
|
<div :class="$style.root">
|
||||||
<MkLoading v-if="fetching"/>
|
<MkLoading v-if="fetching"/>
|
||||||
<div v-if="!fetching && files.length > 0" :class="$style.stream">
|
<div v-if="!fetching && notes.length > 0" :class="$style.stream">
|
||||||
<template v-for="file in files" :key="file.note.id + file.file.id">
|
<MkNoteMediaGrid v-for="note in notes" :note="note"/>
|
||||||
<div v-if="file.file.isSensitive && !showingFiles.includes(file.file.id)" :class="$style.img" @click="showingFiles.push(file.file.id)">
|
|
||||||
<!-- TODO: 画像以外のファイルに対応 -->
|
|
||||||
<ImgWithBlurhash :class="$style.sensitiveImg" :hash="file.file.blurhash" :src="thumbnail(file.file)" :title="file.file.name" :forceBlurhash="true"/>
|
|
||||||
<div :class="$style.sensitive">
|
|
||||||
<div>
|
|
||||||
<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div>
|
|
||||||
<div>{{ i18n.ts.clickToShow }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<MkA v-else :class="$style.img" :to="notePage(file.note)">
|
|
||||||
<!-- TODO: 画像以外のファイルに対応 -->
|
|
||||||
<ImgWithBlurhash :hash="file.file.blurhash" :src="thumbnail(file.file)" :title="file.file.name"/>
|
|
||||||
</MkA>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<p v-if="!fetching && files.length == 0" :class="$style.empty">{{ i18n.ts.nothing }}</p>
|
<p v-if="!fetching && notes.length == 0" :class="$style.empty">{{ i18n.ts.nothing }}</p>
|
||||||
</div>
|
</div>
|
||||||
</MkContainer>
|
</MkContainer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -42,6 +27,7 @@ import MkContainer from '@/components/MkContainer.vue';
|
||||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import MkNoteMediaGrid from '@/components/MkNoteMediaGrid.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
user: Misskey.entities.UserDetailed;
|
user: Misskey.entities.UserDetailed;
|
||||||
|
@ -52,11 +38,7 @@ const emit = defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const fetching = ref(true);
|
const fetching = ref(true);
|
||||||
const files = ref<{
|
const notes = ref<Misskey.entities.Note[]>([]);
|
||||||
note: Misskey.entities.Note;
|
|
||||||
file: Misskey.entities.DriveFile;
|
|
||||||
}[]>([]);
|
|
||||||
const showingFiles = ref<string[]>([]);
|
|
||||||
|
|
||||||
function unfoldContainer(): boolean {
|
function unfoldContainer(): boolean {
|
||||||
emit('unfold');
|
emit('unfold');
|
||||||
|
@ -74,16 +56,8 @@ onMounted(() => {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
withFiles: true,
|
withFiles: true,
|
||||||
limit: 15,
|
limit: 15,
|
||||||
}).then(notes => {
|
}).then(_notes => {
|
||||||
for (const note of notes) {
|
notes.value = _notes;
|
||||||
if (!note.files) continue;
|
|
||||||
for (const file of note.files) {
|
|
||||||
files.value.push({
|
|
||||||
note,
|
|
||||||
file,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fetching.value = false;
|
fetching.value = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue