2022-06-24 21:43:28 +09:00
|
|
|
<template>
|
2023-04-08 09:01:42 +09:00
|
|
|
<div>
|
|
|
|
<MkPagination
|
|
|
|
v-slot="{ items }"
|
|
|
|
:pagination="pagination"
|
|
|
|
class="urempief"
|
|
|
|
:class="{ grid: viewMode === 'grid' }"
|
2022-06-24 21:48:54 +09:00
|
|
|
>
|
2023-04-08 09:01:42 +09:00
|
|
|
<MkA
|
|
|
|
v-for="file in items"
|
|
|
|
:key="file.id"
|
|
|
|
v-tooltip.mfm="
|
|
|
|
`${file.type}\n${bytes(file.size)}\n${new Date(
|
|
|
|
file.createdAt
|
|
|
|
).toLocaleString()}\nby ${
|
|
|
|
file.user ? '@' + Acct.toString(file.user) : 'system'
|
|
|
|
}`
|
|
|
|
"
|
|
|
|
:to="`/admin/file/${file.id}`"
|
|
|
|
class="file _button"
|
|
|
|
>
|
|
|
|
<div v-if="file.isSensitive" class="sensitive-label">
|
|
|
|
{{ i18n.ts.sensitive }}
|
2022-06-24 21:43:28 +09:00
|
|
|
</div>
|
2023-04-08 09:01:42 +09: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" />
|
|
|
|
<div v-else>{{ i18n.ts.system }}</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span style="margin-right: 1em">{{ file.type }}</span>
|
|
|
|
<span>{{ bytes(file.size) }}</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span
|
|
|
|
>{{ i18n.ts.registeredDate }}:
|
|
|
|
<MkTime :time="file.createdAt" mode="detail"
|
|
|
|
/></span>
|
|
|
|
</div>
|
2022-06-24 21:43:28 +09:00
|
|
|
</div>
|
2023-04-08 09:01:42 +09:00
|
|
|
</MkA>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2022-06-24 21:43:28 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-04-08 09:01:42 +09:00
|
|
|
import { computed } from "vue";
|
|
|
|
import * as Acct from "calckey-js/built/acct";
|
|
|
|
import MkSwitch from "@/components/ui/switch.vue";
|
|
|
|
import MkPagination from "@/components/MkPagination.vue";
|
|
|
|
import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
|
|
|
|
import bytes from "@/filters/bytes";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { i18n } from "@/i18n";
|
2022-06-24 21:43:28 +09:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
pagination: any;
|
2023-04-08 09:01:42 +09:00
|
|
|
viewMode: "grid" | "list";
|
2022-06-24 21:43:28 +09:00
|
|
|
}>();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-06-25 00:03:59 +09:00
|
|
|
@keyframes sensitive-blink {
|
2023-04-08 09:01:42 +09:00
|
|
|
0% {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2022-06-25 00:03:59 +09:00
|
|
|
}
|
|
|
|
|
2022-06-24 21:43:28 +09:00
|
|
|
.urempief {
|
|
|
|
margin-top: var(--margin);
|
|
|
|
|
|
|
|
&.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 13:28:47 +09:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
2022-06-24 21:43:28 +09:00
|
|
|
grid-gap: 12px;
|
|
|
|
margin: var(--margin) 0;
|
|
|
|
|
|
|
|
> .file {
|
2022-06-25 00:03:59 +09:00
|
|
|
position: relative;
|
2022-06-24 21:43:28 +09:00
|
|
|
aspect-ratio: 1;
|
2023-04-08 09:01:42 +09:00
|
|
|
|
2022-06-24 21:43:28 +09:00
|
|
|
> .thumbnail {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
2022-06-25 00:03:59 +09:00
|
|
|
|
|
|
|
> .sensitive-label {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 10;
|
|
|
|
top: 8px;
|
|
|
|
left: 8px;
|
|
|
|
padding: 2px 4px;
|
|
|
|
background: #ff0000bf;
|
|
|
|
color: #fff;
|
|
|
|
border-radius: 4px;
|
|
|
|
font-size: 85%;
|
|
|
|
animation: sensitive-blink 1s infinite;
|
|
|
|
}
|
2022-06-24 21:43:28 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|