(null);
+ const boost = getBoostEligibility({ created_at: createdAt, boosted_at: boostedAt });
+
const handleStatusChange = async (newStatus: string) => {
setIsLoading(true);
setError(null);
@@ -49,6 +55,23 @@ export function GigActions({ gigId, status }: GigActionsProps) {
router.refresh();
};
+ const handleBoost = async () => {
+ setIsLoading(true);
+ setError(null);
+
+ const result = await gigsApi.boost(gigId);
+
+ if (result.error) {
+ setError(result.error);
+ setIsLoading(false);
+ return;
+ }
+
+ setIsOpen(false);
+ setIsLoading(false);
+ router.refresh();
+ };
+
const handleDelete = async () => {
if (!await confirm("Are you sure you want to delete this gig? This action cannot be undone.")) {
return;
@@ -118,6 +141,26 @@ export function GigActions({ gigId, status }: GigActionsProps) {
{status === "active" && (
<>
+ {boost.eligible ? (
+
+ ) : (
+
+
+
+ Boost available{" "}
+ {boost.nextEligibleAt
+ ? new Date(boost.nextEligibleAt).toLocaleDateString()
+ : "soon"}
+
+
+ )}