@props([ 'typ' => 'glowny', 'rozmiar' => 'M', 'href' => null, ]) @php $klasy = [ 'inline-flex shrink-0 items-center justify-center gap-2 rounded-lg text-[14px] leading-[1.4] font-semibold whitespace-nowrap transition-colors disabled:pointer-events-none disabled:opacity-40', 'h-[34px] px-4' => $rozmiar === 'M', 'h-10 px-5' => $rozmiar === 'L', 'bg-akcent text-na-akcencie hover:brightness-110' => $typ === 'glowny', 'border border-obrys-przycisku bg-powierzchnia text-tekst hover:bg-powierzchnia-2' => $typ === 'drugorzedny', 'bg-akcent-tlo text-akcent-tekst hover:brightness-95' => $typ === 'tonalny', 'bg-blad text-white hover:brightness-110' => $typ === 'usun', ]; /** Adres w innej domenie (aplikacja eSkul, eskul.cloud) otwiera się w nowej karcie. */ $hostAdresu = $href ? parse_url($href, PHP_URL_HOST) : null; $zewnetrzny = is_string($hostAdresu) && $hostAdresu !== request()->getHost(); /** Podgląd profilu (MK27apg, ESK-1780): przyciski z linkiem (zapis, wiadomość, lekcja próbna) są nieaktywne. */ $wylaczonyWPodgladzie = $href !== null && (bool) request()->attributes->get('podgladProfilu', false); /** Szkoła demo (ESK-1847): zapis, wiadomość, lekcja próbna, rezerwacja i przejęcie są nieaktywne z dymkiem. */ $sciezkaAdresu = $href !== null ? (string) parse_url($href, PHP_URL_PATH) : ''; $wylaczonyWDemo = $href !== null && \App\Marketplace\ProfilDemo::jest() && (preg_match('~/(zapis|lekcja-probna|rezerwacja|to-moja-szkola|dla-szkol/przejmij)/|/napisz$~', $sciezkaAdresu) === 1 || parse_url($href, PHP_URL_FRAGMENT) === 'zapytaj'); @endphp @if ($wylaczonyWDemo) except(['rel', 'target', 'x-on:click', 'data-kontakt', 'href'])->class([...$klasy, 'cursor-not-allowed opacity-40']) }} >{{ $slot }} (to profil przykładowy) @elseif ($wylaczonyWPodgladzie) except(['rel', 'target', 'x-on:click', 'data-kontakt'])->class([...$klasy, 'cursor-not-allowed opacity-40']) }} >{{ $slot }} (dostępne po publikacji) @elseif ($href) except($zewnetrzny ? ['rel', 'target'] : [])->class($klasy) }} >{{ $slot }}@if ($zewnetrzny) (otwiera się w nowym oknie)@endif @else @endif