diff --git a/package.json b/package.json index b1ad9e716..7a4600027 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@tailwindcss/forms": "^0.5.2", "@tailwindcss/line-clamp": "^0.4.0", "axios": "^0.21.1", + "boring-avatars": "^1.7.0", "chart.js": "^2.8.0", "classnames": "^2.3.1", "codemirror": "^5.57.0", diff --git a/resources/scripts/components/Avatar.tsx b/resources/scripts/components/Avatar.tsx new file mode 100644 index 000000000..77cdd2985 --- /dev/null +++ b/resources/scripts/components/Avatar.tsx @@ -0,0 +1,28 @@ +import React from 'react'; +import BoringAvatar, { AvatarProps } from 'boring-avatars'; +import { useStoreState } from '@/state/hooks'; + +const palette = [ '#FFAD08', '#EDD75A', '#73B06F', '#0C8F8F', '#587291' ]; + +type Props = Omit; + +const _Avatar = ({ variant = 'beam', ...props }: AvatarProps) => ( + +); + +const _UserAvatar = ({ variant = 'beam', ...props }: Omit) => { + const uuid = useStoreState(state => state.user.data?.uuid); + + return ( + + ); +}; + +_Avatar.displayName = 'Avatar'; +_UserAvatar.displayName = 'Avatar.User'; + +const Avatar = Object.assign(_Avatar, { + User: _UserAvatar, +}); + +export default Avatar; diff --git a/resources/scripts/components/NavigationBar.tsx b/resources/scripts/components/NavigationBar.tsx index 16182e36f..8ce627549 100644 --- a/resources/scripts/components/NavigationBar.tsx +++ b/resources/scripts/components/NavigationBar.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useState } from 'react'; import { Link, NavLink } from 'react-router-dom'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faCogs, faLayerGroup, faSignOutAlt, faUserCircle } from '@fortawesome/free-solid-svg-icons'; +import { faCogs, faLayerGroup, faSignOutAlt } from '@fortawesome/free-solid-svg-icons'; import { useStoreState } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import SearchContainer from '@/components/dashboard/search/SearchContainer'; @@ -11,6 +11,7 @@ import styled from 'styled-components/macro'; import http from '@/api/http'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import Tooltip from '@/components/elements/tooltip/Tooltip'; +import Avatar from '@/components/Avatar'; const RightNavigation = styled.div` & > a, & > button, & > .navigation-link { @@ -58,11 +59,6 @@ export default () => { - - - - - {rootAdmin && @@ -70,6 +66,13 @@ export default () => { } + + + + + + +