work dump WIP

This commit is contained in:
IsWaffle 2024-08-29 16:25:55 -04:00
parent f4ae428bdc
commit 05f2dfc258
3 changed files with 102 additions and 26 deletions

View File

@ -0,0 +1,19 @@
<?php
namespace App\Livewire;
use Livewire\Component;
class UserStack extends Component
{
public $users;
public string $label = 'Users';
public int $limit = 5;
public function render()
{
return view('livewire.user-stack');
}
}

View File

@ -0,0 +1,47 @@
<div class="w-full text-gray-600 bg-white shadow-md dark:text-gray-200 dark:bg-gray-900 rounded-xl p-4 m-4">
<div class="flex justify-center items-center">
<h2 class="text-2xl">{{$label}}</h2>
</div>
<div class="flex ml-6 py-2">
@foreach($users->slice(0, $limit) as $user)
<div class="relative group">
<a href="{{$user->profileUrl()}}" class="rounded-full -ml-6 z-20 bg-[#ebf4ff] h-16 w-16 flex justify-center items-center border">
<img class="h-full w-full rounded-full" src="{{$user->profile_photo_url}}"
alt="{{$user->name[0]}}" />
</a>
<div class="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 w-max px-2 py-1 text-sm text-white bg-gray-700 rounded shadow-lg opacity-0 group-hover:opacity-100">
{{$user->name}}
</div>
</div>
@endforeach
@if($users->count() > $limit)
<div class="relative group">
<span class="rounded-full -ml-6 z-20 bg-cyan-500 dark:bg-cyan-700 h-16 w-16 flex justify-center items-center border text-white">+{{$users->count()-$limit}}</span>
<div class="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 w-max px-2 py-1 text-sm text-white bg-gray-700 rounded shadow-lg opacity-0 group-hover:opacity-100">
{{$users->count()}} total
</div>
</div>
@endif
</div>
@if($users->count() > $limit)
<div class="flex justify-center items-center">
<button wire:click="$set('viewAll', false)">view all</button>
</div>
@endif
<x-dialog-modal wire:model.live="viewAll">
<x-slot name="title">
<h2 class="text-2xl">testing</h2>
</x-slot>
<x-slot name="content">
<p>no u</p>
</x-slot>
<x-slot name="footer">
<x-button wire:click="$set('viewAll', false)">
{{__('Close')}}
</x-button>
</x-slot>
</x-dialog-modal>
</div>

View File

