This commit is contained in:
yuriko 🦊 2025-05-24 23:16:40 -04:00
parent 2e75c1c407
commit 67bf5494fd
8 changed files with 18 additions and 23 deletions

View file

@ -7,14 +7,16 @@ use Livewire\Component;
class Pfp extends Component class Pfp extends Component
{ {
public User $user; public string $user = '';
public string $size = '3rem'; public string $size = '3rem';
public string $shape = 'circle'; public string $shape = 'circle';
public function render() public function render()
{ {
$u = User::find($this->user);
return view('livewire.app.pfp', [ return view('livewire.app.pfp', [
'pfp' => $this->user->getAvatarBase64() 'pfp' =>$u->getAvatarBase64(),
'name' => $u->name,
]); ]);
} }
} }

View file

@ -22,14 +22,14 @@ class Profile extends Component
return view('livewire.pages.profile')->title($this->user->name); return view('livewire.pages.profile')->title($this->user->name);
} }
public function updated($name, $value) public function updated()
{ {
if (Auth::id() != $this->user->id) if (Auth::id() != $this->user->id)
{ {
abort(401); abort(401);
} }
$this->validateOnly($name); $this->validate();
$this->user->avatarExt = $this->avatar->getClientOriginalExtension(); $this->user->avatarExt = $this->avatar->getClientOriginalExtension();
$this->user->save(); $this->user->save();

View file

@ -55,7 +55,7 @@ class Upload extends Component
$preview = Image::read($fullImg)->scaleDown(width: 1280, height: 720); $preview = Image::read($fullImg)->scaleDown(width: 1280, height: 720);
Storage::put("posts/$post->id/preview", $preview->encodeByExtension($post->extension, quality: 70)); Storage::put("posts/$post->id/preview", $preview->encodeByExtension($post->extension, quality: 70));
return $this->redirect('/'); return $this->redirect("/posts/$post->id");
} }
} }

View file

@ -16,18 +16,11 @@ return new class extends Migration
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->string('avatarExt')->nullable();
$table->string('password');
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) { Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary(); $table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index(); $table->foreignId('user_id')->nullable()->index();
@ -45,7 +38,6 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::dropIfExists('users'); Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions'); Schema::dropIfExists('sessions');
} }
}; };

View file

@ -35,12 +35,12 @@
@endguest @endguest
@auth @auth
<div class="wa-cluster wa-gap-3xs wa-align-items-center"> <wa-button href="{{ url('/profiles/' . Auth::id()) }}" appearance="plain" wire:navigate.hover>
<livewire:app.pfp :user="Auth::user()" size="2rem" /> <div class="wa-cluster wa-align-items-center">
<wa-button href="{{ url('/profiles/' . Auth::id()) }}" appearance="plain" wire:navigate.hover> <livewire:app.pfp user="{{ Auth::id() }}" size="2rem" shape="rounded" />
{{ Auth::user()->name }} {{ Auth::user()->name }}
</wa-button> </div>
</div> </wa-button>
<wa-icon-button href="{{ route('logout') }}" appearance="plain" name="arrow-left-from-bracket"></wa-icon-button> <wa-icon-button href="{{ route('logout') }}" appearance="plain" name="arrow-left-from-bracket"></wa-icon-button>
@endauth @endauth
</div> </div>

View file

@ -1,2 +1,3 @@
<wa-avatar image="{{ $pfp }}" label="{{ $user->name }}'s Profile Picture" shape="{{ $shape }}" loading="lazy" style="--size: {{ $size }}"> <div>
</wa-avatar> <wa-avatar image="{{ $pfp }}" label="{{ $name }}'s Profile Picture" shape="{{ $shape }}" loading="lazy" style="--size: {{ $size }}"></wa-avatar>
</div>

View file

@ -1,7 +1,7 @@
<div class="wa-stack wa-gap-3xl"> <div class="wa-stack wa-gap-3xl">
<div class="wa-stack"> <div class="wa-stack">
<div class="wa-flank wa-align-items-center"> <div class="wa-flank wa-align-items-center">
<livewire:app.pfp :$user size="5rem" shape="rounded" /> <livewire:app.pfp user="{{ $user->id }}" size="5rem" shape="rounded" />
<h1>{{ $user->name }}</h1> <h1>{{ $user->name }}</h1>
</div> </div>

View file

@ -1,5 +1,5 @@
<div class="wa-flank wa-align-items-center"> <div class="wa-flank wa-align-items-center">
<livewire:app.pfp :user="$comment->user" /> <livewire:app.pfp :user="$comment->user->id" />
<div class="wa-split"> <div class="wa-split">
<div class="wa-stack wa-gap-3xs"> <div class="wa-stack wa-gap-3xs">
<div class="wa-cluster wa-align-items-center"> <div class="wa-cluster wa-align-items-center">