forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance(frontend): ユーザーページに「ファイル」タブを新設 (#167)
- Loading branch information
1 parent
d696cbb
commit 01df944
Showing
5 changed files
with
198 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: syuilo and misskey-project | ||
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)" | ||
:class="[$style.filePreview, { [$style.square]: square }]" | ||
@click="showingFiles.add(file.id)" | ||
> | ||
<MkDriveFileThumbnail | ||
:file="file" | ||
fit="cover" | ||
:highlightWhenSensitive="defaultStore.state.highlightSensitiveMedia" | ||
:forceBlurhash="true" | ||
:large="true" | ||
:bgIsPanel="bgIsPanel" | ||
:class="$style.file" | ||
/> | ||
<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.filePreview, { [$style.square]: square }]" :to="notePage(note)"> | ||
<MkDriveFileThumbnail | ||
:file="file" | ||
fit="cover" | ||
:highlightWhenSensitive="defaultStore.state.highlightSensitiveMedia" | ||
:large="true" | ||
:bgIsPanel="bgIsPanel" | ||
:class="$style.file" | ||
/> | ||
</MkA> | ||
</template> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
import { notePage } from '@/filters/note.js'; | ||
import { i18n } from '@/i18n.js'; | ||
import * as Misskey from 'misskey-js'; | ||
import { defaultStore } from '@/store.js'; | ||
|
||
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; | ||
|
||
defineProps<{ | ||
note: Misskey.entities.Note; | ||
square?: boolean; | ||
bgIsPanel?: boolean; | ||
}>(); | ||
|
||
const showingFiles = ref<Set<string>>(new Set()); | ||
</script> | ||
|
||
<style lang="scss" module> | ||
.square { | ||
width: 100%; | ||
height: auto; | ||
aspect-ratio: 1; | ||
} | ||
|
||
.filePreview { | ||
position: relative; | ||
height: 128px; | ||
border-radius: calc(var(--MI-radius) / 2); | ||
overflow: clip; | ||
|
||
&:hover { | ||
text-decoration: none; | ||
} | ||
|
||
&.square { | ||
height: 100%; | ||
} | ||
} | ||
|
||
.file { | ||
width: 100%; | ||
height: 100%; | ||
border-radius: calc(var(--MI-radius) / 2); | ||
} | ||
|
||
.sensitive { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
display: grid; | ||
place-items: center; | ||
font-size: 0.8em; | ||
color: #fff; | ||
background: rgba(0, 0, 0, 0.5); | ||
backdrop-filter: blur(5px); | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: syuilo and misskey-project | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
--> | ||
|
||
<template> | ||
<MkSpacer :contentMax="1100"> | ||
<div :class="$style.root"> | ||
<MkPagination v-slot="{items}" :pagination="pagination"> | ||
<div :class="$style.stream"> | ||
<MkNoteMediaGrid v-for="note in items" :note="note" square/> | ||
</div> | ||
</MkPagination> | ||
</div> | ||
</MkSpacer> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { computed } from 'vue'; | ||
import * as Misskey from 'misskey-js'; | ||
|
||
import MkNoteMediaGrid from '@/components/MkNoteMediaGrid.vue'; | ||
import MkPagination from '@/components/MkPagination.vue'; | ||
|
||
const props = defineProps<{ | ||
user: Misskey.entities.UserDetailed; | ||
}>(); | ||
|
||
const pagination = { | ||
endpoint: 'users/notes' as const, | ||
limit: 15, | ||
params: computed(() => ({ | ||
userId: props.user.id, | ||
withFiles: true, | ||
})), | ||
}; | ||
</script> | ||
|
||
<style lang="scss" module> | ||
.root { | ||
padding: 8px; | ||
} | ||
|
||
.stream { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); | ||
gap: var(--MI-marginHalf); | ||
} | ||
|
||
@media screen and (min-width: 600px) { | ||
.stream { | ||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); | ||
} | ||
|
||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters