Skip to content

Commit

Permalink
render avatar image
Browse files Browse the repository at this point in the history
  • Loading branch information
madisonjordan committed Jul 3, 2023
1 parent 39dc2f3 commit c7ffaf8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions backend-flask/sql/users/show.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SELECT
SELECT
users.uuid,
users.handle,
users.cognito_user_id as cognito_user_uuid,
users.display_name,
users.bio,
(
Expand Down
2 changes: 1 addition & 1 deletion frontend-react-js/src/components/ProfileAvatar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './ProfileAvatar.css';

export default function ProfileAvatar(props) {
const backgroundImage = `url("https://assets.kapingkaping.cloud/avatars/processed/data.jpg")`;
const backgroundImage = `url("https://assets.kapingkaping.cloud/avatars/${props.id}.jpg")`;
const styles = {
backgroundImage: backgroundImage,
backgroundSize: 'cover',
Expand Down
2 changes: 1 addition & 1 deletion frontend-react-js/src/components/ProfileForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './ProfileForm.css';
import React from "react";
import process from 'process';
import {getAccessToken} from '../lib/CheckAuth';
import {getAccessToken} from 'lib/CheckAuth';

export default function ProfileForm(props) {
const [bio, setBio] = React.useState('');
Expand Down
4 changes: 2 additions & 2 deletions frontend-react-js/src/components/ProfileHeading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './ProfileHeading.css';
import EditProfileButton from '../components/EditProfileButton';
import ProfileAvatar from '../components/ProfileAvatar'
import EditProfileButton from 'components/EditProfileButton';
import ProfileAvatar from 'components/ProfileAvatar'

export default function ProfileHeading(props) {
const backgroundImage = 'url("https://assets.kapingkaping.cloud/banners/banner.jpg")';
Expand Down
3 changes: 2 additions & 1 deletion frontend-react-js/src/components/ProfileInfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './ProfileInfo.css';
import {ReactComponent as ElipsesIcon} from './svg/elipses.svg';
import ProfileAvatar from 'components/ProfileAvatar';
import React from "react";

import { Auth } from 'aws-amplify';
Expand Down Expand Up @@ -35,7 +36,7 @@ export default function ProfileInfo(props) {
<button onClick={signOut}>Sign Out</button>
</div>
<div className="profile-info" onClick={click_pop}>
<div className="profile-avatar"></div>
<ProfileAvatar id={props.user.cognito_user_uuid}/>
<div className="profile-desc">
<div className="profile-display-name">{props.user.display_name || "My Name" }</div>
<div className="profile-username">@{props.user.handle || "handle"}</div>
Expand Down
1 change: 1 addition & 0 deletions frontend-react-js/src/lib/CheckAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const checkAuth = async (setUser) => {
return Auth.currentAuthenticatedUser()
}).then((cognito_user) => {
setUser({
cognito_user_uuid: cognito_user.attributes.sub,
display_name: cognito_user.attributes.name,
handle: cognito_user.attributes.preferred_username
})
Expand Down

0 comments on commit c7ffaf8

Please sign in to comment.