-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 103 feature show title picture (#108)
* ✨ added image preview and fallback image to adlist * adjusted api to deliver the blob * ✨ introduced new image component * 💫 improved lazy loading of image * 🍺 adjusted image type --------- Co-authored-by: jannik.lange <[email protected]>
- Loading branch information
Showing
6 changed files
with
83 additions
and
14 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
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
34 changes: 34 additions & 0 deletions
34
anzeigen-frontend/src/components/Ad/Details/AdImageDisplay.vue
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,34 @@ | ||
<template> | ||
<v-img | ||
max-height="500" | ||
class="rounded image-background-color" | ||
:lazy-src="PREVIEW_IMAGE_FILE_URI_PREFIX + adDetails.imagePreviewBase64" | ||
:src="PREVIEW_IMAGE_FILE_URI_PREFIX + adImageData?.imageBase64" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { AdTO } from "@/api/swbrett"; | ||
import { onMounted } from "vue"; | ||
import { useGetAdImage } from "@/composables/api/useFilesApi"; | ||
import { PREVIEW_IMAGE_FILE_URI_PREFIX } from "@/Constants"; | ||
const { call: getAdImage, data: adImageData } = useGetAdImage(); | ||
const { adDetails } = defineProps<{ | ||
adDetails: Readonly<AdTO>; | ||
}>(); | ||
/** | ||
* Loads the "big" image upon mounting this component | ||
*/ | ||
onMounted(async () => { | ||
if (adDetails.adImg?.id) { | ||
await getAdImage({ id: adDetails.adImg?.id }); | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { GetImageRequest, SwbImageTO } from "@/api/swbrett"; | ||
|
||
import { inject } from "vue"; | ||
|
||
import { useApiCall } from "@/composables/api/useApiCall"; | ||
import { DEFAULT_API_KEY } from "@/composables/useApi"; | ||
|
||
export const useGetAdImage = () => { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const api = inject(DEFAULT_API_KEY)!; | ||
|
||
return useApiCall<GetImageRequest, SwbImageTO>((params: GetImageRequest) => | ||
api.getImage(params) | ||
); | ||
}; |