-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add success notifications override per resource #10203
Conversation
These buttons allow users to navigate between the various react-admin views. | ||
|
||
### `<EditButton>` | ||
- **Navigation Buttons**: to navigate between the various react-admin views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the sub sections ('navigation', 'list', etc) from the content and added this TOC instead to move all the section levels up (####
=> ###
). This makes the right menu much more useful.
|
||
| Rule name | Description | | ||
|-----------------------------------------------|-------------------------------------------------| | ||
| `&.RaSkipNavigationButton-skipToContentButton` | Applied to the underlying `MuiButton` component | | ||
|
||
To override the style of all instances of `<SkipNavigationButton>` using the [application-wide style overrides](./AppTheme.md#theming-individual-components), use the `RaSkipNavigationButton` key. | ||
|
||
### `<MenuItemLink>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rmeoved this one as we now document it in <Menu.Item>
@@ -163,6 +163,12 @@ To override the style of `<Menu>` using the [application-wide style overrides](. | |||
|
|||
## `<Menu.Item>` | |||
|
|||
<video controls autoplay playsinline muted loop> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved from `Buttons.md#menuitemlink
## Record Buttons | ||
|
||
### `<UpdateButton>` | ||
## `<UpdateButton>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a short doc for UpdateButton
here, and a dedicated page in UpdateButton.md
. I don't see why that button deserves a specific page. So I moved the content back here, changed the link in Reference.md to point here, and removed the UpdateButton
item in the main navigation.
We must keep the UpdateButton.md
file though, to avoid 404 on external links.
@@ -25,14 +25,14 @@ const AcceptButton = () => { | |||
{ | |||
mutationMode: 'undoable', | |||
onSuccess: () => { | |||
notify('resources.reviews.notification.approved_success', { | |||
notify('resources.reviews.notifications.approved_success', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the new namespace for custom resource notifications is resources.{resource}.notifications
, it made sense to use the same namespace in this demo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this PR is already long but I feel like we're missing a lot of stories.
| `translateOptions` Optional | `{ id?: string, name?: string }` | {} | Custom id and name to be used in the confirm dialog's title | | ||
| `mutationOptions` Optional | | null | options for react-query `useMutation` hook | | ||
| `successMessage` Optional | `string` | 'ra.notification.deleted' | Lets you customize the success notification message. | | ||
| Prop | Required | Type | Default | Description | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we either repeat the DeleteButton
details for props or mention they are the same?
|
||
const theme = createTheme(); | ||
|
||
export const Default = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have more stories for at least the added props
Problem
The snackbar that confirms the creation/update/deletion use a generic "element" name. It's impersonal and sometimes confusing.
Solution
Use a per-resource notification message, and fall back to the previous message.
The per-resource messages are:
resources.[resource].notifications.created
resources.[resource].notifications.updated
resources.[resource].notifications.deleted
The default notification remains the same, however developers can override it using the translation messages, e.g.
French:
Supersedes #10201
How To Test
To do