-
Notifications
You must be signed in to change notification settings - Fork 13
Create custom GraphQL types for UserPage and UserList #279
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9b5b416
Link userList to userPage through an onClick function in each box of …
peacheym 3c4256b
Move queries and mutations to frontend/src/graphql.
peacheym 1c43766
Remove redundant <BOX> and update test to include barebone mocked use…
peacheym d10b99a
Add Mocked Data test and expectations. Optimize most imports.
peacheym bdfb713
Add barebones UserPage test.
peacheym 8830909
Update docs to maintain eslint
peacheym 220da1b
Add a redirect test for UserList.
peacheym bee8cb2
Remove unnecessary console log that was included in the '.then()' fun…
peacheym 28078ed
Add badge rendering tests.
peacheym 185f794
Disable functions on userPage when accessed from userList.
peacheym 392fc52
Auto-release multiple images
8e77464
Auto-release gcr.io/track-compliance/api:master-4301b10
3e525fc
Add custom type for userList
peacheym c95f27f
Add custom faker types for userPage and userList.
peacheym 1efeeb7
Update schema.faker.graphql to use a UserItemEdges.
peacheym fe81ba4
Add faker values for custom types
peacheym ef99a72
Use custom object query.
peacheym 96a17d9
Add prop type string in userPage
peacheym 15ca9eb
Make additional subtype for admin and org.
peacheym af4a3f8
Refactor userCard into its own component.
peacheym 59e9947
Merge branch 'master' into create-custom-graphql-types
peacheym File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,58 @@ | ||
| import React from 'react' | ||
|
|
||
| import { Badge, Box, Text, PseudoBox } from '@chakra-ui/core' | ||
| import { Trans } from '@lingui/macro' | ||
|
|
||
| import { useHistory } from 'react-router-dom' | ||
|
|
||
| import { bool, string } from 'prop-types' | ||
|
|
||
| export function UserCard(props) { | ||
| const history = useHistory() | ||
| return ( | ||
| <PseudoBox | ||
| width="100%" | ||
| display={{ md: 'flex' }} | ||
| alignItems="center" | ||
| onClick={() => { | ||
| history.push({ | ||
| pathname: '/user', | ||
| state: { detail: props.userName }, | ||
| }) | ||
| }} | ||
| _hover={{ borderColor: 'gray.200', bg: 'gray.200' }} | ||
| p="30px" | ||
| > | ||
| <Box flexShrink="0" minW="15%"> | ||
| <Text mt={1} fontSize="lg" fontWeight="semibold"> | ||
| {props.displayName} | ||
| </Text> | ||
| </Box> | ||
| <Box flexShrink="0" ml={{ md: 4 }} mr={{ md: 4 }} minW="35%"> | ||
| <Text fontSize="lg" minW="10%"> | ||
| {props.userName} | ||
| </Text> | ||
| </Box> | ||
| <Box flexShrink="0" ml={{ md: 4 }} mr={{ md: 4 }} minW="15%"> | ||
| <Badge variantColor={props.tfa ? 'green' : 'red'} minW="15%"> | ||
| <Trans>TwoFactor</Trans> | ||
| </Badge> | ||
| <Badge | ||
| variantColor={props.admin ? 'green' : 'red'} | ||
| ml="10px" | ||
| mr={{ md: 4 }} | ||
| > | ||
| <Trans>Admin</Trans> | ||
| </Badge> | ||
| </Box> | ||
| <Box flexShrink="0" ml={{ md: 4 }} mr={{ md: 4 }} mt={2} minW="15%"></Box> | ||
| </PseudoBox> | ||
| ) | ||
| } | ||
|
|
||
| UserCard.propTypes = { | ||
| displayName: string.isRequired, | ||
| userName: string.isRequired, | ||
| admin: bool.isRequired, | ||
| tfa: bool.isRequired, | ||
| } |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.