Action menu refactoring (#11454)

# Description

Closes [#696](https://github.com/twentyhq/core-team-issues/issues/696)

- `useAction` hooks have been removed for all actions
- Every action can now declare a react component
- Some standard action components have been introduced: `Action`,
`ActionLink` and `ActionModal`
- The `ActionDisplay` component uses the new `displayType` prop of the
`ActionMenuContext` to render the right component for the action
according to its container: `ActionButton`, `ActionDropdownItem` or
`ActionListItem`
- The `ActionDisplayer` wraps the action component inside a context
which gives it all the information about the action
-`actionMenuEntriesComponenState` has been removed and now all actions
are computed directly using `useRegisteredAction`
- This computation is done inside `ActionMenuContextProvider` and the
actions are passed inside a context
- `actionMenuType` gives information about the container of the action,
so the action can know wether or not to close this container upon
execution
This commit is contained in:
Raphaël Bosi
2025-04-09 15:12:49 +02:00
committed by GitHub
parent 1834b38d04
commit 9e0402e691
235 changed files with 6252 additions and 7590 deletions

View File

@ -14,7 +14,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
import { Loader } from 'twenty-ui/feedback';
import { CardPicker, MainButton } from 'twenty-ui/input';
import { ActionLink, CAL_LINK } from 'twenty-ui/navigation';
import { CAL_LINK, ClickToActionLink } from 'twenty-ui/navigation';
import {
BillingPlanKey,
BillingPriceLicensedDto,
@ -248,17 +248,17 @@ export const ChooseYourPlan = () => {
disabled={isSubmitting}
/>
<StyledLinkGroup>
<ActionLink onClick={signOut}>
<ClickToActionLink onClick={signOut}>
<Trans>Log out</Trans>
</ActionLink>
</ClickToActionLink>
<span />
<ActionLink onClick={handleSwitchPlan(alternatePlan)}>
<ClickToActionLink onClick={handleSwitchPlan(alternatePlan)}>
<Trans>Switch Plan</Trans>
</ActionLink>
</ClickToActionLink>
<span />
<ActionLink href={CAL_LINK} target="_blank" rel="noreferrer">
<ClickToActionLink href={CAL_LINK} target="_blank" rel="noreferrer">
<Trans>Book a Call</Trans>
</ActionLink>
</ClickToActionLink>
</StyledLinkGroup>
</>
) : (