Skip to content

Commit

Permalink
Insert Logos
Browse files Browse the repository at this point in the history
  • Loading branch information
amenk committed Dec 16, 2023
1 parent f0d2dd6 commit b45c6c1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Models/Place.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getLogoUrl(): string

private function getMediaPath($fileName): string
{
return sprintf('assets/%s/%s/media/%s', $this->repository->name, $this->slug, $fileName);
return sprintf('/assets/%s/%s/media/%s', $this->repository->name, $this->slug, $fileName);
}

public function getProcessedGallery(): array
Expand Down
5 changes: 5 additions & 0 deletions app/Services/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public function resolvePlace(OsmId $branch): ?Place
return null;
}

public function isFeatured(OsmId $branch): bool
{
return $this->resolvePlace($branch) !== null;
}

public function getUrl(OsmInfo $osmInfo)
{
$place = $this->resolvePlace($osmInfo->idInfo);
Expand Down
24 changes: 18 additions & 6 deletions resources/views/page/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,28 @@
<div class="px-5 py-2 max-w-5xl mx-auto">
<h2>{{ count($places) }} {{ Fallback::resolve($type->plural) }} found:</h2>

<ul class="grid md:grid-cols-2 lg:grid-cols-3 grid-flow-row auto-rows-fr mt-6 w-full">
<div class="grid md:grid-cols-2 lg:grid-cols-3 grid-flow-row auto-rows-fr mt-6 w-full">
@foreach($places as $place)
<a class="bg-white max-w-xs no-underline flex items-center mr-8 mb-8 p-4 rounded-lg shadow border-2 border-slate-500"
<a class="no-underline px-4 flex flex-row justify-between items-center border text-card-foreground max-w-md bg-white rounded-xl shadow-md overflow-hidden md:max-w-2xl m-4"
href="{{ \App\Services\Repository::getInstance()->getUrl($place) }}">
<span>
{{ Fallback::field($place->tags, 'name') }}
</span>
<div class="flex-grow">
<h3 class="tracking-tight text-lg font-bold">{{ Fallback::field($place->tags, 'name') }}</h3>
</div>
@if (\App\Services\Repository::getInstance()->isFeatured($place->idInfo))
<div class="flex-shrink-0">
<span
class="relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full mr-4">
<img
class="aspect-square h-full w-full"
alt="Business Logo"
src="{{ \App\Services\Repository::getInstance()->resolvePlace($place->idInfo)?->getLogoUrl() }}"
/>
</span>
</div>
@endif
</a>
@endforeach
</ul>
</div>
</div>
</section>
@stop

0 comments on commit b45c6c1

Please sign in to comment.