Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganized and started refacotr of connted modal
- Loading branch information
Im Khem
authored and
Im Khem
committed
Jul 7, 2023
1 parent
6828142
commit bb1ad81
Showing
7 changed files
with
73 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './masa-loading'; |
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,8 @@ | ||
import React from 'react'; | ||
import { Spinner } from '../spinner'; | ||
|
||
export const MasaLoading = (): JSX.Element => ( | ||
<section className="spinner"> | ||
<Spinner /> | ||
</section> | ||
); |
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 @@ | ||
export { InterfaceAuthenticate } from './authenticate'; |
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,51 @@ | ||
import React, { useEffect, useMemo } from 'react'; | ||
import { useMasa } from '../../../../../provider'; | ||
import { MasaLoading } from '../../masa-loading'; | ||
import { Spinner } from '../../spinner'; | ||
import { useSession } from '../../../../masa/use-session'; | ||
|
||
export const InterfaceConnected = (): JSX.Element => { | ||
const { closeModal, company, isModalOpen } = useMasa(); | ||
const { isLoadingSession: isLoading } = useSession(); | ||
|
||
useEffect(() => { | ||
let timeout; | ||
if (isModalOpen && !isLoading) { | ||
timeout = setTimeout(() => { | ||
closeModal?.(); | ||
}, 3000); | ||
} | ||
|
||
return () => { | ||
clearTimeout(timeout); | ||
}; | ||
}, [isLoading, closeModal, isModalOpen]); | ||
|
||
const titleText = useMemo(() => { | ||
switch (company) { | ||
case 'Masa': { | ||
return 'Starting your soulbound journey'; | ||
} | ||
case 'Celo': { | ||
return 'Launching your Prosperity Passport'; | ||
} | ||
case 'Base': { | ||
return 'Taking you to Base Camp'; | ||
} | ||
default: { | ||
return 'Starting your soulbound journey'; | ||
} | ||
} | ||
}, [company]); | ||
|
||
if (isLoading) return <MasaLoading />; | ||
|
||
return ( | ||
<section className="interface-connected"> | ||
<section> | ||
<h3 className="title">{titleText}</h3> | ||
<Spinner /> | ||
</section> | ||
</section> | ||
); | ||
}; |
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 @@ | ||
export { InterfaceConnected } from './connected'; |
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,5 @@ | ||
export * from './authenticate'; | ||
/* export * from './connected'; | ||
* export * from './connector'; | ||
* export * from './create-credit-score'; | ||
* export * from './create-identity'; */ |