Get MVP of web app running

This commit is contained in:
Paul Frazee 2023-01-26 12:53:46 -06:00
parent 751dfb20fd
commit a3d2db9645
8 changed files with 158 additions and 46 deletions

View file

@ -15,7 +15,7 @@ import {
} from '@fortawesome/react-native-fontawesome'
import {ComAtprotoAccountCreate} from '@atproto/api'
import * as EmailValidator from 'email-validator'
import {useAnalytics} from '@segment/analytics-react-native'
// import {useAnalytics} from '@segment/analytics-react-native' TODO
import {LogoTextHero} from './Logo'
import {Picker} from '../util/Picker'
import {TextLink} from '../util/Link'
@ -32,7 +32,7 @@ import {ServerInputModal} from '../../../state/models/shell-ui'
import {usePalette} from '../../lib/hooks/usePalette'
export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => {
const {track} = useAnalytics()
// const {track} = useAnalytics() TODO
const pal = usePalette('default')
const store = useStores()
const [isProcessing, setIsProcessing] = useState<boolean>(false)
@ -109,7 +109,7 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => {
password,
inviteCode,
})
track('Create Account')
// track('Create Account') TODO
} catch (e: any) {
let errMsg = e.toString()
if (e instanceof ComAtprotoAccountCreate.InvalidInviteCodeError) {

View file

@ -14,7 +14,7 @@ import {
} from '@fortawesome/react-native-fontawesome'
import * as EmailValidator from 'email-validator'
import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api'
import {useAnalytics} from '@segment/analytics-react-native'
// import {useAnalytics} from '@segment/analytics-react-native' TODO
import {LogoTextHero} from './Logo'
import {Text} from '../util/text/Text'
import {UserAvatar} from '../util/UserAvatar'
@ -153,7 +153,7 @@ const ChooseAccountForm = ({
onSelectAccount: (account?: AccountData) => void
onPressBack: () => void
}) => {
const {track} = useAnalytics()
// const {track} = useAnalytics() TODO
const pal = usePalette('default')
const [isProcessing, setIsProcessing] = React.useState(false)
@ -161,7 +161,7 @@ const ChooseAccountForm = ({
if (account.accessJwt && account.refreshJwt) {
setIsProcessing(true)
if (await store.session.resumeSession(account)) {
track('Sign In', {resumedSession: true})
// track('Sign In', {resumedSession: true}) TODO
setIsProcessing(false)
return
}
@ -261,7 +261,7 @@ const LoginForm = ({
onPressBack: () => void
onPressForgotPassword: () => void
}) => {
const {track} = useAnalytics()
// const {track} = useAnalytics() TODO
const pal = usePalette('default')
const [isProcessing, setIsProcessing] = useState<boolean>(false)
const [handle, setHandle] = useState<string>(initialHandle)
@ -302,7 +302,7 @@ const LoginForm = ({
handle: fullHandle,
password,
})
track('Sign In', {resumedSession: false})
// track('Sign In', {resumedSession: false}) TODO
} catch (e: any) {
const errMsg = e.toString()
store.log.warn('Failed to login', e)

View file

@ -76,7 +76,11 @@ export function DropdownButton({
onPress={onPress}
hitSlop={HITSLOP}
// Fix an issue where specific references cause runtime error in jest environment
ref={process.env.JEST_WORKER_ID != null ? null : ref}>
ref={
typeof process !== 'undefined' && process.env.JEST_WORKER_ID != null
? null
: ref
}>
{children}
</TouchableOpacity>
)