2018-02-15 11:33:34 +02:00
|
|
|
<template>
|
2021-04-16 06:17:22 +03:00
|
|
|
<MkContainer :max-height="300" :foldable="true">
|
2020-12-26 03:47:36 +02:00
|
|
|
<template #header><Fa :icon="faImage" style="margin-right: 0.5em;"/>{{ $ts.images }}</template>
|
2020-11-25 14:31:34 +02:00
|
|
|
<div class="ujigsodd">
|
|
|
|
<MkLoading v-if="fetching"/>
|
|
|
|
<div class="stream" v-if="!fetching && images.length > 0">
|
|
|
|
<MkA v-for="image in images"
|
|
|
|
class="img"
|
|
|
|
:to="notePage(image.note)"
|
2021-04-16 03:41:56 +03:00
|
|
|
:key="image.id"
|
2021-04-16 06:06:54 +03:00
|
|
|
>
|
|
|
|
<ImgWithBlurhash :hash="image.blurhash" :src="thumbnail(image.file)" :alt="image.name" :title="image.name"/>
|
|
|
|
</MkA>
|
2020-11-25 14:31:34 +02:00
|
|
|
</div>
|
2020-12-26 03:47:36 +02:00
|
|
|
<p class="empty" v-if="!fetching && images.length == 0">{{ $ts.nothing }}</p>
|
2018-02-15 11:33:34 +02:00
|
|
|
</div>
|
2020-11-25 14:31:34 +02:00
|
|
|
</MkContainer>
|
2018-02-15 11:33:34 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 14:12:00 +03:00
|
|
|
import { defineComponent } from 'vue';
|
2020-11-25 14:31:34 +02:00
|
|
|
import { faImage } from '@fortawesome/free-solid-svg-icons';
|
2021-03-23 10:30:14 +02:00
|
|
|
import { getStaticImageUrl } from '@client/scripts/get-static-image-url';
|
2020-10-17 14:12:00 +03:00
|
|
|
import notePage from '../../filters/note';
|
2021-03-23 10:30:14 +02:00
|
|
|
import * as os from '@client/os';
|
|
|
|
import MkContainer from '@client/components/ui/container.vue';
|
2021-04-16 06:06:54 +03:00
|
|
|
import ImgWithBlurhash from '@client/components/img-with-blurhash.vue';
|
2018-03-27 10:51:12 +03:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-11-25 14:31:34 +02:00
|
|
|
components: {
|
|
|
|
MkContainer,
|
2021-04-16 06:06:54 +03:00
|
|
|
ImgWithBlurhash,
|
2020-11-25 14:31:34 +02:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
2018-02-15 11:33:34 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
2020-11-25 14:31:34 +02:00
|
|
|
images: [],
|
|
|
|
faImage
|
2018-02-15 11:33:34 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-12-18 23:04:59 +02:00
|
|
|
const image = [
|
|
|
|
'image/jpeg',
|
|
|
|
'image/png',
|
2019-07-04 08:45:28 +03:00
|
|
|
'image/gif',
|
|
|
|
'image/apng',
|
|
|
|
'image/vnd.mozilla.apng',
|
2018-12-18 23:04:59 +02:00
|
|
|
];
|
2020-10-17 14:12:00 +03:00
|
|
|
os.api('users/notes', {
|
2018-03-29 08:48:47 +03:00
|
|
|
userId: this.user.id,
|
2018-12-18 23:04:59 +02:00
|
|
|
fileType: image,
|
2020-12-19 03:55:52 +02:00
|
|
|
excludeNsfw: this.$store.state.nsfw !== 'ignore',
|
2021-04-16 03:41:56 +03:00
|
|
|
limit: 10,
|
2018-04-07 20:30:37 +03:00
|
|
|
}).then(notes => {
|
2018-12-11 13:36:55 +02:00
|
|
|
for (const note of notes) {
|
2019-04-08 10:34:45 +03:00
|
|
|
for (const file of note.files) {
|
2021-04-16 03:41:56 +03:00
|
|
|
this.images.push({
|
|
|
|
note,
|
|
|
|
file
|
|
|
|
});
|
2018-12-11 13:36:55 +02:00
|
|
|
}
|
|
|
|
}
|
2018-02-19 16:37:09 +02:00
|
|
|
this.fetching = false;
|
2018-02-15 11:33:34 +02:00
|
|
|
});
|
2019-02-04 23:22:39 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
thumbnail(image: any): string {
|
2020-12-19 03:55:52 +02:00
|
|
|
return this.$store.state.disableShowingAnimatedImages
|
2019-02-04 23:22:39 +02:00
|
|
|
? getStaticImageUrl(image.thumbnailUrl)
|
|
|
|
: image.thumbnailUrl;
|
|
|
|
},
|
2020-10-17 14:12:00 +03:00
|
|
|
notePage
|
2019-02-04 23:22:39 +02:00
|
|
|
},
|
2018-02-15 11:33:34 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ujigsodd {
|
2020-11-25 14:31:34 +02:00
|
|
|
padding: 8px;
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
> .stream {
|
2021-04-16 03:41:56 +03:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
|
|
|
grid-gap: 6px;
|
2018-02-15 11:33:34 +02:00
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
> .img {
|
2021-04-16 03:41:56 +03:00
|
|
|
height: 128px;
|
2020-10-17 14:12:00 +03:00
|
|
|
border-radius: 6px;
|
2021-04-16 06:06:54 +03:00
|
|
|
overflow: clip;
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
}
|
2018-02-15 11:33:34 +02:00
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
> .empty {
|
|
|
|
margin: 0;
|
|
|
|
padding: 16px;
|
|
|
|
text-align: center;
|
2018-02-15 11:33:34 +02:00
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
> i {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-15 11:33:34 +02:00
|
|
|
</style>
|