Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions resources/js/components/drawers/PhotoDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
src="../../../img/icons/camera.png"
class="dark:invert opacity-50 w-6 h-6"
/>
<span class="text-sm">{{ photoStore.photo.preformatted.model }}</span>
<span class="text-sm">{{ cameraModel }}</span>
</div>
<div v-if="photoStore.photo.preformatted.lens" class="flex w-full gap-2 mb-2">
<img
Expand Down Expand Up @@ -228,7 +228,7 @@
</aside>
</template>
<script setup lang="ts">
import { Ref, ref, watch } from "vue";
import { Ref, ref, watch, computed } from "vue";
import Card from "primevue/card";
import ProgressSpinner from "primevue/progressspinner";
import MapInclude from "@/components/gallery/photoModule/MapInclude.vue";
Expand Down Expand Up @@ -262,6 +262,24 @@ const albums_loading = ref(false);
const albums_error = ref(false);
const albums_cached_photo_id = ref<string | null>(null);

const cameraModel = computed(() => getModel());

function getModel() {
if (photoStore.photo === null || photoStore.photo === undefined || photoStore.photo.preformatted.model === null) {
return "";
}

if (photoStore.photo.preformatted.make === null || photoStore.photo.preformatted.make === "") {
return photoStore.photo.preformatted.model ?? "";
}

if (photoStore.photo.preformatted.model.startsWith(photoStore.photo.preformatted.make)) {
return photoStore.photo.preformatted.model;
}

return `${photoStore.photo.preformatted.make} - ${photoStore.photo.preformatted.model}`;
}

function fetchAlbums(photo_id: string) {
if (albums_cached_photo_id.value === photo_id) {
return;
Expand Down
Loading