add models, setup livewire, setup mongodb

This commit is contained in:
yuriko 🦊 2025-05-21 15:14:50 -04:00
parent c0590a3412
commit be4c848eee
Signed by: jaiden
SSH key fingerprint: SHA256:f8tvveBoXBrKZIQDWLLcpQrKbATUCGg98x2N4YzkDM8
27 changed files with 2508 additions and 0 deletions

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="wa-dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<script type="module" src="https://early.webawesome.com/webawesome@3.0.0-alpha.13/dist/webawesome.loader.js" data-fa-kit-code="ba9cf75857"></script>
@vite(['resources/css/app.css', 'resources/js/app.js'])
@livewireStyles
<title>{{ $title ?? 'Untitled' }} ~ {{ config('app.name') }}</title>
</head>
<body>
<wa-page mobile-breakpoint="920">
<header slot="header">
@livewire('app.navbar')
</header>
<main>
{{ $slot }}
</main>
</wa-page>
@stack('modals')
@livewireScripts
</body>
</html>

View file

@ -0,0 +1,17 @@
<div class="wa-stack wa-gap-3xl">
<div class="wa-grid">
{{-- <h1 class="wa-cluster">--}}
{{-- <wa-icon name="paw-simple"></wa-icon>--}}
{{-- {{ config('app.name') }}--}}
{{-- </h1>--}}
<h1>{{ config('app.name') }}</h1>
@auth
<wa-input placeholder="Search for posts, tags, users, etc.">
<wa-icon slot="prefix" name="magnifying-glass"></wa-icon>
</wa-input>
@endauth
</div>
<livewire:post-feature />
</div>

View file

@ -0,0 +1,42 @@
<div class="wa-split">
<div class="wa-cluster wa-align-items-center">
<wa-icon-button
href="{{ route('home') }}"
name="paw-simple"
appearance="plain"
style="font-size: 1.5rem;"
wire:navigate.hover>
</wa-icon-button>
@auth
<wa-button appearance="plain" href="{{ route('posts.home') }}" wire:navigate.hover>
<wa-icon slot="prefix" name="images"></wa-icon>
Posts
</wa-button>
<wa-button appearance="plain" href="{{ route('upload') }}" wire:navigate.hover>
<wa-icon slot="prefix" name="arrow-up-from-bracket"></wa-icon>
Upload
</wa-button>
<wa-button appearance="plain">
<wa-icon slot="prefix" name="tags"></wa-icon>
Tags
</wa-button>
@endauth
</div>
<div class="wa-cluster">
@guest
<wa-button href="{{ route('login') }}" appearance="plain">
<wa-icon slot="prefix" name="arrow-right-to-bracket"></wa-icon>
Sign in
</wa-button>
@endguest
@auth
<wa-button appearance="plain">{{ Auth::user()->name }}</wa-button>
<wa-icon-button href="{{ route('logout') }}" appearance="plain" name="arrow-left-from-bracket"></wa-icon-button>
@endauth
</div>
</div>

View file

@ -0,0 +1,23 @@
<div class="wa-stack wa-gap-3xl">
<h1>Upload</h1>
<form wire:submit="createPost" class="wa-stack wa-gap-xl">
<wa-card>
<input wire:model="file" type="file" label="file" placeholder="Select a file to upload." />
@error('file')
<span class="wa-caption-m">{{ $message }}</span>
@enderror
</wa-card>
<wa-select wire:model="rating" label="Rating" value="safe" hint="Select a content rating that matches the file.">
<wa-option value="safe">Safe</wa-option>
<wa-option value="suggestive">Suggestive</wa-option>
<wa-option value="explicit">Explicit</wa-option>
</wa-select>
<wa-button type="submit" variant="brand" wire:loading.attr="disabled">
<wa-icon slot="prefix" name="arrow-up-from-bracket"></wa-icon>
Upload
</wa-button>
</form>
</div>

View file

@ -0,0 +1,6 @@
<div class="wa-stack" style="max-height: 80vh;">
<a href="{{ url("posts/$post->id") }}" class="wa-frame wa-border-radius-l" style="max-inline-size: 100%; {{ $post->getAspectRatio() }}" wire:navigate.hover>
<img src="{{ $post->getPreviewUrl() }}" />
</a>
<span class="wa-caption-m">-{{ $post->user->name }}, <wa-format-date></wa-format-date></span>
</div>

View file

