Skip to content

Commit 397b333

Browse files
committed
Feat: added cost input to categorizer
1 parent 004bbc3 commit 397b333

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/components/controls/select/seats/categorizer.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ const Categorizer = ({ firstElement, selectedElementIds }) => {
5959
className="h-8"
6060
onChange={(e) => onUpdateCategory({ ...category, name: e.target.value })}
6161
/>
62+
<Input
63+
defaultValue={category.cost}
64+
className="h-8 w-5/12"
65+
onChange={(e) =>
66+
onUpdateCategory({ ...category, cost: e.target.value ? parseFloat(e.target.value) : 0 })
67+
}
68+
/>
6269
<Trash2
6370
size={22}
6471
className="hover:text-gray-500 flex-shrink-0 cursor-pointer transition-all duration-medium"

src/store/reducers/editor/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ const initialState = {
1919
id: uuidv4(),
2020
name: "Standard",
2121
color: "#000000",
22-
textColor: "#f7f7f7"
22+
textColor: "#f7f7f7",
23+
cost: 0
2324
},
2425
{
2526
id: uuidv4(),
2627
name: "Premium",
2728
color: "#FF0000",
28-
textColor: "#f7f7f7"
29+
textColor: "#f7f7f7",
30+
cost: 100
2931
},
3032
{
3133
id: uuidv4(),
3234
name: "VIP",
3335
color: "#0000FF",
34-
textColor: "#f7f7f7"
36+
textColor: "#f7f7f7",
37+
cost: 500
3538
}
3639
],
3740
sections: [
@@ -146,7 +149,9 @@ export const slice = createSlice({
146149
action.payload ??= {
147150
id: uuidv4(),
148151
name: "New Category",
149-
color: "#000000"
152+
color: "#000000",
153+
textColor: "#f7f7f7",
154+
cost: 0
150155
};
151156
state.categories.push(action.payload);
152157
},

0 commit comments

Comments
 (0)