Skip to content

Commit

Permalink
fix: footer (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Nov 26, 2024
1 parent b9218c1 commit 990536c
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 34 deletions.
6 changes: 1 addition & 5 deletions app/Http/Controllers/RedirectToElectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ public function __invoke(?Election $election = null): RedirectResponse
{
$election ??= Election::query()
->where('is_visible', true)
->orderBy('type')
->latest()
->first();

if (blank($election)) {
abort(404);
}
abort_unless($election, 404);

return redirect()->to($election->getDefaultUrl());
}
Expand Down
75 changes: 75 additions & 0 deletions app/View/Components/Site/Footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

declare(strict_types=1);

namespace App\View\Components\Site;

use App\Enums\Time;
use Datlechin\FilamentMenuBuilder\Models\Menu;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\View\Component;

class Footer extends Component
{
public Collection $menuItems;

public Collection $socialItems;

public function __construct()
{
$this->menuItems = $this->getMenuItems();

$this->socialItems = $this->getSocialItems();
}

protected function getMenuItems(): Collection
{
return Cache::remember('footer-menu', Time::DAY_IN_SECONDS, function () {
$menu = Menu::location('footer');

if (blank($menu)) {
return collect();
}

return $menu->menuItems;
});
}

protected function getSocialItems(): Collection
{
return collect([
[
'name' => 'Facebook',
'url' => 'https://www.facebook.com/code4romania/',
'icon' => 'ri-facebook-fill',
],
[
'name' => 'Twitter',
'url' => 'https://x.com/code4romania/',
'icon' => 'ri-twitter-x-fill',
],
[
'name' => 'Instagram',
'url' => 'https://www.instagram.com/code4romania/',
'icon' => 'ri-instagram-line',
],
[
'name' => 'LinkedIn',
'url' => 'https://www.linkedin.com/company/code4romania/',
'icon' => 'ri-linkedin-fill',
],
[
'name' => 'GitHub',
'url' => 'https://github.com/code4romania/rezultatevot',
'icon' => 'ri-github-fill',
],
]);
}

public function render(): View
{
return view('components.site.footer');
}
}
2 changes: 1 addition & 1 deletion lang/ro/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [

'banner' => 'O soluție Commit Global.',
'banner' => 'O soluție Code for Romania.',
'skip' => 'Sari la conținut',
'all' => 'Toate',
'generate' => 'Generează',
Expand Down
1 change: 0 additions & 1 deletion resources/svg/code4commit.svg

This file was deleted.

1 change: 1 addition & 0 deletions resources/svg/code4romania.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 990536c

Please sign in to comment.