Skip to content

feat: Create deal from contact - #337

Open
erwanMarmelab wants to merge 6 commits into
mainfrom
feat/create-deal-from-contact
Open

feat: Create deal from contact#337
erwanMarmelab wants to merge 6 commits into
mainfrom
feat/create-deal-from-contact

Conversation

@erwanMarmelab

Copy link
Copy Markdown
Contributor

Feature Idea

On a contact's detail page, it would be nice to have a button to create a deal linked to that person.

Solution

Add a Create deal button an the contact's show page

Additional Checks

  • [ ] The documentation is up to date
  • Tested with fakerest provider (see related documentation)
  • Tested with Mobile resolution -> not present on mobile

@fzaninotto

Copy link
Copy Markdown
Member

The size and position of this button currently gives it too much importance relative to the other actions IMHO.

image

I'd prefer that you add a "deals" section in the sidebar listing the current deals with this contact, and move the "add deal" button in this section (and make it a bit smaller like the other "add tasks" buttons). As deals aren't ported to mobile, this section should be hidden on Mobile.

if (!contact) return null;

return (
<ListBase

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using the error and loading prop together with a RecordsIterator (https://marmelab.com/ra-core/recordsiterator/) as child you wouldn't even need a separate DealsIterator.

Comment on lines +54 to +78
<Link
to={`/deals/${deal.id}/show`}
className="flex flex-col -mx-1 px-1 py-1 rounded-sm hover:bg-muted transition-colors"
>
<span className="font-medium">{deal.name}</span>
<span className="text-xs text-muted-foreground">
<SelectField
source="stage"
choices={dealStages}
optionText="label"
optionValue="value"
/>
{", "}
<NumberField
source="amount"
options={{
notation: "compact",
style: "currency",
currency,
currencyDisplay: "narrowSymbol",
minimumSignificantDigits: 3,
}}
/>
</span>
</Link>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We already have something almost identical in ContactDealList. Why don't you refactor it into a common DealList placed under the deal directory instead?

@fzaninotto

Copy link
Copy Markdown
Member

You've somehow changed the font size of the items in the company deal list. Beware that the dealiterator probably has two display modes: "normal" for the company show page, and "small" for the contact sidebar.

@fzaninotto

Copy link
Copy Markdown
Member

You probably also need to update .claude/skills/delete-initial-resource/deals.md because removing the deals will require some cleanup in the contactt show page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants