Files
coolify/resources/views/components/canvas-view-toggle.blade.php
T
Cursor AgentandAndras Bacsai 8df39bc637 Refresh the dark dashboard around the coolLabs purple brand.
Dark mode keeps a black canvas, paints cards at #121212, and tints the sidebar purple-black. Active navigation, secondary buttons, and the view switcher use brand purple; warning yellow stays for real warnings.

Co-authored-by: Andras Bacsai <andrasbacsai@users.noreply.github.com>
2026-10-22 07:13:38 +00:00

53 lines
2.7 KiB
PHP

@props(['listUrl' => null, 'canvasUrl' => null, 'onCanvas' => false, 'views' => null])
@php
$idle = 'text-neutral-400 hover:bg-neutral-100 hover:text-black dark:hover:text-white';
$canvasItem = 'relative flex h-7.5 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-[12px] font-medium transition-colors';
$views ??= ['table' => ['Table view', 'unordered-list'], 'grid' => ['Grid view', 'grid']];
// One list view (no table / grid choice): nothing to switch to on the list page.
$singleList = count($views) === 1;
@endphp
{{-- Table / grid / canvas switcher. On the list page, table and grid switch the
parent's Alpine viewMode; the canvas page shows one "List view" link back
(?view= makes the list the remembered view again, see RemembersCanvasView).
Pages with one list view pass :views="['list' => [...]]". Without a
canvasUrl it is only a table / grid switcher. --}}
@if ($onCanvas || ! $singleList || filled($canvasUrl))
<div {{ $attributes->merge(['class' => 'view-toggle']) }}>
@if ($onCanvas)
{{-- On the canvas only the way back: one labelled link to the list (its first view). --}}
@php [$label, $icon] = reset($views); @endphp
<a href="{{ $listUrl }}?view={{ array_key_first($views) }}" {{ wireNavigate() }} class="{{ $canvasItem }} {{ $idle }}"
title="List view">
<x-reicon :name="$icon" class="size-3.5" />
List view
</a>
@else
{{-- Every view stays visible. The current one is the selected pill. --}}
@unless ($singleList)
@foreach ($views as $mode => [$label, $icon])
<button type="button" x-on:click="setViewMode(@js($mode))"
class="{{ $canvasItem }}"
:class="viewMode === @js($mode) ? 'is-selected' : @js($idle)"
:aria-pressed="(viewMode === @js($mode)).toString()"
title="{{ $label }}">
<x-reicon :name="$icon" class="size-3.5" />
{{ $label }}
</button>
@endforeach
@endunless
@if (filled($canvasUrl))
{{-- A label and a purple "Try it" badge, so people notice the canvas view. --}}
<a href="{{ $canvasUrl }}" {{ wireNavigate() }}
class="{{ $canvasItem }} {{ $idle }}" title="Canvas view (beta): see everything and how it connects">
<x-reicon name="deploy-canvas" class="size-3.5" />
Canvas
<span
class="ml-0.5 inline-flex items-center rounded-full bg-coollabs px-1.5 py-px text-[10px] leading-4 font-semibold text-white">
Try it
</span>
</a>
@endif
@endif
</div>
@endif