A documentation section has been added to the site.

This commit is contained in:
2024-05-19 19:47:02 +05:00
parent 42701a24db
commit e74456ee2f
35 changed files with 766 additions and 34 deletions

View File

@@ -0,0 +1,18 @@
<div id="documentation-version">
<div class="documentation-version__block">
<button class="documentation-version__button" type="button" aria-label="{{ $websiteTranslations->translate('site.Choose version') }}">
<svg width="16" height="16" data-slot="icon" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path clip-rule="evenodd" fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm1 5.75A.75.75 0 0 1 5.75 7h4.5a.75.75 0 0 1 0 1.5h-4.5A.75.75 0 0 1 5 7.75Zm0 3a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z"></path>
</svg>
{{ $version->title }} <span class="status status__{{ $version->status->value }}">({{ $version->status->getTitle($websiteTranslations) }})</span>
<svg width="16" height="16" class="documentation-version__button__str" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"></path>
</svg>
</button>
<ul class="documentation-version__list">
@foreach($versions as $v)
<li><a href="{{ \App\Enums\Site\ProjectSection::DocumentationVersion->url($project, $websiteTranslations->getLanguage(), ['version' => $v->slug]) }}">{{ $v->title }} <span class="status status__{{ $v->status->value }}">({{ $v->status->getTitle($websiteTranslations) }})</span></a></li>
@endforeach
</ul>
</div>
</div>

View File

@@ -0,0 +1,10 @@
@if($version->status === \App\Enums\DocumentationVersionStatus::NotSupported)
<div class="alert-version version-status-not-supported">
{{ $websiteTranslations->translate('site.alert-status-not-supported') }}
</div>
@endif
@if($version->status === \App\Enums\DocumentationVersionStatus::FutureVersion)
<div class="alert-version version-status-future">
{{ $websiteTranslations->translate('site.alert-status-future') }}
</div>
@endif

View File

@@ -30,6 +30,9 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path>
</svg>
</button>
@if($attributes->has('documentationVersion'))
<x-site.choose-version :version="$attributes->get('documentationVersion')" :websiteTranslations="$websiteTranslations" :project="$project" :user="auth()->user()" />
@endif
<x-site.choose-language :websiteTranslations="$websiteTranslations" :project="$project" />
</header>
<div class="main-container">
@@ -37,11 +40,15 @@
<div class="menu__title">{{ __('site.Menu') }}</div>
<ul>
<li><a href="{{ \App\Enums\Site\ProjectSection::Home->url($project, $websiteTranslations->getLanguage()) }}" @class(['active' => request()->route()->named(['home', 'language.home', 'project.home', 'project.language.home'])])>{{ $websiteTranslations->translate('site.About project') }}</a></li>
<li><a href="{{ \App\Enums\Site\ProjectSection::Documentation->url($project, $websiteTranslations->getLanguage()) }}" @class(['active' => request()->route()->named(['documentation', 'documentation.home'])])>{{ $websiteTranslations->translate('site.Documentation') }}</a></li>
<li><a href="{{ \App\Enums\Site\ProjectSection::Feedback->url($project, $websiteTranslations->getLanguage()) }}" @class(['active' => request()->route()->named(['feedback', 'language.feedback', 'project.feedback', 'project.language.feedback'])])>{{ $websiteTranslations->translate('site.Feedback') }}</a></li>
</ul>
</nav>
<div class="section-container">
<div class="content">
@if($attributes->has('documentationVersion'))
<x-site.documentation-version :websiteTranslations="$websiteTranslations" :version="$attributes->get('documentationVersion')" />
@endif
<h1>@yield('h1', '')</h1>
@includeWhen($errors->any(), 'layout.site._errors', ['errors' => $errors->all()])

View File

@@ -0,0 +1,13 @@
@section('meta_title', $category->content?->title . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $category->content?->title)
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
@foreach($categories as $category)
@continue(! $category->content?->title)
<p><a href="{{ \App\Enums\Site\ProjectSection::DocumentationCategory->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $category->slug]) }}">{{ $category->content->title }}</a></p>
@endforeach
@foreach($documentations as $documentation)
@continue(! $documentation->content?->title)
<p><a href="{{ \App\Enums\Site\ProjectSection::DocumentationView->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $documentation->slug]) }}">{{ $documentation->content->title }}</a></p>
@endforeach
</x-site.layout>

View File

@@ -0,0 +1,13 @@
@section('meta_title', $websiteTranslations->translate('site.Documentation') . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $websiteTranslations->translate('site.Documentation'))
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
@foreach($categories as $category)
@continue(! $category->content?->title)
<p><a href="{{ \App\Enums\Site\ProjectSection::DocumentationCategory->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $category->slug]) }}">{{ $category->content->title }}</a></p>
@endforeach
@foreach($documentations as $documentation)
@continue(! $documentation->content?->title)
<p><a href="{{ \App\Enums\Site\ProjectSection::DocumentationView->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $documentation->slug]) }}">{{ $documentation->content->title }}</a></p>
@endforeach
</x-site.layout>

View File

@@ -0,0 +1,6 @@
@section('meta_title', $websiteTranslations->translate('site.Documentation not created'))
@section('h1', $websiteTranslations->translate('site.Documentation not created'))
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations">
</x-site.layout>

View File

@@ -0,0 +1,9 @@
@section('meta_title', $documentation->content?->title . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $documentation->content?->title)
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
<div class="line-numbers">{!! $documentation->content->content !!}</div>
@push('scripts')
@include('_prism')
@endpush
</x-site.layout>