File size: 8,129 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@php
    $current_url = url()->current();

    $base_class = 'lqd-titlebar pt-6 pb-7 border-b transition-colors';
    $container_base_class = 'lqd-titlebar-container flex flex-wrap items-center justify-between gap-y-4';
    $before_base_class = 'lqd-titlebar-before w-full';
    $after_base_class = 'lqd-titlebar-after w-full';
    $pretitle_base_class = 'lqd-titlebar-pretitle text-xs text-foreground/70 m-0';
    $title_base_class = 'lqd-titlebar-title m-0';
    $subtitle_base_class = 'lqd-titlebar-subtitle mt-1 text-2xs opacity-80 only:my-0 last:mb-0';
    $actions_base_class = 'lqd-titlebar-actions flex flex-wrap items-center gap-2';

    $generator_link = route('dashboard.user.openai.list') === $current_url ? '#lqd-generators-filter-list' : LaravelLocalization::localizeUrl(route('dashboard.user.openai.list'));
    $wide_container_px = Theme::getSetting('wideLayoutPaddingX', '');
    $has_title = true;
    $has_pretitle = true;
    $has_subtitle = view()->hasSection('titlebar_subtitle');
    $titlebar_after_in_nav_col = $attributes->has('titlbar-after-place') && $attributes->get('titlbar-after-place') === 'col-nav';
    $title_section_name = '';

    if (view()->hasSection('titlebar_title')) {
        $title_section_name = 'titlebar_title';
    } elseif (view()->hasSection('title')) {
        $title_section_name = 'title';
    }

    if ($attributes->has('title') && blank($attributes->get('title'))) {
        $has_title = false;
    }
    if ($attributes->has('pretitle') && blank($attributes->get('pretitle'))) {
        $has_pretitle = false;
    }

    if (!$attributes->get('layout-wide')) {
        $container_base_class .= ' container';
    } else {
        $container_base_class .= ' container-fluid';

        if (!empty($wide_container_px)) {
            $container_base_class .= ' ' . $wide_container_px;
        }
    }
@endphp
<div
    id="lqd-titlebar"
    {{ $attributes->withoutTwMergeClasses()->twMerge($base_class, $attributes->get('class')) }}
>
    <div {{ $attributes->twMergeFor('container', $container_base_class) }}>
        @if (view()->hasSection('titlebar_before') || !empty($before))
            <div {{ $attributes->twMergeFor('before', $before_base_class) }}>
                @if (view()->hasSection('titlebar_before'))
                    @yield('titlebar_before')
                @elseif (!empty($before))
                    {{ $before }}
                @endif
            </div>
        @endif

        <div class="lqd-titlebar-col lqd-titlebar-col-nav group/titlebar-nav flex w-full flex-col gap-2 lg:w-7/12">
            @if ($has_pretitle)
                <p {{ $attributes->twMergeFor('pretitle', $pretitle_base_class) }}>
                    @if (view()->hasSection('titlebar_pretitle'))
                        @yield('titlebar_pretitle')
                    @elseif (view()->hasSection('pretitle'))
                        @yield('pretitle')
                    @else
                        @if (route('dashboard.user.index') === $current_url || route('dashboard.admin.index') === $current_url)
                            {{ __('Dashboard') }}
                        @else
                            <x-button
                                class="text-inherit hover:text-foreground"
                                variant="link"
                                href="{{ LaravelLocalization::localizeUrl(route('dashboard.index')) }}"
                            >
                                <x-tabler-chevron-left
                                    class="size-4"
                                    stroke-width="1.5"
                                />
                                {{ __('Back to dashboard') }}
                            </x-button>
                        @endif
                    @endif
                </p>
            @endif
            @if ($has_title)
                <h1 {{ $attributes->twMergeFor('title', $title_base_class) }}>
                    @yield($title_section_name)
                </h1>
            @endif
            @if ($has_subtitle)
                <p {{ $attributes->twMergeFor('subtitle', $subtitle_base_class) }}>
                    @yield('titlebar_subtitle')
                </p>
            @endif
            @php
                $status_titlebar_after = $titlebar_after_in_nav_col && (!$has_pretitle && !$has_subtitle) && (view()->hasSection('titlebar_after') || !empty($after));

                $theme = \Theme::get();

                if ($theme == 'sleek' && request()->routeIs('dashboard.user.openai.list')) {
                    $status_titlebar_after = $titlebar_after_in_nav_col && !$has_pretitle && (view()->hasSection('titlebar_after') || !empty($after));
                }
            @endphp

            @if ($status_titlebar_after)
                <div {{ $attributes->twMergeFor('after', $after_base_class) }}>
                    @if (view()->hasSection('titlebar_after'))
                        @yield('titlebar_after')
                    @elseif (!empty($after))
                        {{ $after }}
                    @endif
                </div>
            @endif
        </div>

        <div
            class="lqd-titlebar-col lqd-titlebar-col-actions group/titlebar-actions max-lg:has-[.max-lg\:hidden:only-child]:hidden flex w-full flex-wrap gap-y-3 lg:w-5/12 lg:justify-end">
            @hasSection('titlebar_actions_before')
                @yield('titlebar_actions_before')
            @endif

            @if (view()->hasSection('titlebar_actions'))
                <div {{ $attributes->twMergeFor('actions', $actions_base_class) }}>
                    @yield('titlebar_actions')
                </div>
            @elseif (!empty($actions))
                <div {{ $attributes->twMergeFor('actions', $actions_base_class, $actions->attributes->get('class')) }}>
                    {{ $actions }}
                </div>
            @else
                <div {{ $attributes->twMergeFor('actions', $actions_base_class, 'max-lg:hidden') }}>
                    @if (request()->routeIs('dashboard.user.openai.documents.all') && !isset($currfolder))
                        <x-modal
                            title="{{ __('New Folder') }}"
                            disable-modal="{{ $app_is_demo }}"
                            disable-modal-message="{{ __('This feature is disabled in Demo version.') }}"
                        >
                            <x-slot:trigger
                                variant="ghost-shadow"
                            >
                                <x-tabler-plus class="size-4" />
                                {{ __('New Folder') }}
                            </x-slot:trigger>
                            <x-slot:modal>
                                @includeIf('panel.user.openai.components.modals.create-new-folder')
                            </x-slot:modal>
                        </x-modal>
                    @else
                        <x-button
                            variant="ghost-shadow"
                            href="{{ LaravelLocalization::localizeUrl(route('dashboard.user.openai.documents.all')) }}"
                        >
                            {{ __('My Documents') }}
                        </x-button>
                    @endif
                    <x-button href="{{ $generator_link }}">
                        <x-tabler-plus class="size-4" />
                        {{ __('New') }}
                    </x-button>
                </div>
            @endif

            @hasSection('titlebar_actions_after')
                @yield('titlebar_actions_after')
            @endif
        </div>

        @if (!$titlebar_after_in_nav_col && (($has_pretitle || $has_subtitle) && (view()->hasSection('titlebar_after') || !empty($after))))
            <div {{ $attributes->twMergeFor('after', $after_base_class) }}>
                @if (view()->hasSection('titlebar_after'))
                    @yield('titlebar_after')
                @elseif (!empty($after))
                    {{ $after }}
                @endif
            </div>
        @endif
    </div>
</div>