Skip to content

Commit

Permalink
Merge pull request #15 from bezhanSalleh/feature/handle-panel-domains
Browse files Browse the repository at this point in the history
[Feature] Handle Panel Domains
  • Loading branch information
bezhanSalleh authored Nov 17, 2023
2 parents 521a74a + 97b4a04 commit 14da833
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions resources/views/panel-switch-menu.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
@php
$getUrlScheme = (string) app()->environment('production') ? 'https://' : 'http://';
$getPanelPath = fn (\Filament\Panel $panel): string => filled($domains = $panel->getDomains())
? str(collect($domains)->first())->prepend($getUrlScheme)->toString()
: str($panel->getPath())->prepend('/')->toString();
$getHref = fn (\Filament\Panel $panel): ?string => $canSwitchPanels && $panel->getId() !== $currentPanel->getId()
? $getPanelPath($panel)
: null;
@endphp

@if ($isSimple)
<x-filament::dropdown teleport placement="bottom-end">
Expand All @@ -23,7 +34,7 @@ class="w-5 h-5 text-white ms-auto shrink-0"
<x-filament::dropdown.list>
@foreach ($panels as $panel)
<x-filament::dropdown.list.item
:href="$canSwitchPanels && $panel->getId() !== $currentPanel->getId() ? '/' . $panel->getPath() : null"
:href="$getHref($panel)"
:badge="str($labels[$panel->getId()] ?? $panel->getId())->substr(0, 2)->upper()"
tag="a"
>
Expand Down Expand Up @@ -66,7 +77,7 @@ class="flex flex-wrap items-center justify-center gap-4 md:gap-6"
>
@foreach ($panels as $panel)
<a
href="{{ $canSwitchPanels && $panel->getId() !== $currentPanel->getId() ? '/' . $panel->getPath() : '#' }}"
href="{{ $getHref($panel) }}"
class="flex flex-col items-center justify-center flex-1 hover:cursor-pointer group panel-switch-card"
>
<div
Expand Down

0 comments on commit 14da833

Please sign in to comment.