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
@@ -20,7 +20,7 @@ new class extends Component
<div>
@foreach ($holding->dividends->take(5) as $dividend)
<x-list-item :item="$dividend">
<x-ui.list-item :item="$dividend" no-separator>
<x-slot:value>
@php
@@ -35,7 +35,7 @@ new class extends Component
<x-slot:sub-value>
<span title="{{ __('Ex Dividend Date') }}">{{ $dividend->date->format('F d, Y') }}</span>
</x-slot:sub-value>
</x-list-item>
</x-ui.list-item>
@endforeach
</div>
@@ -21,7 +21,7 @@ new class extends Component
<div class="font-bold text-2xl py-1 flex items-center">
{{ Number::currency($holding->market_data->market_value ?? 0, $holding->market_data->currency) }}
<x-gain-loss-arrow-badge
<x-ui.gain-loss-arrow-badge
:cost-basis="$holding->average_cost_basis"
:market-value="$holding->market_data->market_value_base"
/>
@@ -1,19 +1,17 @@
<?php
use App\Models\Holding;
use Illuminate\Support\Collection;
use Livewire\Attributes\{Computed};
use App\Traits\Toast;
use Livewire\Volt\Component;
use Mary\Traits\Toast;
use Illuminate\Validation\Rule;
new class extends Component {
new class extends Component
{
use Toast;
// props
public Holding $holding;
public Bool $reinvest_dividends = false;
public bool $reinvest_dividends = false;
// methods
public function rules()
@@ -24,9 +22,9 @@ new class extends Component {
];
}
public function mount()
public function mount()
{
$this->reinvest_dividends = $this->holding?->reinvest_dividends ?? false;
}
@@ -41,9 +39,9 @@ new class extends Component {
}; ?>
<div class="" x-data="{ }"> {{-- grid lg:grid-cols-4 gap-10 --}}
<x-ib-form wire:submit="save" class=""> {{-- col-span-3 --}}
<x-ui.form wire:submit="save" class=""> {{-- col-span-3 --}}
<x-toggle
<x-ui.toggle
label="{{ __('Reinvest Dividends') }}"
wire:model="reinvest_dividends"
right
@@ -52,7 +50,7 @@ new class extends Component {
<x-slot:actions>
<x-button
<x-ui.button
label="{{ __('Save') }}"
type="submit"
icon="o-paper-airplane"
@@ -60,6 +58,6 @@ new class extends Component {
spinner="save"
/>
</x-slot:actions>
</x-ib-form>
</x-ui.form>
</div>
@@ -1,103 +0,0 @@
<?php
use App\Models\Portfolio;
use Illuminate\Support\Collection;
use Livewire\Volt\Component;
use App\Models\Currency;
new class extends Component
{
// props
public Portfolio $portfolio;
public array $sortBy = ['column' => 'symbol', 'direction' => 'asc'];
public array $headers;
public function mount()
{
$this->headers = [
['key' => 'symbol', 'label' => __('Symbol')],
['key' => 'market_data_name', 'label' => __('Name'), 'sortable' => true, 'class' => 'hidden md:table-cell'],
['key' => 'quantity', 'label' => __('Quantity')],
['key' => 'average_cost_basis', 'label' => __('Average Cost Basis')],
['key' => 'total_cost_basis', 'label' => __('Total Cost Basis'), 'class' => 'hidden md:table-cell'],
['key' => 'market_data_market_value', 'label' => __('Market Value')],
['key' => 'total_market_value', 'label' => __('Total Market Value'), 'class' => 'hidden md:table-cell'],
['key' => 'market_gain_dollars', 'label' => __('Market Gain/Loss')],
['key' => 'market_gain_percent', 'label' => __('Market Gain/Loss'), 'class' => 'hidden md:table-cell'],
['key' => 'realized_gain_dollars', 'label' => __('Realized Gain/Loss')],
['key' => 'dividends_earned', 'label' => __('Dividends Earned')],
['key' => 'market_data_fifty_two_week_low', 'label' => __('52 week low'), 'class' => 'hidden md:table-cell'],
['key' => 'market_data_fifty_two_week_high', 'label' => __('52 week high'), 'class' => 'hidden md:table-cell'],
['key' => 'num_transactions', 'label' => __('Number of Transactions')],
['key' => 'market_data_updated_at', 'label' => __('Last Refreshed')],
];
}
public function holdings(): Collection
{
$holdings = $this->portfolio
->holdings()
->withCount(['transactions as num_transactions' => function ($query) {
return $query->whereRaw('transactions.symbol = holdings.symbol');
}])
->orderBy(...array_values($this->sortBy))
// ->where('holdings.quantity', '>', 0)
->get();
return $holdings;
}
public function goToHolding($holding)
{
return $this->redirect(route('holding.show', ['portfolio' => $holding['portfolio_id'], 'symbol' => $holding['symbol']]));
}
}; ?>
<x-table
:headers="$headers"
:rows="$this->holdings()"
:sort-by="$sortBy"
@row-click="$wire.goToHolding($event.detail)"
>
@scope('cell_average_cost_basis', $row)
{{ Number::currency($row->average_cost_basis ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_total_cost_basis', $row)
{{ Number::currency($row->total_cost_basis ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_realized_gain_dollars', $row)
{{ Number::currency($row->realized_gain_dollars ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_market_gain_dollars', $row)
{{ Number::currency($row->market_gain_dollars ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_market_gain_percent', $row)
<x-gain-loss-arrow-badge
:cost-basis="$row->average_cost_basis"
:market-value="$row->market_data->market_value"
/>
@endscope
@scope('cell_market_data_market_value', $row)
{{ Number::currency($row->market_data_market_value ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_market_data_fifty_two_week_low', $row)
{{ Number::currency($row->market_data_fifty_two_week_low ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_market_data_fifty_two_week_high', $row)
{{ Number::currency($row->market_data_fifty_two_week_high ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_total_market_value', $row)
{{ Number::currency($row->total_market_value ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_dividends_earned', $row)
{{ Number::currency($row->dividends_earned ?? 0, $row->market_data->currency) }}
@endscope
@scope('cell_market_data_updated_at', $row)
{{ \Carbon\Carbon::parse($row->market_data_updated_at)->diffForHumans() }}
@endscope
</x-table>
+26 -26
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') }}"
>
@@ -12,9 +12,9 @@
'symbol' => $holding->market_data->symbol,
])
</x-ib-alpine-modal>
</x-ui.modal>
<x-ib-alpine-modal
<x-ui.modal
key="holding-options"
title="{{ __('Holding Options') }}"
>
@@ -22,9 +22,9 @@
'holding' => $holding
])
</x-ib-alpine-modal>
</x-ui.modal>
<x-ib-toolbar>
<x-ui.toolbar>
<x-slot:title>
<a href="{{ route('portfolio.show', ['portfolio' => $portfolio->id]) }}" title="{{ __('Portfolio') }}">
{{ $portfolio->title }}
@@ -33,30 +33,30 @@
</x-slot:title>
@can('fullAccess', $portfolio)
<x-button
<x-ui.button
title="{{ __('Holding options') }}"
icon="o-pencil"
class="btn-circle btn-ghost btn-sm text-secondary"
@click="$dispatch('toggle-holding-options')"
/>
@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)
<x-button
<x-ui.button
label="{{ __('Create transaction') }}"
class="btn-sm btn-primary whitespace-nowrap"
@click="$dispatch('toggle-create-transaction')"
/>
@endcan
</x-ib-toolbar>
</x-ui.toolbar>
<div class="mt-6 grid md:grid-cols-9 gap-5">
<x-ib-card class="md:col-span-5">
<x-ui.card class="md:col-span-5">
<x-slot:title>
{{ $holding->market_data->symbol }}
@@ -65,9 +65,9 @@
@livewire('holding-market-data', ['holding' => $holding])
</x-ib-card>
</x-ui.card>
<x-ib-card title="{{ __('Fundamentals') }}" class="md:col-span-4">
<x-ui.card title="{{ __('Fundamentals') }}" class="md:col-span-4">
@if(!empty($holding->market_data->market_cap))
<p>
@@ -100,7 +100,7 @@
<p>
<span class="font-bold">{{ __('52 week') }}: </span>
<x-fifty-two-week-range :market-data="$holding->market_data" />
<x-ui.fifty-two-week-range :market-data="$holding->market_data" />
</p>
@if(!empty($holding->market_data->dividend_yield))
@@ -120,9 +120,9 @@
</p>
@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">
@livewire('transactions-list', [
'portfolio' => $holding->portfolio,
@@ -130,9 +130,9 @@
'shouldGoToHolding' => false
])
</x-ib-card>
</x-ui.card>
<x-ib-card title="{{ __('Dividends') }}" class="md:col-span-3">
<x-ui.card title="{{ __('Dividends') }}" class="md:col-span-3">
@if($holding->dividends->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
@@ -144,9 +144,9 @@
@livewire('holding-dividends-list', ['holding' => $holding])
</x-ib-card>
</x-ui.card>
<x-ib-card title="{{ __('Splits') }}" class="md:col-span-3">
<x-ui.card title="{{ __('Splits') }}" class="md:col-span-3">
@if($holding->splits->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
@@ -158,7 +158,7 @@
@foreach ($holding->splits->take(5) as $split)
<x-list-item :item="$split">
<x-ui.list-item :item="$split" no-separator>
<x-slot:value>
1:{{ $split->split_amount }}
@@ -167,17 +167,17 @@
<x-slot:sub-value>
<span title="{{ __('Distribution Date') }}">{{ $split->date->format('F d, Y') }}</span>
</x-slot:sub-value>
</x-list-item>
</x-ui.list-item>
@endforeach
</x-ib-card>
</x-ui.card>
@if(config('services.ai_chat_enabled'))
{{-- // todo: add to system prompt:
// Additionally, here is some recent news about {$this->holding->symbol}:
// And their latest SEC filings: --}}
@livewire('ai-chat-window', [
@livewire('ui.ai-chat-window', [
'chatable' => $holding,
'suggested_prompts' => [
[
@@ -228,4 +228,4 @@
</div>
</div>
</x-app-layout>
</x-layouts.app>