Skip to content

Commit

Permalink
fix map on info bar feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Oct 11, 2024
1 parent db0628c commit 6e98e46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/Http/Resources/Models/PhotoResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use App\Http\Resources\Models\Utils\PreComputedPhotoData;
use App\Http\Resources\Models\Utils\PreformattedPhotoData;
use App\Http\Resources\Rights\PhotoRightsResource;
use App\Models\Configs;
use App\Models\Photo;
use Illuminate\Support\Facades\Auth;
use Spatie\LaravelData\Data;
use Spatie\TypeScriptTransformer\Attributes\TypeScript;

Expand Down Expand Up @@ -67,7 +69,7 @@ public function __construct(Photo $photo)
$this->live_photo_checksum = $photo->live_photo_checksum;
$this->live_photo_content_id = $photo->live_photo_content_id;
$this->live_photo_url = $photo->live_photo_url;
$this->location = $photo->location;
$this->setLocation($photo);
$this->longitude = $photo->longitude;
$this->make = $photo->make;
$this->model = $photo->model;
Expand All @@ -91,4 +93,10 @@ public static function fromModel(Photo $photo): PhotoResource
{
return new self($photo);
}

private function setLocation(Photo $photo): void
{
$showLocation = Configs::getValueAsBool('location_show') && (Auth::check() || Configs::getValueAsBool('location_show_public'));
$this->location = $showLocation ? $photo->location : null;
}
}
3 changes: 2 additions & 1 deletion resources/js/components/drawers/PhotoDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<h2 v-if="props.photo.precomputed.has_location" class="col-span-2 text-muted-color font-bold px-3 pt-4 pb-3">
{{ $t("lychee.PHOTO_LOCATION") }}
</h2>
<MapInclude :latitude="props.photo.latitude" :longitude="props.photo.longitude" />
<MapInclude :latitude="props.photo.latitude" :longitude="props.photo.longitude" v-if="props.isMapVisible" />
<template v-if="props.photo.precomputed.has_location">
<span class="py-0.5 px-3 text-sm" v-if="props.photo.preformatted.latitude">{{ $t("lychee.PHOTO_LATITUDE") }}</span>
<span class="py-0.5 pl-0 text-sm" v-if="props.photo.preformatted.latitude">{{ props.photo.preformatted.latitude }}</span>
Expand Down Expand Up @@ -113,6 +113,7 @@ import MapInclude from "../gallery/photo/MapInclude.vue";
const props = defineProps<{
photo: App.Http.Resources.Models.PhotoResource | undefined;
isMapVisible: boolean;
}>();
const areDetailsOpen = defineModel("areDetailsOpen", { default: true }) as Ref<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion resources/js/views/gallery-panels/Photo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
</span>
</div>
</div>
<PhotoDetails v-model:are-details-open="are_details_open" :photo="photo" />
<PhotoDetails v-model:are-details-open="are_details_open" :photo="photo" :is-map-visible="album?.config.is_map_accessible ?? false" />
</div>
<PhotoEdit v-if="photo?.rights.can_edit" :photo="photo" v-model:visible="is_edit_open" />
<MoveDialog :photo="photo" v-model:visible="isMoveVisible" :parent-id="props.albumid" @moved="updated" />
Expand Down

0 comments on commit 6e98e46

Please sign in to comment.