From 850d1d00054db27eb171eb879eb7b25ccd7bf4e7 Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sat, 1 Feb 2025 13:51:45 +0900
Subject: fix(frontend): MkDriveFileThumbnail / MkNoteMediaGridの修正 (#15365)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix(frontend): MkDriveFileThumbnailのpropsのタイポ修正

* Update Changelog

* fix: MkNoteMediaGridをデータセーバーに対応させる
---
 packages/frontend/src/components/MkNoteMediaGrid.vue | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'packages/frontend/src/components/MkNoteMediaGrid.vue')

diff --git a/packages/frontend/src/components/MkNoteMediaGrid.vue b/packages/frontend/src/components/MkNoteMediaGrid.vue
index 520421bfb7..bf105c3c27 100644
--- a/packages/frontend/src/components/MkNoteMediaGrid.vue
+++ b/packages/frontend/src/components/MkNoteMediaGrid.vue
@@ -6,7 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only
 <template>
 	<template v-for="file in note.files">
 		<div
-			v-if="(defaultStore.state.nsfw === 'force' || file.isSensitive) && defaultStore.state.nsfw !== 'ignore' && !showingFiles.has(file.id)"
+			v-if="(((
+					(defaultStore.state.nsfw === 'force' || file.isSensitive) &&
+					defaultStore.state.nsfw !== 'ignore'
+				) || (defaultStore.state.dataSaver.media && file.type.startsWith('image/'))) &&
+				!showingFiles.has(file.id)
+			)"
 			:class="[$style.filePreview, { [$style.square]: square }]"
 			@click="showingFiles.add(file.id)"
 		>
@@ -20,7 +25,8 @@ SPDX-License-Identifier: AGPL-3.0-only
 			/>
 			<div :class="$style.sensitive">
 				<div>
-					<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div>
+					<div v-if="file.isSensitive"><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}{{ defaultStore.state.dataSaver.media && file.size ? ` (${bytes(file.size)})` : '' }}</div>
+					<div v-else><i class="ti ti-photo"></i> {{ defaultStore.state.dataSaver.media && file.size ? bytes(file.size) : i18n.ts.image }}</div>
 					<div>{{ i18n.ts.clickToShow }}</div>
 				</div>
 			</div>
@@ -43,6 +49,7 @@ import { notePage } from '@/filters/note.js';
 import { i18n } from '@/i18n.js';
 import * as Misskey from 'misskey-js';
 import { defaultStore } from '@/store.js';
+import bytes from '@/filters/bytes.js';
 
 import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
 
@@ -91,6 +98,9 @@ const showingFiles = ref<Set<string>>(new Set());
 	display: grid;
   place-items: center;
 	font-size: 0.8em;
+	text-align: center;
+	padding: 8px;
+	box-sizing: border-box;
 	color: #fff;
 	background: rgba(0, 0, 0, 0.5);
 	backdrop-filter: blur(5px);
-- 
cgit v1.2.3-freya

