Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Enums/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum ResourceType: string
case Video = 'video';
case Printable = 'printable';
case Online = 'online';
case Curriculum = 'curriculum';

public function label(): string
{
Expand Down
1 change: 1 addition & 0 deletions lang/en/enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'video' => 'Videos',
'printable' => 'Printables',
'online' => 'Online / social media',
'curriculum' => 'Curricula and training materials',
],
'resource_status' => ['draft' => 'Draft', 'published' => 'Published'],
'organization_type' => [
Expand Down
1 change: 1 addition & 0 deletions lang/ro/enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'video' => 'Materiale video',
'printable' => 'Printabile',
'online' => 'Materiale Online/Social-media',
'curriculum' => 'Curricule și materiale formări',
],
'resource_status' => ['draft' => 'Schiță', 'published' => 'Publicat'],
'organization_type' => [
Expand Down
1 change: 1 addition & 0 deletions resources/views/components/resource-card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'video' => ['class' => 'bg-tint-purple text-accent', 'icon' => 'M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z'],
'printable' => ['class' => 'bg-tint-blue/70 text-primary', 'icon' => 'M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z'],
'online' => ['class' => 'bg-tint-purple/60 text-navy', 'icon' => 'M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9'],
'curriculum' => ['class' => 'bg-tint-directory text-navy', 'icon' => 'M12 14l9-5-9-5-9 5 9 5z M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z'],
];
$style = $typeStyles[$type] ?? $typeStyles['document'];
@endphp
Expand Down
15 changes: 14 additions & 1 deletion tests/Feature/ResourceTypeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
->assertSee('Documente', false)
->assertSee('Materiale video', false)
->assertSee('Printabile', false)
->assertSee('Materiale Online/Social-media', false);
->assertSee('Materiale Online/Social-media', false)
->assertSee('Curricule și materiale formări', false);
});

test('resource cards use a different icon for each type', function () {
Expand All @@ -39,6 +40,18 @@
->set('search', 'Icon online resource')
->assertSee('data-resource-icon="online"', false)
->assertSee('M21 12a9 9 0 01-9 9', false);

Resource::factory()->create([
'title_en' => 'Icon curriculum resource',
'type' => ResourceType::Curriculum,
'status' => ResourceStatus::Published,
'published_at' => now(),
]);

Livewire::test('pages::resources-index')
->set('search', 'Icon curriculum resource')
->assertSee('data-resource-icon="curriculum"', false)
->assertSee('M12 14l9-5-9-5-9 5 9 5z', false);
});

test('resource type filter matches the selected label', function () {
Expand Down
Loading