mirror of
https://github.com/nihonbuzz/nihonbuzz-academy.git
synced 2026-01-26 13:32:07 +07:00
feat: update seeder with real YouTube video URLs and update technical blueprint
This commit is contained in:
@@ -21,7 +21,7 @@ class CourseForm
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->required(),
|
||||
Textarea::make('description')
|
||||
\Filament\Forms\Components\RichEditor::make('description')
|
||||
->columnSpanFull(),
|
||||
Select::make('level_id')
|
||||
->relationship('level', 'name'),
|
||||
@@ -29,9 +29,13 @@ class CourseForm
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0)
|
||||
->prefix('$'),
|
||||
TextInput::make('thumbnail_url')
|
||||
->url(),
|
||||
->prefix('IDR'),
|
||||
\Filament\Forms\Components\FileUpload::make('thumbnail_url')
|
||||
->disk('r2')
|
||||
->directory('thumbnails')
|
||||
->visibility('public')
|
||||
->image()
|
||||
->imageEditor(),
|
||||
Toggle::make('is_published')
|
||||
->required(),
|
||||
Textarea::make('metadata')
|
||||
|
||||
@@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user