@php $team = auth()->user()?->currentTeam(); $projectUuid = request()->route('project_uuid'); $environmentUuid = request()->route('environment_uuid'); $projects = $projectUuid && $team ? $team->projects()->get() : collect(); $currentProject = $projectUuid ? $projects->firstWhere('uuid', $projectUuid) : null; $environments = $currentProject ? $currentProject->environments()->get() : collect(); $currentEnvironment = $environmentUuid ? $environments->firstWhere('uuid', $environmentUuid) : null; $projectDestinationRoute = request()->routeIs('shared-variables.project.*') ? 'shared-variables.project.show' : 'project.show'; $applicationUuid = request()->route('application_uuid'); $currentApplication = $currentEnvironment && $applicationUuid ? $currentEnvironment->applications()->where('uuid', $applicationUuid)->first() : null; $dashboardContext = match (true) { request()->routeIs('dashboard') => 'Dashboard', request()->routeIs('project.index') => 'Projects', request()->routeIs('terminal') => 'Terminal', request()->routeIs('server.*') => 'Servers', request()->routeIs('source.*') => 'Sources', request()->routeIs('destination.*') => 'Destinations', request()->routeIs('storage.*') => 'S3 Storage', request()->routeIs('shared-variables.*') => 'Shared Variables', request()->routeIs('team.*') => 'Team', request()->routeIs('notifications.*') => 'Notifications', request()->routeIs('security.*') => 'Keys & Tokens', request()->routeIs('tags.*') => 'Tags', request()->routeIs('settings.*') => 'Settings', request()->routeIs('profile*') => 'Profile', request()->routeIs('admin.*') => 'Admin', default => null, }; // Workspace destinations require an active plan on cloud; unsubscribed users // only keep profile/appearance and must not see this switcher. $canUseWorkspaceNav = isSubscribed() || ! isCloud(); $pageDestinations = $canUseWorkspaceNav ? collect([ ['label' => 'Dashboard', 'href' => url('/')], ['label' => 'Projects', 'href' => url('/projects')], auth()->user()?->can('canAccessTerminal') ? ['label' => 'Terminal', 'href' => route('terminal')] : null, ['label' => 'Servers', 'href' => url('/servers')], ['label' => 'Sources', 'href' => route('source.all')], ['label' => 'Destinations', 'href' => route('destination.index')], ['label' => 'S3 Storage', 'href' => route('storage.index')], ['label' => 'Shared Variables', 'href' => route('shared-variables.index')], ['label' => 'Team', 'href' => route('team.index')], ['label' => 'Notifications', 'href' => route('notifications.email')], ['label' => 'Keys & Tokens', 'href' => route('security.private-key.index')], ['label' => 'Tags', 'href' => route('tags.show')], isInstanceAdmin() ? ['label' => 'Settings', 'href' => route('settings.index')] : null, ])->filter() : collect(); @endphp
{{-- Team --}}
@if (!$currentProject && $dashboardContext && $canUseWorkspaceNav) /
@elseif (!$currentProject && $dashboardContext) {{-- Static context label only — no links to paid workspace pages. --}} / {{ $dashboardContext }} @endif @if ($currentProject) / {{-- Project switcher --}}
@endif @if ($currentProject && $currentEnvironment) / {{-- Environment switcher --}}
@endif @if ($currentApplication) @php $applicationStatus = str($currentApplication->status ?? 'exited'); [$statusDotClass, $statusLabel] = match (true) { $applicationStatus->startsWith('running') => ['bg-[#3fb950]', 'Running'], $applicationStatus->startsWith('degraded') => ['bg-orange-400', 'Degraded'], $applicationStatus->startsWith('restarting'), $applicationStatus->startsWith('starting') => ['bg-warning', 'Restarting'], default => ['bg-neutral-400 dark:bg-fg-faint', 'Stopped'], }; @endphp / {{ $currentApplication->name }} {{ $statusLabel }} @endif