@php
$_currentThemeMode = config('app.change_theme', true)
? cookie()->get('theme', config('app.default_theme', 'dark'))
: config('app.default_theme', 'dark');
$_themeColors = app('flute.view.manager')->getColors($_currentThemeMode);
$_navStyle = $_themeColors['--nav-style'] ?? 'default';
$_sidebarStyle = $_themeColors['--sidebar-style'] ?? 'default';
$_sidebarMode = $_themeColors['--sidebar-mode'] ?? 'full';
$_sidebarPosition = $_themeColors['--sidebar-position'] ?? 'top';
$_sidebarCollapsed = cookie()->get('sidebar_collapsed', 'false');
$_sidebarContained = $_themeColors['--sidebar-contained'] ?? 'false';
$_designPreset = $_themeColors['--design-preset'] ?? 'default';
@endphp
@php
// --- Title ---
$_final_title = '';
if (\Illuminate\Support\Facades\View::hasSection('title')) {
$_final_title = trim(\Illuminate\Support\Facades\View::yieldContent('title'));
}
if (empty($_final_title)) {
$_final_title = config('app.name');
}
$_final_title = __($_final_title);
// --- Description ---
$_final_description = config('app.description');
$_final_description = __($_final_description);
// HTMX: без навбара и футера — только контент для подмены #main
$isPartialRequest = request()->htmx()->omitsLayoutShell();
// --- Theme colors ---
$__colors = app('flute.view.manager')->getColors();
$lightThemeBg = $__colors['light']['--background'] ?? '#ffffff';
$darkThemeBg = $__colors['dark']['--background'] ?? '#1c1c1e';
$currentTheme = config('app.change_theme', true)
? cookie()->get('theme', config('app.default_theme', 'dark'))
: config('app.default_theme', 'dark');
$currentThemeBg = $currentTheme === 'light' ? $lightThemeBg : $darkThemeBg;
@endphp
{{ $_final_title }}
@yield('meta')
@stack('head')
@if (isset($sections['head']))
{!! $sections['head'] !!}
@endif
@include('flute::partials.background')
@stack('styles')
@if (isset($sections['styles']))
{!! $sections['styles'] !!}
@endif
{{-- For support head merge (hx-only & hx-boost) --}}
@if ($isPartialRequest)
@stack('scripts')
@if (isset($sections['scripts']))
{!! $sections['scripts'] !!}
@endif
@endif
@if (!$isPartialRequest)
@at(tt('assets/sass/app.scss'))
@php echo Clickfwd\Yoyo\Services\Configuration::javascriptInitCode() @endphp
@endif
@include('flute::partials.colors')
@if (!$isPartialRequest)
{{-- Always render sidebar-nav, visibility controlled by CSS based on data-nav-style --}}
@endif
@includeWhen(!$isPartialRequest, 'flute::layouts.header')
@includeWhen(!$isPartialRequest, 'flute::partials.loader')
@include('flute::partials.flash')
@stack('content')
@if (isset($sections['content']))
{!! $sections['content'] !!}
@endif
@stack('content-after')
@if (isset($sections['content-after']))
{!! $sections['content-after'] !!}
@endif
@includeIf('flute::partials.confirmation')
@if (!$isPartialRequest)
@stack('toast-container')
@if (isset($sections['toast-container']))
{!! $sections['toast-container'] !!}
@endif
@includeIf('flute::components.right-sidebar')
@includeIf('flute::components.tab-bar')
@include('flute::partials.default-modals')
@stack('modals')
@if (isset($sections['modals']))
{!! $sections['modals'] !!}
@endif
@includeIf('flute::components.user-card')
@endif
@includeWhen(!$isPartialRequest, 'flute::layouts.footer')
@if (!$isPartialRequest)
@at(tt('assets/scripts/libs/simplebar.js'))
@at(tt('assets/scripts/libs/tinycolor.js'))
@at(tt('assets/scripts/helpers.js'))
@at(tt('assets/scripts/bottom-sheet.js'))
@at(tt('assets/scripts/user-card.js'))
@at(tt('assets/scripts/tabs.js'))
@at(tt('assets/scripts/tom-select.js'))
{{-- Always load sidebar-nav script, it handles visibility check internally --}}
@at(tt(path: 'assets/scripts/sidebar-nav.js'))
@at(tt('assets/scripts/app.js'))
@include('flute::partials.toasts')
@stack('scripts')
@if (isset($sections['scripts']))
{!! $sections['scripts'] !!}
@endif
@endif