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