@@ -40,11 +40,17 @@ export const DEFAULT_ACTION = [
4040 TUTORIAL_FORMS . BROADCAST ,
4141] ;
4242
43+ export const DEFAULT_GATEWAY_ACTION = [
44+ TUTORIAL_CATEGORIES . TOKENS ,
45+ TUTORIAL_FORMS . POOL ,
46+ ] ;
47+
4348export const AppWrapper : React . FC = ( ) => {
4449 const { pathname, search } = useLocation ( ) ;
4550 const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
4651 const { t } = useTranslation ( ) ;
47- const { setPayloadMissingFields } = useContext ( ApplicationContext ) ;
52+ const { setPayloadMissingFields, multiparty, tutorialSections } =
53+ useContext ( ApplicationContext ) ;
4854 const [ action , setAction ] = useState < string | null > ( null ) ;
4955 const [ categoryID , setCategoryID ] = useState < string | undefined > ( undefined ) ;
5056 const [ formID , setFormID ] = useState < string | undefined > ( undefined ) ;
@@ -64,7 +70,7 @@ export const AppWrapper: React.FC = () => {
6470
6571 useEffect ( ( ) => {
6672 initializeFocusedForm ( ) ;
67- } , [ pathname , search ] ) ;
73+ } , [ pathname , search , tutorialSections ] ) ;
6874
6975 // Set form object based on action
7076 useEffect ( ( ) => {
@@ -84,11 +90,16 @@ export const AppWrapper: React.FC = () => {
8490
8591 const initializeFocusedForm = ( ) => {
8692 const existingAction = searchParams . get ( ACTION_QUERY_KEY ) ;
87-
8893 if ( existingAction === null ) {
89- setCategoryID ( DEFAULT_ACTION [ 0 ] ) ;
90- setFormID ( DEFAULT_ACTION [ 1 ] ) ;
91- setActionParam ( DEFAULT_ACTION [ 0 ] , DEFAULT_ACTION [ 1 ] ) ;
94+ if ( multiparty ) {
95+ setCategoryID ( DEFAULT_ACTION [ 0 ] ) ;
96+ setFormID ( DEFAULT_ACTION [ 1 ] ) ;
97+ setActionParam ( DEFAULT_ACTION [ 0 ] , DEFAULT_ACTION [ 1 ] ) ;
98+ } else {
99+ setCategoryID ( DEFAULT_GATEWAY_ACTION [ 0 ] ) ;
100+ setFormID ( DEFAULT_GATEWAY_ACTION [ 1 ] ) ;
101+ setActionParam ( DEFAULT_GATEWAY_ACTION [ 0 ] , DEFAULT_GATEWAY_ACTION [ 1 ] ) ;
102+ }
92103 } else {
93104 const validAction : string [ ] = getValidAction ( existingAction ) ;
94105 setCategoryID ( validAction [ 0 ] ) ;
@@ -134,7 +145,11 @@ export const AppWrapper: React.FC = () => {
134145
135146 const getValidAction = ( action : string ) => {
136147 if ( ! isValidAction ( action ) ) {
137- return DEFAULT_ACTION ;
148+ if ( multiparty ) {
149+ return DEFAULT_ACTION ;
150+ } else {
151+ return DEFAULT_GATEWAY_ACTION ;
152+ }
138153 }
139154
140155 return action . split ( ACTION_DELIM ) ;
0 commit comments