forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wot-author wrapping and routing (keybase#23458)
* wot-author wrapping and routing * yarn test -u Storyshots * hide proofs option when lacking proofs * feedback * feedback * feedback * nav * yarn test -u Storyshots * key * fix * fix * sort-keys * uncomponent * yarn test -u Storyshots
- Loading branch information
Showing
10 changed files
with
2,355 additions
and
720 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
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
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
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,53 @@ | ||
import * as React from 'react' | ||
import {Question1, Question2} from '.' | ||
import * as Container from '../../util/container' | ||
import * as RouteTreeGen from '../../actions/route-tree-gen' | ||
import * as Types from '../../constants/types/profile' | ||
|
||
export type Props = Container.RouteProps<{username: string; question?: Types.WotAuthorQuestion}> | ||
|
||
export const WotAuthorRoot = (props: Props) => { | ||
const voucheeUsername = Container.getRouteProps(props, 'username', '') | ||
const whichQuestion = Container.getRouteProps(props, 'question', 'question1') | ||
const nav = Container.useSafeNavigation() | ||
const dispatch = Container.useDispatch() | ||
let {error, initialVerificationType} = Container.useSelector(state => state.profile.wotAuthor) | ||
if (!error && !voucheeUsername) { | ||
error = 'Routing missing username.' | ||
} | ||
if (whichQuestion === 'question1') { | ||
const proofs = [{key: 'web', value: 'fake.proof'}] // PICNIC-1088 TODO | ||
const onSubmit = answer => { | ||
console.log(answer) // PICNIC-1087 TODO use values | ||
dispatch( | ||
nav.safeNavigateAppendPayload({ | ||
path: [{props: {question: 'question2', username: voucheeUsername}, selected: 'profileWotAuthor'}], | ||
}) | ||
) | ||
} | ||
return ( | ||
<Question1 | ||
error={error} | ||
initialVerificationType={initialVerificationType} | ||
onSubmit={onSubmit} | ||
proofs={proofs} | ||
voucheeUsername={voucheeUsername} | ||
/> | ||
) | ||
} else { | ||
const onSubmit = answer => { | ||
console.log(answer) // PICNIC-1087 TODO use values | ||
dispatch(RouteTreeGen.createClearModals()) | ||
} | ||
return ( | ||
<Question2 | ||
error={error} | ||
onBack={() => dispatch(nav.safeNavigateUpPayload())} | ||
onSubmit={onSubmit} | ||
voucheeUsername={voucheeUsername} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
export default WotAuthorRoot |
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
Oops, something went wrong.