diff --git a/resources/js/pages/Scenarios/Show.tsx b/resources/js/pages/Scenarios/Show.tsx index cdbebde..cd15e10 100644 --- a/resources/js/pages/Scenarios/Show.tsx +++ b/resources/js/pages/Scenarios/Show.tsx @@ -1,5 +1,7 @@ import { Head, Link, router } from '@inertiajs/react'; import { useState } from 'react'; +import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@/components/ui/card'; +import { Button } from '@/components/ui/button'; interface Scenario { id: string; @@ -89,6 +91,12 @@ export default function Show({ scenario, buckets, streams = { data: [] }, stream const [editingBucket, setEditingBucket] = useState(null); const [formData, setFormData] = useState({ ...defaultFormData }); + const openCreateModal = () => { + setEditingBucket(null); + setFormData({ ...defaultFormData }); + setIsModalOpen(true); + }; + const handleEdit = (bucket: Bucket) => { setEditingBucket(bucket); const bufferStr = bucket.buffer_multiplier.toString(); @@ -237,118 +245,147 @@ export default function Show({ scenario, buckets, streams = { data: [] }, stream

Buckets

-
-
- {buckets.data.map((bucket) => ( -
-
-
-

- {bucket.name} -

-

- Priority {bucket.priority} • {bucket.type_label} • {bucket.allocation_type_label} -

+ {buckets.data.length === 0 ? ( + + + Set up your buckets + + Income flows through your pipeline into prioritized buckets. + Start by creating buckets for your spending categories. + + + +
+
+

Need

+

Essential expenses: rent, bills, groceries

-
- - - - #{bucket.priority} - +
+

Want

+

Discretionary spending: dining, hobbies, entertainment

+
+
+

Overflow

+

Catches all remaining funds — one per scenario

- -
-
- Current Balance - - ${bucket.current_balance.toFixed(2)} - -
- -
- - Allocation: {formatAllocationValue(bucket)} - - {bucket.allocation_type === 'fixed_limit' && bucket.buffer_multiplier > 0 && ( - - ({bucket.buffer_multiplier}x buffer = ${bucket.effective_capacity.toFixed(2)} effective) + + + + + + ) : ( +
+ {buckets.data.map((bucket) => ( +
+
+
+

+ {bucket.name} +

+

+ Priority {bucket.priority} • {bucket.type_label} • {bucket.allocation_type_label} +

+
+
+ + + + #{bucket.priority} +
+
+ +
+
+ Current Balance + + ${bucket.current_balance.toFixed(2)} + +
+ +
+ + Allocation: {formatAllocationValue(bucket)} + + {bucket.allocation_type === 'fixed_limit' && bucket.buffer_multiplier > 0 && ( + + ({bucket.buffer_multiplier}x buffer = ${bucket.effective_capacity.toFixed(2)} effective) + + )} +
+ + {bucket.allocation_type === 'fixed_limit' && ( +
+
+ Progress + + ${bucket.current_balance.toFixed(2)} / ${bucket.effective_capacity.toFixed(2)} + +
+
+
+
+
)}
- {bucket.allocation_type === 'fixed_limit' && ( -
-
- Progress - - ${bucket.current_balance.toFixed(2)} / ${bucket.effective_capacity.toFixed(2)} - -
-
-
-
-
- )} -
- -
- - {bucket.type !== 'overflow' && ( +
- )} + {bucket.type !== 'overflow' && ( + + )} +
-
- ))} -
+ ))} +
+ )} {/* Streams Section */}