Add hero sections to Transfers and Files index pages.
Deploy Ladill Transfer / deploy (push) Successful in 31s
Deploy Ladill Transfer / deploy (push) Successful in 31s
Surface wallet balance and key stats at a glance, matching the layout used across other Ladill apps. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\Transfer;
|
||||
use App\Models\TransferFile;
|
||||
use App\Models\User;
|
||||
use App\Services\Billing\BillingClient;
|
||||
use App\Services\Transfer\FileStorageService;
|
||||
use App\Services\Transfer\TransferRecipientMailService;
|
||||
use App\Services\Transfer\TransferService;
|
||||
@@ -24,6 +25,7 @@ class FilesController extends Controller
|
||||
public function __construct(
|
||||
private TransferService $transfers,
|
||||
private FileStorageService $storage,
|
||||
private BillingClient $billing,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
@@ -88,6 +90,19 @@ class FilesController extends Controller
|
||||
->where('status', '!=', Transfer::STATUS_DELETED)
|
||||
->sum('storage_bytes');
|
||||
|
||||
$fileCount = TransferFile::query()
|
||||
->whereHas('transfer', fn ($q) => $q
|
||||
->where('user_id', $account->id)
|
||||
->where('status', '!=', Transfer::STATUS_DELETED))
|
||||
->count();
|
||||
|
||||
$balanceMinor = 0;
|
||||
try {
|
||||
$balanceMinor = $this->billing->balanceMinor($account->public_id);
|
||||
} catch (\Throwable) {
|
||||
// Balance is informational on this page.
|
||||
}
|
||||
|
||||
return view('transfer.files.index', [
|
||||
'files' => $files,
|
||||
'folders' => $folders,
|
||||
@@ -99,6 +114,8 @@ class FilesController extends Controller
|
||||
'storageBytes' => (int) $storageBytes,
|
||||
'storageGb' => round($storageBytes / (1024 * 1024 * 1024), 2),
|
||||
'pricePerGb' => (float) config('transfer.price_per_gb_month', 0.30),
|
||||
'fileCount' => $fileCount,
|
||||
'balanceMinor' => $balanceMinor,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class TransferController extends Controller
|
||||
private ChunkedUploadService $chunkedUploads,
|
||||
private QrImageGeneratorService $imageGenerator,
|
||||
private QrPdfExporter $pdfExporter,
|
||||
private BillingClient $billing,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
@@ -58,7 +59,34 @@ class TransferController extends Controller
|
||||
->paginate(20)
|
||||
->withQueryString();
|
||||
|
||||
return view('transfer.transfers.index', compact('transfers', 'search', 'status', 'sort'));
|
||||
$transferCount = Transfer::query()
|
||||
->where('user_id', $account->id)
|
||||
->shareTransfers()
|
||||
->where('status', '!=', Transfer::STATUS_DELETED)
|
||||
->count();
|
||||
|
||||
$activeCount = Transfer::query()
|
||||
->where('user_id', $account->id)
|
||||
->shareTransfers()
|
||||
->accessible()
|
||||
->count();
|
||||
|
||||
$balanceMinor = 0;
|
||||
try {
|
||||
$balanceMinor = $this->billing->balanceMinor($account->public_id);
|
||||
} catch (\Throwable) {
|
||||
// Balance is informational on this page.
|
||||
}
|
||||
|
||||
return view('transfer.transfers.index', compact(
|
||||
'transfers',
|
||||
'search',
|
||||
'status',
|
||||
'sort',
|
||||
'transferCount',
|
||||
'activeCount',
|
||||
'balanceMinor',
|
||||
));
|
||||
}
|
||||
|
||||
public function create(BillingClient $billing): View
|
||||
|
||||
Reference in New Issue
Block a user