{{-- resources/views/library/tipitaka/download.blade.php 下载页(TipitakaDownloadController):一部作品($mode = work),或整个 channel 打包($mode = channel,只有「全部」一种范围)。 四种格式各一张卡片。已就绪的直接下载;其余点击后调 POST /api/v3/tipitaka-exports 发起,轮询状态, 就绪后自动下载(同时给一个手动下载的链接兜底)。 变量:$mode、$channelInfo、$request(POST 的 channel / work)、$formats[{key,name,description,state}]、$backUrl; work:$book(bookCard() + pali_title / updated_at); channel:$groups[分类路径 => [{title,progress,url}]] --}} @extends('layouts.library') @section('title', ($mode === 'work' ? $book['title'] : $channelInfo['name']) . ' · ' . __('library.download_title') . ' · ' . __('library.site_name')) @push('styles') @vite('resources/css/modules/tipitaka.css') @endpush @section('breadcrumb') @if($mode === 'work') @endif @endsection @section('content')
@if($mode === 'work')

{{ $book['title'] }}

@if($book['pali_title'] !== $book['title'])
{{ $book['pali_title'] }}
@endif
{{ __('library.channel') }} {{ $channelInfo['name'] }} {{ $book['language'] }} @if($book['progress'] !== null) {{ __('library.progress') }} {{ $book['progress'] }}% @endif @if(!empty($book['updated_at'])) {{ __('library.updated') }} {{ $book['updated_at'] }} @endif
@else

{{ __('library.download_all_title', ['name' => $channelInfo['name']]) }}

{{ __('library.download_all_hint') }}
@endif ‹ {{ __('library.download_back') }}

{{ __('library.download_choose_format') }} {{ __('library.download_format_note') }}

@php $i18n = [ 'ready' => __('library.download_state_ready'), 'queued' => __('library.download_state_queued'), 'running' => __('library.download_state_running'), 'failed' => __('library.download_state_failed'), 'download' => __('library.download_button'), 'retry' => __('library.download_retry'), ]; @endphp
@foreach($formats as $format) @php $state = $format['state']; $ready = $state['status'] === 'ready'; @endphp
{{ $format['key'] === 'markdown' ? 'MD' : strtoupper($format['key']) }}

{{ $format['name'] }}

{{ $format['description'] }}

{{ $state['filename'] }}
@if($ready) {{ __('library.download_state_ready', ['size' => \Illuminate\Support\Number::fileSize($state['size'], 1), 'date' => substr((string) $state['expires_at'], 0, 10)]) }} @elseif($state['too_large'] ?? false) {{ __('library.download_state_too_large') }} @else {{ __('library.download_state_absent') }} @endif
@endforeach
{{ __('library.download_hint') }}
@if($mode === 'channel')

{{ __('library.download_included_works') }} {{ __('library.download_works_count', ['count' => array_sum(array_map('count', $groups))]) }}

@foreach($groups as $label => $works)
first) open @endif> {{ $label }}{{ __('library.download_works_count', ['count' => count($works)]) }}
@endforeach
@endif
@endsection @push('scripts') @endpush