diff --git a/examples/react-graphql/client/src/components/Avatar/Avatar.tsx b/examples/react-graphql/client/src/components/Avatar/Avatar.tsx index 3e35033d0..0aa0b6ea8 100644 --- a/examples/react-graphql/client/src/components/Avatar/Avatar.tsx +++ b/examples/react-graphql/client/src/components/Avatar/Avatar.tsx @@ -1,11 +1,42 @@ import React from 'react' -import { Box, Heading, Avatar } from 'rimble-ui' -import Page from '../../layout/Page' +import { Image } from 'rimble-ui' +import md5 from 'md5' -interface AvatarProps {} +interface AvatarProps { + did: string + source?: string + size?: number + type?: 'square' | 'rounded' | 'circle' + highlight?: boolean +} + +const Component: React.FC = ({ did, type, size, source, highlight }) => { + const avatarSize = size || 40 + const avatarType = type || 'rounded' + const radius = { + square: 0, + rounded: 5, + circle: avatarSize / 2, + } + + const gravatarType = 'identicon' + const GRAVATAR_URI = 'https://www.gravatar.com/avatar/' + const uri = GRAVATAR_URI + md5(did) + '?s=' + avatarSize * 2 + '&d=' + gravatarType + const src = source || uri + + const highlighted = highlight ? { border: 1, padding: 1 } : {} -const Component: React.FC = () => { - return + return ( + {`Avatar + ) } export default Component diff --git a/examples/react-graphql/client/src/gql/queries.ts b/examples/react-graphql/client/src/gql/queries.ts index 5c41b4510..2d047505d 100644 --- a/examples/react-graphql/client/src/gql/queries.ts +++ b/examples/react-graphql/client/src/gql/queries.ts @@ -35,6 +35,19 @@ export const identity = gql` } ` +export const allIdentities = gql` + query allIdentities { + identities { + isManaged + did + shortId + firstName + lastName + profileImage + } + } +` + export const managedIdentities = gql` query managedIdentities { managedIdentityTypes diff --git a/examples/react-graphql/client/src/layout/Sidebar.tsx b/examples/react-graphql/client/src/layout/Sidebar.tsx index 7875dc99e..00959635b 100644 --- a/examples/react-graphql/client/src/layout/Sidebar.tsx +++ b/examples/react-graphql/client/src/layout/Sidebar.tsx @@ -1,15 +1,11 @@ import React, { useContext } from 'react' -import { Box, Avatar } from 'rimble-ui' +import { Box } from 'rimble-ui' import { AppContext } from '../context/AppProvider' -import md5 from 'md5' +import Avatar from '../components/Avatar/Avatar' const Component = () => { const [appState] = useContext(AppContext) - const gravatarType = 'identicon' - const GRAVATAR_URI = 'https://www.gravatar.com/avatar/' - const uri = GRAVATAR_URI + md5(appState.defaultDid) + '?s=100' + '&d=' + gravatarType - return ( { display={'flex'} flexDirection={'column'} > - + ) diff --git a/examples/react-graphql/client/src/styles/base.css b/examples/react-graphql/client/src/styles/base.css index 1cfb9a43d..845bd26cc 100644 --- a/examples/react-graphql/client/src/styles/base.css +++ b/examples/react-graphql/client/src/styles/base.css @@ -30,7 +30,8 @@ body { -webkit-font-smoothing: antialiased; } -tr.interactive_table_row:hover { +tr.interactive_table_row:hover, +.identity_row:hover { background-color: #313131; cursor: pointer; } diff --git a/examples/react-graphql/client/src/views/Connections/Connections.tsx b/examples/react-graphql/client/src/views/Connections/Connections.tsx index e2baf9394..f6da49eaf 100644 --- a/examples/react-graphql/client/src/views/Connections/Connections.tsx +++ b/examples/react-graphql/client/src/views/Connections/Connections.tsx @@ -1,9 +1,49 @@ import React from 'react' import { Box, Heading } from 'rimble-ui' import Page from '../../layout/Page' +import Avatar from '../../components/Avatar/Avatar' +import * as queries from '../../gql/queries' +import { useQuery, useLazyQuery } from 'react-apollo' +import * as Types from '../../types' +import Panel from '../../components/Panel/Panel' const Component = () => { - return + const { loading, data } = useQuery(queries.allIdentities) + + console.log(data?.identities) + + return ( + + {/* */} + + + + + {data?.identities?.map((id: Types.Identity) => { + return ( + + + + + {id.shortId} + {id.isManaged && '(You manage this identity)'} + + ) + })} + + + + + ) } export default Component diff --git a/examples/react-graphql/client/src/views/Identity/IdentityDetail.tsx b/examples/react-graphql/client/src/views/Identity/IdentityDetail.tsx index c49d9e8e0..4f9e2f0bb 100644 --- a/examples/react-graphql/client/src/views/Identity/IdentityDetail.tsx +++ b/examples/react-graphql/client/src/views/Identity/IdentityDetail.tsx @@ -31,9 +31,6 @@ const Component: React.FC = () => { return ( <> - - DID Details - did