feat: update seeder with real YouTube video URLs and update technical blueprint

This commit is contained in:
2026-01-23 18:07:40 +07:00
parent 29ff8992b9
commit 82fe5f8a79
47 changed files with 257 additions and 1811 deletions

View File

@@ -2,8 +2,11 @@
namespace App\Filament\Admin\Resources\Vocabularies\Schemas;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class VocabularyForm
@@ -12,20 +15,63 @@ class VocabularyForm
{
return $schema
->components([
TextInput::make('word')
->required(),
TextInput::make('reading'),
TextInput::make('romaji'),
TextInput::make('meaning_en'),
TextInput::make('meaning_id'),
TextInput::make('level_id'),
TextInput::make('audio_url')
->url(),
TextInput::make('type'),
Textarea::make('stroke_order_svg')
->columnSpanFull(),
Textarea::make('example_sentences')
->columnSpanFull(),
Section::make('Core Info')
->schema([
TextInput::make('word')
->label('Word (Kanji/Kana)')
->required()
->maxLength(255),
TextInput::make('reading')
->label('Reading (Kana)')
->required()
->maxLength(255),
TextInput::make('romaji')
->maxLength(255),
TextInput::make('meaning_id')
->label('Meaning (Bahasa Indonesia)')
->required()
->maxLength(255),
TextInput::make('meaning_en')
->label('Meaning (English)')
->required()
->maxLength(255),
])->columns(2),
Section::make('Metadata & Media')
->schema([
Select::make('level_id')
->label('JLPT Level')
->relationship('level', 'code')
->searchable()
->preload()
->required(),
Select::make('type')
->options([
'noun' => 'Noun',
'verb' => 'Verb',
'adjective' => 'Adjective',
'adverb' => 'Adverb',
'particle' => 'Particle',
'expression' => 'Expression',
])
->required(),
FileUpload::make('audio_url')
->label('Pronunciation Audio')
->disk('r2')
->directory('audio/vocab')
->visibility('public')
->acceptedFileTypes(['audio/mpeg', 'audio/wav', 'audio/ogg']),
])->columns(2),
Section::make('Advanced')
->schema([
Textarea::make('stroke_order_svg')
->label('Stroke Order SVG (JSON)')
->columnSpanFull(),
Textarea::make('example_sentences')
->label('Example Sentences (JSON)')
->columnSpanFull(),
])->collapsed(),
]);
}
}

View File

@@ -5,7 +5,7 @@ namespace App\Filament\Admin\Resources\Vocabularies\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables;
use Filament\Tables\Table;
class VocabulariesTable
@@ -14,30 +14,33 @@ class VocabulariesTable
{
return $table
->columns([
TextColumn::make('id')
->label('ID')
Tables\Columns\TextColumn::make('word')
->label('Word')
->searchable()
->description(fn (\App\Models\Vocabulary $record): string => $record->reading),
Tables\Columns\TextColumn::make('meaning_id')
->label('Meaning')
->searchable(),
TextColumn::make('word')
->searchable(),
TextColumn::make('reading')
->searchable(),
TextColumn::make('romaji')
->searchable(),
TextColumn::make('meaning_en')
->searchable(),
TextColumn::make('meaning_id')
->searchable(),
TextColumn::make('level_id')
->searchable(),
TextColumn::make('audio_url')
->searchable(),
TextColumn::make('type')
->searchable(),
TextColumn::make('created_at')
Tables\Columns\TextColumn::make('level.code')
->label('Level')
->badge()
->color(fn (?string $state): string => match ($state) {
'N1' => 'danger',
'N2' => 'warning',
'N3' => 'info',
default => 'success',
}),
Tables\Columns\TextColumn::make('type')
->badge(),
Tables\Columns\IconColumn::make('audio_url')
->label('Audio')
->icon('heroicon-o-speaker-wave')
->color(fn ($state) => $state ? 'success' : 'gray'),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),