@ -2,12 +2,14 @@
<div class="sm:-mt-12 dark:bg-gray-800 dark:text-gray-100"> <div class="sm:-mt-12 dark:bg-gray-800 dark:text-gray-100">
<div> <div>
<img class="h-32 w-full object-cover lg:h-48" src="{{ $user->cover_photo_url }}" alt="profile cover photo of {{ $user->name }}"> <img class="h-32 w-full object-cover lg:h-48" src="{{ $user->cover_photo_url }}"
alt="profile cover photo of {{ $user->name }}">
</div> </div>
<div class="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8"> <div class="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
<div class="-mt-12 sm:-mt-16 sm:flex sm:items-end sm:space-x-5"> <div class="-mt-12 sm:-mt-16 sm:flex sm:items-end sm:space-x-5">
<div class="flex"> <div class="flex">
<img class="h-24 w-24 rounded-full ring-4 ring-white dark:ring-gray-800 sm:h-32 sm:w-32" src="{{ $user->profile_photo_url }}" alt="profile photo of {{ $user->name }}" /> <img class="h-24 w-24 rounded-full ring-4 ring-white dark:ring-gray-800 sm:h-32 sm:w-32"
src="{{ $user->profile_photo_url }}" alt="profile photo of {{ $user->name }}" />
</div> </div>
<div class="mt-6 sm:flex sm:min-w-0 sm:flex-1 sm:items-center sm:justify-end sm:space-x-6 sm:pb-1"> <div class="mt-6 sm:flex sm:min-w-0 sm:flex-1 sm:items-center sm:justify-end sm:space-x-6 sm:pb-1">
<div class="mt-6 min-w-0 flex-1 sm:hidden md:block"> <div class="mt-6 min-w-0 flex-1 sm:hidden md:block">
@ -17,20 +19,28 @@
@if(\Illuminate\Support\Facades\Auth::check()) @if(\Illuminate\Support\Facades\Auth::check())
@if(\Illuminate\Support\Facades\Auth::id() != $user->id) @if(\Illuminate\Support\Facades\Auth::id() != $user->id)
<div class="mt-6 flex flex-col justify-stretch space-y-3 sm:flex-row sm:space-x-4 sm:space-y-0"> <div
<button type="button" class="inline-flex justify-center rounded-md bg-white dark:bg-gray-700 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"> class="mt-6 flex flex-col justify-stretch space-y-3 sm:flex-row sm:space-x-4 sm:space-y-0">
<svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400 dark:text-gray-300" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <button type="button"
<path d="m12.82 5.58-.82.822-.824-.824a5.375 5.375 0 1 0-7.601 7.602l7.895 7.895a.75.75 0 0 0 1.06 0l7.902-7.897a5.376 5.376 0 0 0-.001-7.599 5.38 5.38 0 0 0-7.611 0Z"/> class="inline-flex justify-center rounded-md bg-white dark:bg-gray-700 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600">
</svg> <svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400 dark:text-gray-300"
<span>{{__("Follow")}}</span> viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
</button> <path
</div> d="m12.82 5.58-.82.822-.824-.824a5.375 5.375 0 1 0-7.601 7.602l7.895 7.895a.75.75 0 0 0 1.06 0l7.902-7.897a5.376 5.376 0 0 0-.001-7.599 5.38 5.38 0 0 0-7.611 0Z" />
</svg>
<span>{{__("Follow")}}</span>
</button>
</div>
@endif @endif
<div class="mt-6 flex flex-col justify-stretch space-y-3 sm:flex-row sm:space-x-4 sm:space-y-0"> <div class="mt-6 flex flex-col justify-stretch space-y-3 sm:flex-row sm:space-x-4 sm:space-y-0">
<button type="button" class="inline-flex justify-center rounded-md bg-white dark:bg-gray-700 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"> <button type="button"
<svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400 dark:text-gray-300" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> class="inline-flex justify-center rounded-md bg-white dark:bg-gray-700 px-3 py-2 text-sm font-semibold text-gray-900 dark:text-gray-100 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600">
<path d="M3 4a2 2 0 00-2 2v1.161l8.441 4.221a1.25 1.25 0 001.118 0L19 7.162V6a2 2 0 00-2-2H3z" /> <svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400 dark:text-gray-300" viewBox="0 0 20 20"
<path d="M19 8.839l-7.77 3.885a2.75 2.75 0 01-2.46 0L1 8.839V14a2 2 0 002 2h14a2 2 0 002-2V8.839z" /> fill="currentColor" aria-hidden="true">
<path
d="M3 4a2 2 0 00-2 2v1.161l8.441 4.221a1.25 1.25 0 001.118 0L19 7.162V6a2 2 0 00-2-2H3z" />
<path
d="M19 8.839l-7.77 3.885a2.75 2.75 0 01-2.46 0L1 8.839V14a2 2 0 002 2h14a2 2 0 002-2V8.839z" />
</svg> </svg>
<span>{{__("Message")}}</span> <span>{{__("Message")}}</span>
</button> </button>
@ -43,20 +53,20 @@
<p>{{__("Member Since")}} {{ $user->created_at->format("M d, h:m a") }}</p> <p>{{__("Member Since")}} {{ $user->created_at->format("M d, h:m a") }}</p>
</div> </div>
</div> </div>
<div class="grid grid-cols-2 m-6"> <div class="grid grid-cols-4">
<div class="flex flex-col"> <div class="flex flex-col col-span-3">
<h2 class="text-2xl">Followers:</h2> {{-- column 1 placeholder --}}
@foreach($user->followers as $follower)
<p>{{$follower->name}}</p>
@endforeach
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col justify-center items-center">
<h2 class="text-2xl">Following:</h2> <div class="flex w-full">
@foreach($user->following as $following) @livewire('user-stack', ['label' => 'Followers', 'users' => $user->followers]);
<p>{{$following->name}}</p> {{-- <x-user-stack :label="__('Followers')" :users="$user->followers" />--}}
@endforeach </div>
<div class="flex w-full">
@livewire('user-stack', ['label' => 'Following', 'users' => $user->following]);
{{-- <x-user-stack :label="__('Following')" :users="$user->following" />--}}
</div>
</div> </div>
</div> </div>
</div> </div>
</x-app-layout> </x-app-layout>