Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

reuse WORKFLOW_ATTRIBUTE_LABELS

Kiran K70bd09a65182
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
index fece6309b1..f38879cc31 100644
--- a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
@@ -135,7 +135,7 @@ export const PATCH = withWorkspace(
) {
throw new DubApiError({
code: "bad_request",
- message: `You cannot change the performance condition from "${WORKFLOW_ATTRIBUTE_LABELS[currentCondition.attribute]}" to "${WORKFLOW_ATTRIBUTE_LABELS[performanceCondition.attribute]}" because the bounty has submissions.`,
+ message: `You cannot change the performance condition from "${WORKFLOW_ATTRIBUTE_LABELS[currentCondition.attribute].toLowerCase()}" to "${WORKFLOW_ATTRIBUTE_LABELS[performanceCondition.attribute].toLowerCase()}" because the bounty has submissions.`,
});
}
}
diff --git a/apps/web/ui/partners/bounties/bounty-logic.tsx b/apps/web/ui/partners/bounties/bounty-logic.tsx
index 8ebaf9e268..378bf03aac 100644
--- a/apps/web/ui/partners/bounties/bounty-logic.tsx
+++ b/apps/web/ui/partners/bounties/bounty-logic.tsx
@@ -1,7 +1,9 @@
import { isCurrencyAttribute } from "@/lib/api/workflows/utils";
import { handleMoneyInputChange, handleMoneyKeyDown } from "@/lib/form-utils";
-import { WorkflowConditionAttribute } from "@/lib/types";
-import { WORKFLOW_ATTRIBUTES } from "@/lib/zod/schemas/workflows";
+import {
+ WORKFLOW_ATTRIBUTE_LABELS,
+ WORKFLOW_ATTRIBUTES,
+} from "@/lib/zod/schemas/workflows";
import {
InlineBadgePopover,
InlineBadgePopoverContext,
@@ -13,13 +15,6 @@ import { useAddEditBountyForm } from "app/app.dub.co/(dashboard)/[slug]/(ee)/pro
import { useContext } from "react";
import { Controller } from "react-hook-form";
-const WORKFLOW_ATTRIBUTE_LABELS: Record<WorkflowConditionAttribute, string> = {
- totalLeads: "total leads",
- totalConversions: "total conversions",
- totalSaleAmount: "total revenue",
- totalCommissions: "total commissions",
-} as const;
-
export function BountyLogic({ className }: { className?: string }) {
const { control, watch } = useAddEditBountyForm();
@@ -73,7 +68,7 @@ export function BountyLogic({ className }: { className?: string }) {
<InlineBadgePopover
text={
field.value
- ? WORKFLOW_ATTRIBUTE_LABELS[field.value]
+ ? WORKFLOW_ATTRIBUTE_LABELS[field.value].toLowerCase()
: "activity"
}
invalid={!field.value}
@@ -82,7 +77,7 @@ export function BountyLogic({ className }: { className?: string }) {
selectedValue={field.value}
onSelect={field.onChange}
items={WORKFLOW_ATTRIBUTES.map((attribute) => ({
- text: WORKFLOW_ATTRIBUTE_LABELS[attribute],
+ text: WORKFLOW_ATTRIBUTE_LABELS[attribute].toLowerCase(),
value: attribute,
}))}
/>