-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FX-4759): Display toast with actions summary for artwork lists f…
…low (#8607) * refactor: always call `onSave` handler * refactor: add `types` * refactor: add `ModifiedArtworkLists` interface * refactor: add `ModifiedArtworkLists` * feat: display toasts * refactor: keep artwork entities * refactor: displaying toast summary logic * chore: use state data
- Loading branch information
1 parent
f513526
commit 2e66b3d
Showing
12 changed files
with
280 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/app/Components/ArtworkLists/components/ArtworkInfo.tests.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Dispatch } from "react" | ||
|
||
export interface RecentlyAddedArtworkList { | ||
internalID: string | ||
name: string | ||
} | ||
|
||
export enum ResultAction { | ||
SavedToDefaultArtworkList, | ||
RemovedFromDefaultArtworkList, | ||
ModifiedArtworkLists, | ||
} | ||
|
||
export interface ArtworkEntity { | ||
id: string | ||
internalID: string | ||
title: string | ||
year: string | null | ||
artistNames: string | null | ||
imageURL: string | null | ||
} | ||
|
||
export type SaveResult = | ||
| { | ||
action: ResultAction.SavedToDefaultArtworkList | ||
artwork: ArtworkEntity | ||
} | ||
| { | ||
action: ResultAction.RemovedFromDefaultArtworkList | ||
} | ||
| { | ||
action: ResultAction.ModifiedArtworkLists | ||
} | ||
|
||
export enum ArtworkListMode { | ||
AddingArtworkList = "addingArtworkLists", | ||
RemovingArtworkList = "removingArtworkLists", | ||
} | ||
|
||
export interface ArtworkListEntity { | ||
internalID: string | ||
name: string | ||
} | ||
|
||
export type ArtworkListState = { | ||
createNewArtworkListViewVisible: boolean | ||
artwork: ArtworkEntity | null | ||
recentlyAddedArtworkList: RecentlyAddedArtworkList | null | ||
selectedArtworkListIDs: string[] | ||
addingArtworkLists: ArtworkListEntity[] | ||
removingArtworkLists: ArtworkListEntity[] | ||
} | ||
|
||
export type ArtworkListAction = | ||
| { type: "SET_CREATE_NEW_ARTWORK_LIST_VIEW_VISIBLE"; payload: boolean } | ||
| { type: "SET_ARTWORK"; payload: ArtworkEntity | null } | ||
| { type: "SET_RECENTLY_ADDED_ARTWORK_LIST"; payload: RecentlyAddedArtworkList | null } | ||
| { type: "RESET" } | ||
| { | ||
type: "ADD_OR_REMOVE_ARTWORK_LIST" | ||
payload: { mode: ArtworkListMode; artworkList: ArtworkListEntity } | ||
} | ||
| { type: "SET_SELECTED_ARTWORK_LIST_IDS"; payload: string[] } | ||
|
||
export interface ArtworkListsContextState { | ||
state: ArtworkListState | ||
artworkListId?: string | ||
isSavedToArtworkList: boolean | ||
addingArtworkListIDs: string[] | ||
removingArtworkListIDs: string[] | ||
dispatch: Dispatch<ArtworkListAction> | ||
reset: () => void | ||
onSave: (result: SaveResult) => void | ||
} |
Oops, something went wrong.