Skip to content

Commit

Permalink
twitch default connector
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleA committed Sep 28, 2023
1 parent 055a8da commit 6f43abb
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ The settings are described in more detailed in the Sequence Kit documentation.
logoUrlLightMode: 'https://logo-light-mode.svg',
projectName: 'my app',
showEmailInput: true,
miniAuthOptions: ['google', 'discord', 'facebook', 'apple'],
miniAuthOptions: ['google', 'facebook', 'twitch', 'apple'],
authOptions: ['metamask', 'wallet-connect'],
};
// limits the digital assets displayed on the assets summary screen
Expand Down
1 change: 1 addition & 0 deletions packages/connectors/src/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './facebook'
export * from './apple'
export * from './email'
export * from './discord'
export * from './twitch'
29 changes: 29 additions & 0 deletions packages/connectors/src/connectors/twitch/TwitchLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'
import { Box } from '@0xsequence/design-system'

interface GetTwitchLogo {
isDarkMode: boolean
}

export const getTwitchLogo = ({ isDarkMode }: GetTwitchLogo) => {
const fillColor = isDarkMode ? 'white' : 'black'

const TwitchLogo: React.FunctionComponent = ({...props}) => {
return (
<React.Fragment>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 2400 2800" transform="scale(0.80)">
<g>
<g id="Layer_1-2">
<path fill={fillColor} d="M500,0L0,500v1800h600v500l500-500h400l900-900V0H500z M2200,1300l-400,400h-400l-350,350v-350H600V200h1600
V1300z"/>
<rect x="1700" y="550" fill={fillColor} width="200" height="600"/>
<rect x="1150" y="550" fill={fillColor} width="200" height="600"/>
</g>
</g>
</svg>
</React.Fragment>
)
}
return TwitchLogo
}
1 change: 1 addition & 0 deletions packages/connectors/src/connectors/twitch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './twitch'
37 changes: 37 additions & 0 deletions packages/connectors/src/connectors/twitch/twitch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Chain } from 'wagmi'
import { SocialConnector, SocialConnectorOptions } from '../wagmiConnectors';

import { getTwitchLogo } from './TwitchLogo'

export interface TwitchOptions {
chains: Chain[];
options?: SocialConnectorOptions;
}

export const twitch = ({ chains, options = {} }: TwitchOptions) => ({
id: 'twitch',
isSequenceBased: true,
logoDark: getTwitchLogo({ isDarkMode: true }),
logoLight: getTwitchLogo({ isDarkMode: false }),
miniLogoDark: getTwitchLogo({ isDarkMode: true }),
miniLogoLight: getTwitchLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Twitch',
createConnector: () => {
const connector = new SocialConnector({
chains,
options: {
...options,
// @ts-ignore
connect: {
...options?.connect,
settings: {
...options?.connect?.settings,
signInWith: 'twitch'
}
}
}
});
return connector
}
})
6 changes: 3 additions & 3 deletions packages/connectors/src/defaultConnectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
google,
metamask,
walletConnect,
discord,
apple
apple,
twitch
} from './connectors'

interface GetDefaultConnectors {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const getDefaultConnectors = ({
defaultNetwork: defaultChain
}
}),
discord({
twitch({
chains,
options: {
defaultNetwork: defaultChain
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The settings are described in more detailed in the Sequence Kit documentation.
logoUrlLightMode: 'https://logo-light-mode.svg',
projectName: 'my app',
showEmailInput: true,
miniAuthOptions: ['google', 'discord', 'facebook', 'apple'],
miniAuthOptions: ['google', 'facebook', 'twitch', 'apple'],
authOptions: ['metamask', 'wallet-connect'],
},
// limits the digital assets displayed on the assets summary screen
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/constants/defaultSignInOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const defaultSignInOptions = {
showEmailInput: true,
miniAuthOptions: ['google', 'discord', 'facebook', 'apple'],
miniAuthOptions: ['google', 'facebook', 'twitch','apple'],
authOptions: ['metamask', 'wallet-connect']
}

0 comments on commit 6f43abb

Please sign in to comment.