Section "Grundriss (interaktiv)": floor plan with rooms, admin editor, Seebad view
- Table floor_plans (tenant_id, one per apartment, picture = website photo, rooms as JSON with corners in percent of the picture), model FloorPlan with BelongsToTenant, Property::floorPlan() - Admin › Webseite › Grundriss: room list with name, description, photos, equipment (from the equipment list), accessibility hint, visibility, and an area editor (click the corners on the picture) - Section floor_plan: base view without JavaScript (areas jump to the room list), Seebad view with room buttons, highlighted area and a cartouche per room (theme.js initFloorPlans) - Tests: tenant inheritance, point parsing, website output, admin create incl. validation; the render test for all themes now includes the floor plan - Docs: THEMES §5, ZUSAMMENARBEIT §6, STATUS §6 (incl. note for tenancy phase 5) - styles/grundriss: revised rendering, WebP renditions, room areas of the Stommer flat in percent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04b5189bd8
commit
f7cbc66451
26 files changed
+877
-1
No files matched your search
@@ -50,3 +50,50 @@ function initMenuPanels() {
|
||||
}
|
||||
|
||||
initMenuPanels();
|
||||
|
||||
/**
|
||||
* Floor plan (sections/floor_plan): one room at a time. Areas and room buttons select a room; on narrow
|
||||
* screens the description below the plan is scrolled into view. Without JavaScript all rooms are listed.
|
||||
*/
|
||||
function initFloorPlans() {
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
document.querySelectorAll('[data-floor-plan]').forEach((plan) => {
|
||||
const rooms = [...plan.querySelectorAll('[data-floor-room]')];
|
||||
const links = [...plan.querySelectorAll('[data-floor-room-link]')];
|
||||
if (rooms.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const select = (key, scroll) => {
|
||||
rooms.forEach((room) => {
|
||||
room.hidden = room.id !== key;
|
||||
});
|
||||
links.forEach((link) => {
|
||||
const active = link.dataset.floorRoomLink === key;
|
||||
link.toggleAttribute('data-active', active);
|
||||
if (active) {
|
||||
link.setAttribute('aria-current', 'true');
|
||||
} else {
|
||||
link.removeAttribute('aria-current');
|
||||
}
|
||||
});
|
||||
const room = rooms.find((candidate) => candidate.id === key);
|
||||
if (scroll && room && room.getBoundingClientRect().top > window.innerHeight) {
|
||||
room.scrollIntoView({ behavior: reduceMotion ? 'auto' : 'smooth', block: 'nearest' });
|
||||
}
|
||||
};
|
||||
|
||||
links.forEach((link) => {
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
select(link.dataset.floorRoomLink, true);
|
||||
});
|
||||
});
|
||||
|
||||
const fromHash = rooms.find((room) => `#${room.id}` === window.location.hash);
|
||||
select((fromHash ?? rooms[0]).id, false);
|
||||
});
|
||||
}
|
||||
|
||||
initFloorPlans();
|
||||
@@ -0,0 +1,67 @@
|
||||
{{--
|
||||
Contract: $heading, $text, $photo, $rooms (see ostsee-licht/views/sections/floor_plan.blade.php).
|
||||
theme.js (initFloorPlans) shows one room at a time; without JavaScript all rooms are listed and the areas jump to them.
|
||||
--}}
|
||||
@if ($photo && $rooms->isNotEmpty())
|
||||
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8 sm:py-20" aria-labelledby="{{ $sectionId }}-title" data-floor-plan>
|
||||
<div class="flex flex-wrap items-end justify-between gap-x-12 gap-y-3">
|
||||
<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>
|
||||
@if ($text)<p class="max-w-[44ch] text-muted">{{ $text }}</p>@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-10 flex flex-wrap items-start gap-10">
|
||||
<div class="min-w-0 flex-[999_1_38rem]">
|
||||
<div class="border-2 border-ink bg-surface p-2 sm:p-4">
|
||||
<div class="relative">
|
||||
@include('theme::partials.image', ['photo' => $photo, 'sizes' => '(min-width: 1024px) 60vw, 100vw', 'class' => 'h-auto w-full'])
|
||||
<svg viewBox="0 0 100 100" preserveAspectRatio="none" class="absolute inset-0 size-full" role="group" aria-label="Räume im Grundriss">
|
||||
@foreach ($rooms as $room)
|
||||
<a href="#{{ $room['key'] }}" data-floor-room-link="{{ $room['key'] }}" aria-label="{{ $room['name'] }}" class="group">
|
||||
<polygon points="{{ $room['points'] }}" vector-effect="non-scaling-stroke"
|
||||
class="fill-accent/0 stroke-accent/50 [stroke-width:2] transition group-hover:fill-accent/15 group-focus-visible:fill-accent/20 group-data-[active]:fill-accent/25 group-data-[active]:stroke-accent group-data-[active]:[stroke-width:3]"><title>{{ $room['name'] }}</title></polygon>
|
||||
</a>
|
||||
@endforeach
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<nav aria-label="Raum wählen" class="mt-5">
|
||||
<ul class="flex flex-wrap gap-2.5">
|
||||
@foreach ($rooms as $room)
|
||||
<li><a href="#{{ $room['key'] }}" data-floor-room-link="{{ $room['key'] }}"
|
||||
class="inline-flex min-h-12 items-center rounded-full border-2 border-ink bg-surface px-5 font-semibold hover:bg-ink/5 data-[active]:bg-ink data-[active]:text-ground">{{ $room['name'] }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="min-w-0 flex-[1_1_22rem] space-y-12">
|
||||
@foreach ($rooms as $room)
|
||||
<article id="{{ $room['key'] }}" data-floor-room class="cartouche scroll-mt-28 px-6 pt-10 pb-7 sm:px-7" aria-labelledby="{{ $room['key'] }}-name">
|
||||
<span class="absolute -top-0.5 -left-0.5" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-9'])</span>
|
||||
<span class="absolute -top-0.5 -right-0.5 -scale-x-100" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-9'])</span>
|
||||
@if ($room['photos']->isNotEmpty())
|
||||
@include('theme::partials.image', ['photo' => $room['photos']->first(), 'sizes' => '(min-width: 1024px) 26rem, 100vw', 'class' => 'mb-5 h-56 w-full rounded object-cover'])
|
||||
@endif
|
||||
<h3 id="{{ $room['key'] }}-name" class="font-display text-[2rem] leading-tight">{{ $room['name'] }}</h3>
|
||||
@if ($room['description'])<p class="mt-2 text-muted">{{ $room['description'] }}</p>@endif
|
||||
@if ($room['amenities']->isNotEmpty())
|
||||
<ul class="mt-4 space-y-1.5">
|
||||
@foreach ($room['amenities'] as $amenity)
|
||||
<li class="flex gap-3"><x-heroicon-o-check class="mt-1 size-5 shrink-0 text-accent" aria-hidden="true" />{{ $amenity }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@if ($room['hint'])<p class="mt-5 border-l-[3px] border-accent bg-ground px-4 py-3">{{ $room['hint'] }}</p>@endif
|
||||
@if ($room['photos']->count() > 1)
|
||||
<ul class="mt-5 grid grid-cols-3 gap-2">
|
||||
@foreach ($room['photos']->skip(1) as $more)
|
||||
<li><a href="{{ $more->url('lg') }}" data-lightbox data-alt="{{ $more->alt_text }}" class="block overflow-hidden rounded">@include('theme::partials.image', ['photo' => $more, 'sizes' => '8rem', 'class' => 'h-20 w-full object-cover'])</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</article>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endif
|
||||
Reference in new issue
Block a user