Skip to content
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

feat: Add Facebook Magic Provider #120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/assets/images/facebook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions src/components/Connection/Connection.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,21 @@
width: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 24px
gap: 24px;
}

.showMoreSecondaryOptions + .showMoreSecondaryOptions {
margin-top: 24px;
}

.showMoreSecondaryOptions + .line {
margin-top: 14px;
}

.line + .showMoreSecondaryOptions {
margin-top: 14px;
}

/* Not showing? */

.primaryOption {
Expand All @@ -107,9 +115,14 @@

@media (max-width: 320px) {
.showMoreSecondaryOptions {
grid-template-columns: repeat(1, 1fr);
}
grid-template-columns: repeat(1, 1fr);
}
.secondaryOptionButton span :global(.ui.button.primary) {
margin: auto
margin: auto;
}
}
}

.line {
border: 1px solid white;
width: 80%;
}
1 change: 1 addition & 0 deletions src/components/Connection/Connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const Connection = (props: ConnectionProps): JSX.Element => {
loadingOption={loadingOption}
/>
)}
{/* <div className={styles.line}></div> */}
{showMore && hasWeb3SecondaryOptions && (
<Secondary
testId={WEB3_SECONDARY_TEST_ID}
Expand Down
6 changes: 4 additions & 2 deletions src/components/Connection/Connection.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export enum ConnectionOptionType {
GOOGLE = 'google',
APPLE = 'apple',
DISCORD = 'discord',
X = 'x'
X = 'x',
FACEBOOK = 'facebook'
}

export const connectionOptionTitles: { [key in ConnectionOptionType]: string } = {
Expand All @@ -25,7 +26,8 @@ export const connectionOptionTitles: { [key in ConnectionOptionType]: string } =
[ConnectionOptionType.GOOGLE]: 'Google',
[ConnectionOptionType.APPLE]: 'Apple',
[ConnectionOptionType.DISCORD]: 'Discord',
[ConnectionOptionType.X]: 'X'
[ConnectionOptionType.X]: 'X',
[ConnectionOptionType.FACEBOOK]: 'Facebook'
}

export type MetamaskEthereumWindow = typeof window.ethereum & { isMetaMask?: boolean }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@
.icon-x {
background-image: url('../../../assets/images/x.svg');
}

.icon-facebook {
background-image: url('../../../assets/images/facebook.svg');
}
3 changes: 2 additions & 1 deletion src/components/Pages/LoginPage/LoginPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
background-size: cover;
background-position: right;
animation: move-background 10s linear infinite alternate;
transition: background-image 0.8s;
z-index: -1;
}

Expand Down Expand Up @@ -116,7 +117,7 @@
from {
transform: translateX(0);
}
to {
to {
transform: translateX(10%);
}
}
2 changes: 1 addition & 1 deletion src/components/Pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export const LoginPage = () => {
loadingOption={currentConnectionType}
socialOptions={{
primary: ConnectionOptionType.GOOGLE,
secondary: [ConnectionOptionType.DISCORD, ConnectionOptionType.APPLE, ConnectionOptionType.X]
secondary: [ConnectionOptionType.DISCORD, ConnectionOptionType.APPLE, ConnectionOptionType.X, ConnectionOptionType.FACEBOOK]
}}
web3Options={
isMobile
Expand Down
2 changes: 2 additions & 0 deletions src/components/Pages/LoginPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function fromConnectionOptionToProviderType(connectionType: ConnectionOpt
case ConnectionOptionType.X:
case ConnectionOptionType.GOOGLE:
case ConnectionOptionType.APPLE:
case ConnectionOptionType.FACEBOOK:
return ProviderType.MAGIC
case ConnectionOptionType.WALLET_CONNECT:
case ConnectionOptionType.METAMASK_MOBILE:
Expand Down Expand Up @@ -64,6 +65,7 @@ export async function connectToProvider(connectionOption: ConnectionOptionType):

const url = new URL(window.location.href)
url.pathname = '/auth/callback'
console.log('Connecting to provider', connectionOption)

await magic.oauth.loginWithRedirect({
provider: connectionOption === ConnectionOptionType.X ? 'twitter' : (connectionOption as OAuthProvider),
Expand Down
Loading