Skip to content

Commit 77b7e7d

Browse files
committed
fix: dynamic labels based on type and not window
1 parent 0f1a116 commit 77b7e7d

1 file changed

Lines changed: 16 additions & 33 deletions

File tree

src/components/dialogs/bulk-action-dialog.tsx

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,22 @@ export const BulkActionDialog = ({
7272
close();
7373
};
7474

75-
if (type === "shipping") {
76-
return (
77-
<Dialog open={open} onOpenChange={setOpen}>
78-
<DialogContent>
79-
<DialogHeader>
80-
<DialogTitle>Bulk Action</DialogTitle>
81-
</DialogHeader>
82-
<div className="flex flex-col gap-2">
83-
<Button
84-
variant="secondary"
85-
onClick={() => handleBulkAction(2)}
86-
disabled={selectedItems.size === 0}
87-
>
88-
Set All Selected as Caught
89-
</Button>
90-
<Button
91-
variant="secondary"
92-
onClick={() => handleBulkAction(0)}
93-
disabled={selectedItems.size === 0}
94-
>
95-
Set All Selected as Uncaught
96-
</Button>
97-
</div>
98-
</DialogContent>
99-
</Dialog>
100-
);
75+
let foundLabel = "Set All Selected as Completed";
76+
let notFoundLabel = "Set All Selected as Incomplete";
77+
if (type === "museum") {
78+
foundLabel = "Set All Selected as Found";
79+
notFoundLabel = "Set All Selected as Not Found";
80+
} else if (type === "shipping") {
81+
foundLabel = "Set All Selected as Shipped";
82+
notFoundLabel = "Set All Selected as Unshipped";
10183
}
10284

103-
if (type === "museum") {
85+
if (
86+
type === "museum" ||
87+
type === "shipping" ||
88+
type === "cooking" ||
89+
type === "crafting"
90+
) {
10491
return (
10592
<Dialog open={open} onOpenChange={setOpen}>
10693
<DialogContent>
@@ -113,18 +100,14 @@ export const BulkActionDialog = ({
113100
onClick={() => handleBulkAction(2)}
114101
disabled={selectedItems.size === 0}
115102
>
116-
{onBulkAction && window.location.pathname.includes("walnuts")
117-
? "Set All Selected as Found"
118-
: "Set All Selected as Donated"}
103+
{foundLabel}
119104
</Button>
120105
<Button
121106
variant="secondary"
122107
onClick={() => handleBulkAction(0)}
123108
disabled={selectedItems.size === 0}
124109
>
125-
{onBulkAction && window.location.pathname.includes("walnuts")
126-
? "Set All Selected as Not Found"
127-
: "Set All Selected as Not Donated"}
110+
{notFoundLabel}
128111
</Button>
129112
</div>
130113
</DialogContent>

0 commit comments

Comments
 (0)