Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource page #610

Merged
merged 11 commits into from
Nov 8, 2024
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ f726790a2e2c09018532c8e7397359d443b63e70
0fae228289851aea2d79b09b546dcf5f7f852446
bf119c7c9689569a03c527696008eadd5ad5a29c
9a00c3e9425e213ceca32b57b14dad1f785f99ae
05a012b4674406492f24984bc3eab34b0371cdef
c5411c4a279d718cc705f4c98f58d3b8b16a922a
22 changes: 22 additions & 0 deletions app/Http/Controllers/ResourceController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Http\Controllers;

use App\Models\Resource;
use Carbon\Carbon;
use Illuminate\View\View;

class ResourceController extends Controller
{
public function index(): View
{
$resources = Resource::where('created_at', '>=', Carbon::now()->subDays(30))
->with('modules')
->get();

return view('new-resources', [
'pageTitle' => __('New Resources'),
'resources' => $resources,
]);
}
}
11 changes: 11 additions & 0 deletions public/images/modules/css-libraries-and-frameworks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions public/images/modules/javascript-libraries-and-frameworks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions resources/views/new-resources.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@extends('layouts.app')

@section('content')

<div class="w-full bg-white">
<x-hero>
<h1 class="mb-2 font-bold tracking-wide h2 md:h1">{{ __('New Resources') }}</h1>
</x-hero>

<x-panel>
@if ($resources->count())
<ul class="grid gap-4">
@foreach ($resources as $resource)
<li class="flex gap-2">
<a href="{{ $resource['url'] }}" class="font-semibold underline">
{{ $resource['name'] }}
</a>
<span>-</span>
<p> Modules:
@forelse ($resource['modules'] as $module)
{{ $module['name'] }}@if (!$loop->last), @endif
@empty
No Modules
@endforelse
</p>
</li>
@endforeach
</ul>
@else
<p class="text-center">There are no new resources.</p>
@endif
</x-panel>
</div>
@endsection
47 changes: 20 additions & 27 deletions resources/views/partials/navigation/header/auth-menu.blade.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
<div x-data="{ open: false }" @click.away="open = false" class="relative ml-8">
<button class="flex items-center justify-center w-12 h-12 hover:no-underline focus:outline-none" x-on:click="open = ! open">
<img class="rounded-full"
src="{{ auth()->user()->profile_picture }}"
alt="{{ auth()->user()->name }}">
</button>
<button class="flex items-center justify-center w-12 h-12 hover:no-underline focus:outline-none" x-on:click="open = ! open">
<img class="rounded-full" src="{{ auth()->user()->profile_picture }}" alt="{{ auth()->user()->name }}">
</button>

<div x-show="open" x-cloak class="absolute right-0 z-50 mt-2 origin-top-right rounded-md shadow-lg w-36"
x-transition:enter="transition-all ease-in duration-200 origin-top"
x-transition:enter-start="opacity-0 transform scale-y-0"
x-transition:enter-end="opacity-100 transform scale-y-100"
x-transition:leave="transition-all ease-out duration-200 origin-top"
x-transition:leave-start="opacity-100 transform scale-y-100"
x-transition:leave-end="opacity-0 transform scale-y-0"
>
<div class="overflow-hidden bg-white rounded-md shadow-xs">
<a href="{{ route_wlocale('user.profile.show') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver">
{{ __('Profile') }}
</a>
<div x-show="open" x-cloak class="absolute right-0 z-50 mt-2 origin-top-right rounded-md shadow-lg w-36" x-transition:enter="transition-all ease-in duration-200 origin-top" x-transition:enter-start="opacity-0 transform scale-y-0" x-transition:enter-end="opacity-100 transform scale-y-100" x-transition:leave="transition-all ease-out duration-200 origin-top" x-transition:leave-start="opacity-100 transform scale-y-100" x-transition:leave-end="opacity-0 transform scale-y-0">
<div class="overflow-hidden bg-white rounded-md shadow-xs">
<a href="{{ route_wlocale('user.profile.show') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver">
{{ __('Profile') }}
</a>

<a href="{{ route_wlocale('user.preferences.index') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver">
{{ __('Preferences') }}
</a>
<a href="{{ route_wlocale('user.preferences.index') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver">
{{ __('Preferences') }}
</a>

<a href="{{ route_wlocale('logout') }}"
class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<span>{{ __('Log out') }}</span>
</a>
</div>
</div>
<a href="{{ route_wlocale('user.new-resources') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver">
{{ __('New Resources') }}
</a>

<a href="{{ route_wlocale('logout') }}" class="block px-4 py-3 text-sm font-medium leading-5 transition-colors duration-75 ease-in-out cursor-pointer hover:no-underline hover:bg-silver focus:outline-none focus:bg-silver" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<span>{{ __('Log out') }}</span>
</a>
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Http\Controllers\ModuleController;
use App\Http\Controllers\PreferenceController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\ResourceController;
use App\Http\Controllers\RootRedirectController;
use App\Http\Controllers\SubscriptionController;
use App\Http\Controllers\TrackController;
Expand Down Expand Up @@ -38,6 +39,7 @@
Route::post('completions', [CompletionsController::class, 'store'])->name('user.completions.store');
Route::delete('completions', [CompletionsController::class, 'destroy'])->name('user.completions.destroy');
Route::patch('preferences', [PreferenceController::class, 'update'])->name('user.preferences.update');
Route::get('new-resources', [ResourceController::class, 'index'])->name('user.new-resources');
});

Route::get('unsubscribe/{token}', [SubscriptionController::class, 'destroy'])->name('unsubscribe');
Expand Down