2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-24 14:43:28 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<MkPagination v-slot="{items}" :pagination="pagination" class="urempief" :class="{ grid: viewMode === 'grid' }">
|
2022-06-24 14:48:54 +02:00
|
|
|
<MkA
|
|
|
|
v-for="file in items"
|
|
|
|
:key="file.id"
|
2023-09-04 06:33:38 +02:00
|
|
|
v-tooltip.mfm="`${file.type}\n${bytes(file.size)}\n${dateString(file.createdAt)}\nby ${file.user ? '@' + Misskey.acct.toString(file.user) : 'system'}`"
|
2022-06-24 14:48:54 +02:00
|
|
|
:to="`/admin/file/${file.id}`"
|
|
|
|
class="file _button"
|
|
|
|
>
|
2022-06-24 17:03:59 +02:00
|
|
|
<div v-if="file.isSensitive" class="sensitive-label">{{ i18n.ts.sensitive }}</div>
|
2022-06-24 14:43:28 +02:00
|
|
|
<MkDriveFileThumbnail class="thumbnail" :file="file" fit="contain"/>
|
|
|
|
<div v-if="viewMode === 'list'" class="body">
|
|
|
|
<div>
|
|
|
|
<small style="opacity: 0.7;">{{ file.name }}</small>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<MkAcct v-if="file.user" :user="file.user"/>
|
2022-06-24 17:03:59 +02:00
|
|
|
<div v-else>{{ i18n.ts.system }}</div>
|
2022-06-24 14:43:28 +02:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span style="margin-right: 1em;">{{ file.type }}</span>
|
|
|
|
<span>{{ bytes(file.size) }}</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
2022-06-24 17:03:59 +02:00
|
|
|
<span>{{ i18n.ts.registeredDate }}: <MkTime :time="file.createdAt" mode="detail"/></span>
|
2022-06-24 14:43:28 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-24 14:48:54 +02:00
|
|
|
</MkA>
|
2022-06-24 14:43:28 +02:00
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-09-04 06:33:38 +02:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-12-26 13:40:27 +01:00
|
|
|
import MkPagination, { Paging } from '@/components/MkPagination.vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import bytes from '@/filters/bytes.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { dateString } from '@/filters/date.js';
|
2022-06-24 14:43:28 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
2023-12-26 13:40:27 +01:00
|
|
|
pagination: Paging;
|
2022-06-24 14:43:28 +02:00
|
|
|
viewMode: 'grid' | 'list';
|
|
|
|
}>();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-06-24 17:03:59 +02:00
|
|
|
@keyframes sensitive-blink {
|
|
|
|
0% { opacity: 1; }
|
|
|
|
50% { opacity: 0; }
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:43:28 +02:00
|
|
|
.urempief {
|
|
|
|
&.list {
|
|
|
|
> .file {
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
text-align: left;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .thumbnail {
|
|
|
|
width: 128px;
|
|
|
|
height: 128px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
margin-left: 0.3em;
|
|
|
|
padding: 8px;
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.grid {
|
|
|
|
display: grid;
|
2022-06-26 06:28:47 +02:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
2022-06-24 14:43:28 +02:00
|
|
|
grid-gap: 12px;
|
|
|
|
|
|
|
|
> .file {
|
2022-06-24 17:03:59 +02:00
|
|
|
position: relative;
|
2022-06-24 14:43:28 +02:00
|
|
|
aspect-ratio: 1;
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2022-06-24 14:43:28 +02:00
|
|
|
> .thumbnail {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
2022-06-24 17:03:59 +02:00
|
|
|
|
|
|
|
> .sensitive-label {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 10;
|
|
|
|
top: 8px;
|
|
|
|
left: 8px;
|
|
|
|
padding: 2px 4px;
|
|
|
|
background: #ff0000bf;
|
|
|
|
color: #fff;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-xs);
|
2022-06-24 17:03:59 +02:00
|
|
|
font-size: 85%;
|
|
|
|
animation: sensitive-blink 1s infinite;
|
|
|
|
}
|
2022-06-24 14:43:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|