@ -0,0 +1,49 @@
<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
{{-- Sidebar --}}
<div class="wa-stack" wire:poll>
<div class="wa-cluster">
<span class="wa-caption-m">Changes are automatically saved.</span>
<wa-button href="{{ url("posts/$post->id") }}" appearance="outlined" variant="neutral" size="small" wire:navigate.hover>
<wa-icon slot="prefix" name="check"></wa-icon>
<span>Finish</span>
</wa-button>
</div>
<wa-divider></wa-divider>
<form wire:submit class="wa-stack">
<wa-select wire:model.live="rating" label="Rating" value="{{ $post->rating }}" wire:loading.attr="disabled" @error('rating') hint="{{ $message }}" @enderror>
<wa-option value="safe">Safe</wa-option>
<wa-option value="suggestive">Suggestive</wa-option>
<wa-option value="explicit">Explicit</wa-option>
</wa-select>
@if ($post->rating == 'safe')
<wa-switch
wire:model.live="featured"
{{ $post->featured ? 'checked' : '' }}
wire:loading.attr="disabled"
hint="Featured posts will be randomly selected to show on the front page.">
Feature post
</wa-switch>
@endif
</form>
<wa-divider></wa-divider>
{{-- Tags --}}
<div class="wa-cluster wa-heading-m">
<wa-icon fixed-width name="tags"></wa-icon>
<span>Tags</span>
</div>
</div>
{{-- Main content --}}
<div class="wa-stack wa-gap-2xl" wire:poll>
<livewire:posts.image :$post lazy />
</div>
</div>

View file

@ -0,0 +1,5 @@
<div class="wa-stack" style="display: flex; align-items: center; justify-content: center; max-height: 80vh;">
<div class="wa-frame wa-border-radius-l" style="max-inline-size: 100%; {{ $post->getAspectRatio() }}">
<img src="{{ $post->getPreviewUrl() }}" />
</div>
</div>

View file

@ -0,0 +1,8 @@
<div class="wa-stack wa-gap-3xl">
<h1>Posts</h1>
<div class="wa-cluster wa-gap-s">
@foreach ($posts as $post)
<livewire:posts.thumbnail :$post lazy />
@endforeach
</div>
</div>

View file

@ -0,0 +1,10 @@
<div style="max-inline-size: 256px;">
<a
id="post_{{ $post->id }}"
href="{{ url("posts/$post->id") }}"
class="wa-frame wa-border-radius-l"
style="border: 2px solid var(--wa-color-{{ $post->getRatingColor() }}-border-loud);"
wire:navigate.hover>
<img src="{{ $post->getThumbUrl() }}" />
</a>
</div>

View file

@ -0,0 +1,72 @@
<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
{{-- Sidebar --}}
<div class="wa-stack" wire:poll>
{{-- Post navigation --}}
<div class="wa-cluster">
@if ($prev = $post->getPreviousPost())
<wa-icon-button href="{{ url("posts/$prev->id") }}" name="arrow-left" style="color: var(--wa-color-text-link);" wire:navigate.hover></wa-icon-button>
@else
<wa-icon-button name="arrow-left" disabled></wa-icon-button>
@endif
@if ($next = $post->getNextPost())
<wa-icon-button href="{{ url("posts/$next->id") }}" name="arrow-right" style="color: var(--wa-color-text-link);" wire:navigate.hover></wa-icon-button>
@else
<wa-icon-button name="arrow-right" disabled></wa-icon-button>
@endif
<wa-icon-button href="{{ url("posts/$post->id/edit") }}" name="file-pen" style="color: var(--wa-color-text-link);" wire:navigate.hover></wa-icon-button>
<wa-icon-button href="{{ url("posts/$post->id/download") }}" name="download" style="color: var(--wa-color-text-link);"></wa-icon-button>
</div>
<wa-divider></wa-divider>
{{-- Post ID --}}
<div class="wa-cluster">
<wa-icon fixed-width name="hashtag"></wa-icon>
<span>{{ $post->id }}</span>
</div>
{{-- Post author --}}
<div class="wa-cluster">
<wa-icon fixed-width name="user"></wa-icon>
<span>{{ $post->user->name }}</span>
</div>
{{-- Post upload date --}}
<div class="wa-cluster">
<wa-icon fixed-width name="calendar"></wa-icon>
<wa-format-date
month="numeric"
day="numeric"
year="numeric"
hour="numeric"
minute="numeric"
date="{{ $post->created_at }}">
</wa-format-date>
</div>
{{-- Post rating --}}
<div class="wa-cluster">
<wa-icon fixed-width name="face-hand-peeking"></wa-icon>
<span style="color: var(--wa-color-{{ $post->getRatingColor() }}-on-normal);">{{ $post->rating }}</span>
</div>
<wa-divider></wa-divider>
{{-- Tags --}}
<div class="wa-cluster wa-heading-m">
<wa-icon fixed-width name="tags"></wa-icon>
<span>Tags</span>
</div>
</div>
{{-- Main content --}}
<div class="wa-stack wa-gap-2xl" wire:poll>
<livewire:posts.image :$post lazy />
</div>
</div>