Add redesigned components and info to Profile page

This commit is contained in:
Justin Edmund 2022-02-26 17:46:52 -08:00
parent 2a148db4c3
commit ddcf7dc58f

View file

@ -3,6 +3,7 @@ import { useRouter } from 'next/router'
import api from '~utils/api' import api from '~utils/api'
import ProfileHeader from '~components/ProfileHeader'
import GridRep from '~components/GridRep' import GridRep from '~components/GridRep'
import GridRepCollection from '~components/GridRepCollection' import GridRepCollection from '~components/GridRepCollection'
@ -14,8 +15,11 @@ interface User {
interface Party { interface Party {
id: string id: string
name: string
raid: Raid
shortcode: string shortcode: string
weapons: GridWeapon[] weapons: GridWeapon[]
updated_at: string
} }
const ProfileRoute: React.FC = () => { const ProfileRoute: React.FC = () => {
@ -44,7 +48,9 @@ const ProfileRoute: React.FC = () => {
username: response.data.user.username, username: response.data.user.username,
granblueId: response.data.user.granblue_id granblueId: response.data.user.granblue_id
}) })
setParties(response.data.user.parties)
const parties: Party[] = response.data.user.parties
setParties(parties.sort((a, b) => (a.updated_at > b.updated_at) ? -1 : 1))
}) })
.then(() => { .then(() => {
setFound(true) setFound(true)
@ -65,7 +71,7 @@ const ProfileRoute: React.FC = () => {
const content = (parties && parties.length > 0) ? renderGrids() : renderNoGrids() const content = (parties && parties.length > 0) ? renderGrids() : renderNoGrids()
return ( return (
<div> <div>
<h1>{user.username}</h1> <ProfileHeader username={user.username} gender={true} />
{content} {content}
</div> </div>
) )
@ -82,6 +88,9 @@ const ProfileRoute: React.FC = () => {
parties.map((party, i) => { parties.map((party, i) => {
return <GridRep return <GridRep
shortcode={party.shortcode} shortcode={party.shortcode}
name={party.name}
updatedAt={new Date(party.updated_at)}
raid={party.raid}
grid={party.weapons} grid={party.weapons}
key={`party-${i}`} key={`party-${i}`}
onClick={goTo} onClick={goTo}