Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): add campaign create to promotion UI #7306

Merged
merged 5 commits into from
May 15, 2024

Conversation

riqwan
Copy link
Contributor

@riqwan riqwan commented May 13, 2024

Screenshot 2024-05-13 at 10 39 41

Copy link

vercel bot commented May 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 8:54pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) May 13, 2024 8:54pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 8:54pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 8:54pm

Copy link

changeset-bot bot commented May 13, 2024

⚠️ No Changeset found

Latest commit: 0021adc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it work if we have a promotion that is eligible for multiple currencies, but the campaign uses a single one, e.g. USD? I can't remember if we have talked about this previously.

If the promotion is configured for multiple currencies, perhaps a spend limit should be prohibited?

@olivermrbl
Copy link
Contributor

If I fill out the create campaign form, go back to promotion details, and then continue again to the campaign page, it seems all details are treated as unfilled in the form:

CleanShot.2024-05-13.at.11.55.13.mp4

Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I added a few UI/UX suggestions.


<Form.Control>
{isTypeSpend ? (
<CurrencyInput
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: this should be disabled until currency is selected so we can display proper currency input (we usually add an info tooltip while on FormLabel in such cases)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, but disabled doesn't seem to be working with currency input

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this disabled={!currencyValue} should work if you pass after props spread {...props} since it's probably overriding the prop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the new branch as well

<Form.Label>{t("campaigns.budget.fields.limit")}</Form.Label>

<Form.Control>
{isTypeSpend ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we should reset this value when we switch between usage limit and amount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this here:

useEffect(() => {
  form.setValue(`budget.limit`, undefined)
}, [watchValueType])

But its only resetting every 2nd click, any reccos on how to go about this?

Copy link
Contributor

@fPolic fPolic May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm seems that input is having problem with undefined, setting the value to "" should do the trick:

form.setValue(`${fieldScope}budget.limit`, "")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice that worked, moved it to the new branch.

@riqwan riqwan merged commit bb2b041 into develop May 15, 2024
17 checks passed
@riqwan riqwan deleted the feat/campaign-create branch May 15, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants