File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const SPONSOR_PAGE_UPDATED = "SPONSOR_PAGE_UPDATED";
4040export const SPONSOR_PAGE_ADDED = "SPONSOR_PAGE_ADDED" ;
4141export const SPONSOR_PAGE_ARCHIVED = "SPONSOR_PAGE_ARCHIVED" ;
4242export const SPONSOR_PAGE_UNARCHIVED = "SPONSOR_PAGE_UNARCHIVED" ;
43+ export const RESET_SPONSOR_PAGE_FORM = "RESET_SPONSOR_PAGE_FORM" ;
4344
4445export const GLOBAL_PAGE_CLONED = "GLOBAL_PAGE_CLONED" ;
4546
@@ -215,6 +216,10 @@ export const saveSponsorPage = (entity) => async (dispatch, getState) => {
215216 } ) ;
216217} ;
217218
219+ export const resetSponsorPageForm = ( ) => ( dispatch ) => {
220+ dispatch ( createAction ( RESET_SPONSOR_PAGE_FORM ) ( { } ) ) ;
221+ } ;
222+
218223export const cloneGlobalPage =
219224 ( pagesIds , sponsorIds , allSponsors ) => async ( dispatch , getState ) => {
220225 const { currentSummitState } = getState ( ) ;
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ import {
2828 archiveSponsorPage ,
2929 unarchiveSponsorPage ,
3030 getSponsorPage ,
31- saveSponsorPage
31+ saveSponsorPage ,
32+ resetSponsorPageForm
3233} from "../../../actions/sponsor-pages-actions" ;
3334import CustomAlert from "../../../components/mui/custom-alert" ;
3435import MuiTable from "../../../components/mui/table/mui-table" ;
@@ -49,7 +50,8 @@ const SponsorPagesListPage = ({
4950 archiveSponsorPage,
5051 unarchiveSponsorPage,
5152 getSponsorPage,
52- saveSponsorPage
53+ saveSponsorPage,
54+ resetSponsorPageForm
5355} ) => {
5456 const [ openPopup , setOpenPopup ] = useState ( null ) ;
5557
@@ -110,6 +112,11 @@ const SponsorPagesListPage = ({
110112 } ) ;
111113 } ;
112114
115+ const handleTemplatePopupClose = ( ) => {
116+ resetSponsorPageForm ( ) ;
117+ setOpenPopup ( null ) ;
118+ } ;
119+
113120 const columns = [
114121 {
115122 columnKey : "code" ,
@@ -236,7 +243,7 @@ const SponsorPagesListPage = ({
236243 < PageTemplatePopup
237244 open = { openPopup === "new" }
238245 pageTemplate = { currentSponsorPage }
239- onClose = { ( ) => setOpenPopup ( null ) }
246+ onClose = { handleTemplatePopupClose }
240247 onSave = { handleSaveSponsorPage }
241248 />
242249 </ div >
@@ -252,5 +259,6 @@ export default connect(mapStateToProps, {
252259 archiveSponsorPage,
253260 unarchiveSponsorPage,
254261 getSponsorPage,
255- saveSponsorPage
262+ saveSponsorPage,
263+ resetSponsorPageForm
256264} ) ( SponsorPagesListPage ) ;
Original file line number Diff line number Diff line change @@ -17,11 +17,18 @@ import {
1717 RECEIVE_SPONSOR_PAGES ,
1818 REQUEST_SPONSOR_PAGES ,
1919 SPONSOR_PAGE_ARCHIVED ,
20- SPONSOR_PAGE_UNARCHIVED
20+ SPONSOR_PAGE_UNARCHIVED ,
21+ RESET_SPONSOR_PAGE_FORM
2122} from "../../actions/sponsor-pages-actions" ;
2223import { SET_CURRENT_SUMMIT } from "../../actions/summit-actions" ;
2324import { PAGES_MODULE_KINDS } from "../../utils/constants" ;
2425
26+ const DEFAULT_SPONSOR_PAGE = {
27+ code : "" ,
28+ name : "" ,
29+ modules : [ ]
30+ } ;
31+
2532const DEFAULT_STATE = {
2633 sponsorPages : [ ] ,
2734 term : "" ,
@@ -32,7 +39,7 @@ const DEFAULT_STATE = {
3239 perPage : 10 ,
3340 totalCount : 0 ,
3441 hideArchived : false ,
35- currentSponsorPage : null ,
42+ currentSponsorPage : DEFAULT_SPONSOR_PAGE ,
3643 summitTZ : null
3744} ;
3845
@@ -113,6 +120,9 @@ const sponsorPagesListReducer = (state = DEFAULT_STATE, action) => {
113120
114121 return { ...state , currentSponsorPage : sponsorPage } ;
115122 }
123+ case RESET_SPONSOR_PAGE_FORM : {
124+ return { ...state , currentSponsorPage : DEFAULT_SPONSOR_PAGE } ;
125+ }
116126 default :
117127 return state ;
118128 }
You can’t perform that action at this time.
0 commit comments