Chore: Upgrade to Laravel 12 + remove Mary and Jetstream dependencies (#141)

* docs: remove requirement for setting APP_KEY manually

* optimize date picker

* clean up modals

* spot light working

* reorganization

* add lazy load

* wip

* remove filament

* styling
This commit is contained in:
hackerESQ
2025-09-26 17:41:28 -05:00
committed by GitHub
parent 910d426ad4
commit e6f38d9481
146 changed files with 5443 additions and 3909 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
<x-app-layout>
<x-layouts.app>
<div>
<x-ib-toolbar title="{{ __('Create Portfolio') }}" />
<x-ui.toolbar title="{{ __('Create Portfolio') }}" />
@livewire('manage-portfolio-form')
</div>
</x-app-layout>
</x-layouts.app>
@@ -1,33 +1,34 @@
<?php
use App\Models\Portfolio;
use Illuminate\Support\Collection;
use App\Traits\Toast;
use App\Traits\WithTrimStrings;
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
use Mary\Traits\Toast;
use App\Traits\WithTrimStrings;
new class extends Component {
new class extends Component
{
use Toast;
use WithTrimStrings;
// props
public ?Portfolio $portfolio;
public Bool $hideCancel = false;
public bool $hideCancel = false;
#[Rule('required|min:5')]
public String $title;
public string $title;
#[Rule('sometimes|nullable')]
public ?String $notes;
public ?string $notes;
#[Rule('sometimes|nullable|boolean')]
public Bool $wishlist = false;
public bool $wishlist = false;
public Bool $confirmingPortfolioDeletion = false;
public bool $confirmingPortfolioDeletion = false;
// methods
public function mount()
public function mount()
{
if (isset($this->portfolio)) {
@@ -49,7 +50,7 @@ new class extends Component {
public function save()
{
$portfolio = (new Portfolio())->fill($this->validate());
$portfolio = (new Portfolio)->fill($this->validate());
$portfolio->save();
@@ -68,24 +69,24 @@ new class extends Component {
<div class="w-full md:w-3/4">
<x-ib-form wire:submit="{{ $portfolio ? 'update' : 'save' }}" >
<x-input label="{{ __('Title') }}" wire:model="title" required />
<x-ui.form wire:submit="{{ $portfolio ? 'update' : 'save' }}" >
<x-ui.input label="{{ __('Title') }}" wire:model="title" required />
<x-ib-textarea class="mt-1" label="{{ __('Notes') }}" wire:model="notes" rows="4" />
<x-ui.textarea class="mt-1" label="{{ __('Notes') }}" wire:model="notes" rows="4" />
@if (isset($this->portfolio))
@livewire('share-portfolio-form', ['portfolio' => $portfolio])
@endif
<x-toggle label="{{ __('Wishlist') }}" wire:model="wishlist" >
<x-ui.toggle label="{{ __('Wishlist') }}" wire:model="wishlist" >
<x-slot:hint>
{{ __('Treat this portfolio as a "wishlist" (holdings will be excluded from realized gains, unrealized gains, and dividends)') }}
</x-slot:hint>
</x-toggle>
</x-ui.toggle>
<x-slot:actions>
@if ($portfolio)
<x-button
<x-ui.button
wire:click="$toggle('confirmingPortfolioDeletion')"
wire:loading.attr="disabled"
class="btn text-error"
@@ -95,13 +96,13 @@ new class extends Component {
@endif
@if (!$hideCancel)
<x-button label="{{ __('Cancel') }}" link="/dashboard" />
<x-ui.button label="{{ __('Cancel') }}" link="/dashboard" />
@endif
<x-button label="{{ $portfolio ? __('Update') : __('Create') }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
<x-ui.button label="{{ $portfolio ? __('Update') : __('Create') }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
</x-slot:actions>
</x-ib-form>
</x-ui.form>
<x-confirmation-modal wire:model.live="confirmingPortfolioDeletion">
<x-ui.confirmation-modal wire:model.live="confirmingPortfolioDeletion">
<x-slot name="title">
{{ __('Delete Portfolio') }}
</x-slot>
@@ -111,13 +112,13 @@ new class extends Component {
</x-slot>
<x-slot name="footer">
<x-button class="btn-outline" wire:click="$toggle('confirmingPortfolioDeletion')" wire:loading.attr="disabled">
<x-ui.button class="btn-outline" wire:click="$toggle('confirmingPortfolioDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-secondary-button>
<x-button class="ms-3 btn-error text-white" wire:click="delete" wire:loading.attr="disabled">
<x-ui.button class="ms-3 btn-error text-white" wire:click="delete" wire:loading.attr="disabled">
{{ __('Delete Portfolio') }}
</x-button>
</x-ui.button>
</x-slot>
</x-confirmation-modal>
</x-ui.confirmation-modal>
</div>
@@ -2,9 +2,10 @@
use App\Models\DailyChange;
use App\Models\Portfolio;
use Livewire\Attributes\Lazy;
use Livewire\Volt\Component;
new class extends Component
new #[Lazy] class extends Component
{
// props
public ?Portfolio $portfolio = null;
@@ -31,6 +32,13 @@ new class extends Component
$this->chartSeries = $this->generatePerformanceData();
}
public function placeholder()
{
return <<<'HTML'
<div class="skeleton h-[395px] mb-5"></div>
HTML;
}
public function generatePerformanceData()
{
$filterMethod = collect($this->scopeOptions)->where('id', $this->scope)->first();
@@ -116,7 +124,7 @@ new class extends Component
}
}; ?>
<x-card class="bg-slate-100 dark:bg-base-200 rounded-lg mb-6">
<x-ui.card class="mb-6">
<div class="flex flex-col md:flex-row md:justify-between mb-2">
<div class="flex flex-col md:flex-row items-start md:items-center">
@@ -128,15 +136,15 @@ new class extends Component
</div>
<div class="flex items-center" x-data="{ loading: false }">
{{-- <x-button title="{{ __('Reset chart') }}" icon="o-arrow-path" class="btn-ghost btn-sm btn-circle mr-2" id="chart-reset-zoom-{{ $name }}" /> --}}
{{-- <x-ui.button title="{{ __('Reset chart') }}" icon="o-arrow-path" class="btn-ghost btn-sm btn-circle mr-2" id="chart-reset-zoom-{{ $name }}" /> --}}
<x-loading x-show="loading" x-cloak class="text-gray-400 ml-2" />
<x-ui.loading x-show="loading" x-cloak class="text-gray-400 ml-2" />
<x-dropdown title="{{ __('Choose time period') }}" label="{{ $scope }}" class="btn-xs md:btn-sm btn-outline" x-bind:disabled="loading">
<x-ui.dropdown title="{{ __('Choose time period') }}" label="{{ $scope }}" class="btn-xs md:btn-sm btn-outline" x-bind:disabled="loading">
@foreach($scopeOptions as $option)
<x-menu-item
<x-ui.menu-item
title="{{ $option['name'] }}"
@click="
timeout = setTimeout(() => { loading = true }, 200);
@@ -156,7 +164,7 @@ new class extends Component
<div
class="h-[280px] mb-5"
>
<x-ib-apex-chart :series-data="$chartSeries" :name="$name" />
<x-ui.apex-chart :series-data="$chartSeries" :name="$name" />
</div>
</x-card>
</x-ui.card>
@@ -1,15 +1,13 @@
<?php
use App\Models\Portfolio;
use App\Models\User;
use App\Traits\Toast;
use App\Traits\WithTrimStrings;
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
use Illuminate\Support\Collection;
use Mary\Traits\Toast;
new class extends Component {
new class extends Component
{
use Toast;
use WithTrimStrings;
@@ -23,18 +21,20 @@ new class extends Component {
public int $fullAccess = 0;
public array $permissions;
public bool $confirmingAccessDeletion = false;
public ?string $deletingAccessFor = null;
// methods
public function mount()
{
if (!$this->portfolio) {
if (! $this->portfolio) {
$this->permissions = [
auth()->user()->id => [
'owner' => true,
'full_access' => false
]
'full_access' => false,
],
];
} else {
@@ -43,8 +43,8 @@ new class extends Component {
return [
$user->id => [
'owner' => $user->pivot->owner ?? 0,
'full_access' => $user->pivot->full_access ?? 0
]
'full_access' => $user->pivot->full_access ?? 0,
],
];
})->toArray();
}
@@ -65,13 +65,13 @@ new class extends Component {
{
$this->authorize('fullAccess', $this->portfolio);
if (!$confirmed) {
if (! $confirmed) {
$this->deletingAccessFor = $userId;
$this->confirmingAccessDeletion = true;
return;
}
unset($this->permissions[$userId]);
$this->portfolio->unShare($userId);
@@ -101,7 +101,6 @@ new class extends Component {
$this->emailAddress = '';
$this->fullAccess = false;
}
}; ?>
<div class="">
@@ -109,9 +108,9 @@ new class extends Component {
<span>{{ __('People with access') }}</span>
</label>
<div class="border-primary border rounded-sm px-2 py-5 mb-2 max-h-[20rem] overflow-y-scroll">
<div class="border-primary border rounded-md px-2 py-5 mb-2 max-h-[20rem] overflow-y-scroll">
@if ($portfolio?->owner)
<x-list-item
<x-ui.list-item
:item="$portfolio->owner"
avatar="profile_photo_url"
no-separator
@@ -129,11 +128,11 @@ new class extends Component {
<x-slot:sub-value>
{{ __('Owner') }}
</x-slot:sub-value>
</x-list-item>
</x-ui.list-item>
@endif
@foreach (collect($portfolio?->users)->where('pivot.owner', '!=', 1) as $user)
<x-list-item
<x-ui.list-item
:item="$user"
avatar="profile_photo_url"
no-separator
@@ -154,26 +153,26 @@ new class extends Component {
</x-slot:sub-value>
<x-slot:actions>
@if (auth()->user()->id != $user->id)
<x-select
<x-ui.select
class="select select-ghost border-none focus:outline-none focus:ring-0"
:options="[['id' => 0, 'name' => __('Read only')], ['id' => 1, 'name' => __('Full access')]]"
wire:model.live.number="permissions.{{ $user->id }}.full_access"
/>
<x-button
<x-ui.button
class="btn-sm btn-ghost btn-circle"
wire:click="deleteUser('{{ $user->id }}')"
spinner="deleteUser('{{ $user->id }}')"
title="{{ __('Remove Access') }}"
>
<x-icon name="o-x-mark" class="w-4" />
</x-button>
<x-ui.icon name="o-x-mark" class="w-4" />
</x-ui.button>
@endif
</x-slot:actions>
</x-list-item>
</x-ui.list-item>
@endforeach
<x-confirmation-modal wire:model.live="confirmingAccessDeletion">
<x-ui.confirmation-modal wire:model.live="confirmingAccessDeletion">
<x-slot:title>
{{ __('Remove Access') }}
</x-slot:title>
@@ -183,24 +182,24 @@ new class extends Component {
</x-slot>
<x-slot name="footer">
<x-button class="btn-outline" wire:click="$toggle('confirmingAccessDeletion')" wire:loading.attr="disabled">
<x-ui.button class="btn-outline" wire:click="$toggle('confirmingAccessDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-secondary-button>
<x-button class="ms-3 btn-error text-white" wire:click="deleteUser('{{ $this->deletingAccessFor }}', true)" spinner="deleteUser" wire:loading.attr="disabled">
<x-ui.button class="ms-3 btn-error text-white" wire:click="deleteUser('{{ $this->deletingAccessFor }}', true)" spinner="deleteUser" wire:loading.attr="disabled">
{{ __('Remove Access') }}
</x-button>
</x-ui.button>
</x-slot>
</x-confirmation-modal>
</x-ui.confirmation-modal>
<x-ib-alpine-modal
<x-ui.modal
key="add-user-modal"
title="{{ __('Share Portfolio') }}"
>
<div class="" x-data="{ }">
<x-ib-form wire:submit="addUser" class="">
<x-ui.form wire:submit="addUser" class="">
<x-input
<x-ui.input
label="Email"
icon="o-envelope"
placeholder="{{ __('Type an email address to share portfolio') }}"
@@ -209,7 +208,7 @@ new class extends Component {
required
/>
<x-toggle
<x-ui.toggle
class="mt-2"
label="{{ __('Grant full access') }}"
wire:model="fullAccess"
@@ -219,7 +218,7 @@ new class extends Component {
<x-slot:actions>
<x-button
<x-ui.button
label="{{ __('Share') }}"
title="{{ __('Share Portfolio') }}"
type="submit"
@@ -228,14 +227,14 @@ new class extends Component {
spinner="addUser"
/>
</x-slot:actions>
</x-ib-form>
</x-ui.form>
</div>
</x-ib-alpine-modal>
</x-ui.modal>
<x-button class="btn-sm block mt-4" @click="$dispatch('toggle-add-user-modal')">
<x-ui.button class="btn-sm block mt-4" @click="$dispatch('toggle-add-user-modal')">
{{ __('Add People') }}
</x-button>
</x-ui.button>
</div>
</div>
+37 -42
View File
@@ -1,9 +1,9 @@
@use('App\Models\Currency')
<x-app-layout>
<x-layouts.app>
<div x-data>
<x-ib-alpine-modal
<x-ui.modal
key="create-transaction"
title="{{ __('Create Transaction') }}"
>
@@ -11,9 +11,9 @@
'portfolio' => $portfolio,
])
</x-ib-alpine-modal>
</x-ui.modal>
<x-ib-drawer
<x-ui.drawer
key="manage-portfolio"
title="{{ __('Manage Portfolio') }}"
>
@@ -22,41 +22,41 @@
'hideCancel' => true
])
</x-ib-drawer>
</x-ui.drawer>
<x-ib-toolbar :title="$portfolio->title">
<x-ui.toolbar :title="$portfolio->title">
@if($portfolio->wishlist)
<x-badge value="{{ __('Wishlist') }}" title="{{ __('Wishlist') }}" class="badge-secondary mr-3" />
<x-ui.badge value="{{ __('Wishlist') }}" title="{{ __('Wishlist') }}" class="badge-secondary badge-outline mr-3" />
@endif
@if(auth()->user()->id !== $portfolio->owner_id)
<x-badge value="{{ $portfolio->owner->name }}" title="{{ __('Owner').': '.$portfolio->owner->name }}" class="badge-secondary badge-outline mr-3" />
<x-ui.badge value="{{ $portfolio->owner->name }}" title="{{ __('Owner').': '.$portfolio->owner->name }}" class="badge-secondary badge-outline mr-3" />
@endif
@can('fullAccess', $portfolio)
<x-button
<x-ui.button
title="{{ __('Manage Portfolio') }}"
icon="o-pencil"
class="btn-circle btn-ghost btn-sm text-secondary"
@click="$dispatch('toggle-manage-portfolio')"
/>
@else
<x-icon name="o-eye" class="text-secondary w-4" title="{{ __('Read only') }}" />
<x-ui.icon name="o-eye" class="text-secondary w-4" title="{{ __('Read only') }}" />
@endcan
<x-ib-flex-spacer />
<x-ui.flex-spacer />
@can('fullAccess', $portfolio)
<div>
<x-button
<x-ui.button
label="{{ __('Create Transaction') }}"
class="btn-sm btn-primary whitespace-nowrap"
@click="$dispatch('toggle-create-transaction')"
/>
</div>
@endcan
</x-ib-toolbar>
</x-ui.toolbar>
@livewire('portfolio-performance-chart', [
'name' => 'portfolio-'.$portfolio->id,
@@ -65,36 +65,31 @@
<div class="grid sm:grid-cols-5 gap-5">
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
<div class="text-sm text-gray-400 whitespace-nowrap truncate">{{ __('Market Gain/Loss') }}</div>
<x-ui.card dense="true" sub-title="{{ __('Market Gain/Loss') }}" class="col-span-5 sm:col-span-1">
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_market_gain_dollars', 0)) }} </div>
</x-card>
</x-ui.card>
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
<div class="text-sm text-gray-400 whitespace-nowrap truncate">{{ __('Total Cost Basis') }}</div>
<x-ui.card dense="true" sub-title="{{ __('Total Cost Basis') }}" class="col-span-5 sm:col-span-1">
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_cost_basis', 0)) }} </div>
</x-card>
</x-ui.card>
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
<div class="text-sm text-gray-400 whitespace-nowrap truncate">{{ __('Total Market Value') }}</div>
<x-ui.card dense="true" sub-title="{{ __('Total Market Value') }}" class="col-span-5 sm:col-span-1">
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_market_value', 0)) }} </div>
</x-card>
</x-ui.card>
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
<div class="text-sm text-gray-400 whitespace-nowrap truncate">{{ __('Realized Gain/Loss') }}</div>
<x-ui.card dense="true" sub-title="{{ __('Realized Gain/Loss') }}" class="col-span-5 sm:col-span-1">
<div class="font-black text-xl"> {{ Number::currency($metrics->get('realized_gain_dollars', 0)) }} </div>
</x-card>
</x-ui.card>
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
<div class="text-sm text-gray-400 whitespace-nowrap truncate">{{ __('Dividends Earned') }}</div>
<x-ui.card dense="true" sub-title="{{ __('Dividends Earned') }}" class="col-span-5 sm:col-span-1">
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_dividends_earned', 0)) }} </div>
</x-card>
</x-ui.card>
</div>
<div class="mt-6 grid md:grid-cols-7 gap-5">
<x-ib-card title="{{ __('Holdings') }}" class="md:col-span-4 overflow-scroll">
<x-ui.card title="{{ __('Holdings') }}" class="md:col-span-4">
@if($portfolio->holdings->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
@@ -104,14 +99,14 @@
@else
@livewire('holdings-table', [
'portfolio' => $portfolio
])
@livewire('datatables.holdings-table', [
'portfolio' => $portfolio
])
@endif
</x-ib-card>
</x-ui.card>
<x-ib-card title="{{ __('Recent activity') }}" class="md:col-span-3">
<x-ui.card title="{{ __('Recent activity') }}" class="md:col-span-3">
@if($portfolio->transactions->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
@@ -126,9 +121,9 @@
'transactions' => $portfolio->transactions
])
</x-ib-card>
</x-ui.card>
<x-ib-card title="{{ __('Top performers') }}" class="md:col-span-3">
<x-ui.card title="{{ __('Top performers') }}" class="md:col-span-3">
@if($portfolio->holdings->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
@@ -142,22 +137,22 @@
'holdings' => $portfolio->holdings
])
</x-ib-card>
</x-ui.card>
{{-- <x-ib-card title="{{ __('Top headlines') }}" class="md:col-span-3">
{{-- <x-ui.card title="{{ __('Top headlines') }}" class="md:col-span-3">
@php
$users = App\Models\User::take(3)->get();
@endphp
@foreach($users as $user)
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
<x-ui.list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
@endforeach
</x-ib-card> --}}
</x-ui.card> --}}
@if(config('services.ai_chat_enabled'))
@livewire('ai-chat-window', [
@livewire('ui.ai-chat-window', [
'chatable' => $portfolio,
'suggested_prompts' => [
[
@@ -184,4 +179,4 @@
</div>
</div>
</x-app-layout>
</x-layouts.app>
@@ -1,17 +1,15 @@
<?php
use App\Models\Portfolio;
use App\Models\Transaction;
use Illuminate\Support\Collection;
use Livewire\Volt\Component;
new class extends Component {
new class extends Component
{
// props
public Collection $holdings;
// methods
}; ?>
<div class="">
@@ -23,7 +21,7 @@ new class extends Component {
->take(5)
as $holding
)
<x-list-item
<x-ui.list-item
no-separator
:item="$holding"
link="{{ route('holding.show', [
@@ -36,7 +34,7 @@ new class extends Component {
{{ $holding->market_data?->name }} ({{ $holding->symbol }})
<x-gain-loss-arrow-badge
<x-ui.gain-loss-arrow-badge
:cost-basis="$holding->average_cost_basis"
:market-value="$holding->market_data->market_value"
/>
@@ -45,6 +43,6 @@ new class extends Component {
<x-slot:sub-value>
{{ $holding->portfolio->title }}
</x-slot:sub-value>
</x-list-item>
</x-ui.list-item>
@endforeach
</div>