diff --git a/components/GridRep/index.scss b/components/GridRep/index.scss index 029774f0..01d9d4f8 100644 --- a/components/GridRep/index.scss +++ b/components/GridRep/index.scss @@ -1,54 +1,82 @@ .GridRep { - border: 2px solid transparent; border-radius: 6px; display: flex; - flex-direction: row; - flex-shrink: 0; - margin: 0 8px 8px 0; - padding: 4px; - height: 148px; - width: 311px; -} + flex-direction: column; + gap: $unit; + padding: $unit * 2; -.GridRep:hover { - border: 2px solid #2360C5; - cursor: pointer; -} + &:hover { + background: white; + cursor: pointer; -.GridRep .weapon { - background: white; - border-radius: 4px; -} + .Grid .grid_weapons .grid_weapon { + box-shadow: inset 0 0 1px $grey-70; + } + } -.GridRep .grid_mainhand { - flex-shrink: 0; - height: 136px; - width: 65px; - margin-right: 8px; -} + .Grid { + display: flex; + flex-direction: row; + flex-shrink: 0; -.GridRep .grid_weapons { - list-style: none; - margin: 0; - padding: 0; -} + .grid_mainhand { + margin-right: $unit; + height: 139px; + width: auto; + } -.GridRep .grid_weapon { - background: white; - border-radius: 4px; - float: left; - margin: 0 8px 8px 0; - height: 40px; - width: 70px; -} + .grid_weapons { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-template-rows: 1fr 1fr 1fr; + gap: $unit; + margin: 0; + padding: 0; + width: fit-content; + } -.GridRep .grid_weapon:nth-child(3n+3) { - margin-right: 0; -} + .grid_weapon { + background: white; + border-radius: 4px; + float: left; + height: 40px; + width: 70px; + } + + .grid_mainhand img[src*="jpg"], + .grid_weapon img[src*="jpg"] { + border-radius: 4px; + width: 100%; + height: 100%; + } + } -.GridRep .grid_mainhand img[src*="jpg"], -.GridRep .grid_weapon img[src*="jpg"] { - border-radius: 4px; - width: 100%; - height: 100%; -} \ No newline at end of file + .Details { + display: flex; + flex-direction: column; + gap: $unit / 2; + + h2 { + color: $grey-00; + font-size: $font-regular; + + &.empty { + color: $grey-50; + } + } + + .bottom { + display: flex; + flex-direction: row; + } + + .raid, time { + color: $grey-50; + font-size: $font-small; + } + + .raid { + flex-grow: 1; + } + } +} diff --git a/components/GridRep/index.tsx b/components/GridRep/index.tsx index 74a86f52..14b0b785 100644 --- a/components/GridRep/index.tsx +++ b/components/GridRep/index.tsx @@ -1,19 +1,37 @@ + import React, { useEffect, useState } from 'react' +import classNames from 'classnames' + +import { formatTimeAgo } from '~utils/timeAgo' import './index.scss' interface Props { shortcode: string + name: string + raid: Raid grid: GridWeapon[] + updatedAt: Date onClick: (shortcode: string) => void } const GridRep = (props: Props) => { + + console.log(props) const numWeapons: number = 9 const [mainhand, setMainhand] = useState() const [weapons, setWeapons] = useState>({}) + const titleClass = classNames({ + 'empty': !props.name + }) + + const raidClass = classNames({ + 'raid': true, + 'empty': !props.raid + }) + useEffect(() => { const newWeapons = Array(numWeapons) @@ -43,21 +61,31 @@ const GridRep = (props: Props) => { return (
-
- {generateMainhandImage()} +
+

{ (props.name) ? props.name : 'Untitled' }

+
+
{ (props.raid) ? props.raid.name.en : 'No raid set' }
+ +
-
    - { - Array.from(Array(numWeapons)).map((x, i) => { - return ( -
  • - {generateGridImage(i)} -
  • - ) - }) - } -
+
+
+ {generateMainhandImage()} +
+ +
    + { + Array.from(Array(numWeapons)).map((x, i) => { + return ( +
  • + {generateGridImage(i)} +
  • + ) + }) + } +
+
) } diff --git a/components/GridRepCollection/index.scss b/components/GridRepCollection/index.scss index a1c7150f..d5193311 100644 --- a/components/GridRepCollection/index.scss +++ b/components/GridRepCollection/index.scss @@ -1,6 +1,7 @@ .GridRepCollection { - display: flex; - flex-wrap: wrap; - justify-content: center; + display: grid; + grid-template-columns: auto auto auto; + margin: 0 auto; padding: 0; + width: fit-content; } \ No newline at end of file diff --git a/components/PartyDetails/index.scss b/components/PartyDetails/index.scss index abc7bed8..8510a383 100644 --- a/components/PartyDetails/index.scss +++ b/components/PartyDetails/index.scss @@ -1,4 +1,4 @@ -.Details { +.PartyDetails { display: none; // This breaks transition, find a workaround opacity: 0; margin: 0 auto; diff --git a/components/PartyDetails/index.tsx b/components/PartyDetails/index.tsx index bd92744c..cdb6f813 100644 --- a/components/PartyDetails/index.tsx +++ b/components/PartyDetails/index.tsx @@ -24,13 +24,13 @@ const PartyDetails = (props: Props) => { const raidSelect = React.createRef() const readOnlyClasses = classNames({ - 'Details': true, + 'PartyDetails': true, 'ReadOnly': true, 'Visible': !appSnapshot.party.detailsVisible }) const editableClasses = classNames({ - 'Details': true, + 'PartyDetails': true, 'Editable': true, 'Visible': appSnapshot.party.detailsVisible }) diff --git a/components/ProfileHeader/index.scss b/components/ProfileHeader/index.scss new file mode 100644 index 00000000..12cce3fc --- /dev/null +++ b/components/ProfileHeader/index.scss @@ -0,0 +1,32 @@ +#ProfileHeader { + align-items: center; + background: white; + border-radius: $unit; + display: flex; + margin: 0 auto; + margin-bottom: $unit * 5; + max-width: $unit * 52; + padding: ($unit * 3) ($unit * 5); + + h1 { + font-size: $font-xxlarge; + font-weight: $normal; + flex-grow: 1; + text-align: left; + } + + img { + $diameter: 120px; + border-radius: $diameter / 2; + height: $diameter; + width: $diameter; + + &.gran { + background-color: #CEE7FE; + } + + &.djeeta { + background-color: #FFE1FE; + } + } +} \ No newline at end of file diff --git a/components/ProfileHeader/index.tsx b/components/ProfileHeader/index.tsx new file mode 100644 index 00000000..87af714f --- /dev/null +++ b/components/ProfileHeader/index.tsx @@ -0,0 +1,28 @@ +import React, { useState } from 'react' +import { useSnapshot } from 'valtio' + +import { appState } from '~utils/appState' + +import './index.scss' + +// Props +interface Props { + username: string + gender: boolean +} + +const ProfileHeader = (props: Props) => { + return ( +
+

{props.username}

+ Gran +
+ ) +} + +export default ProfileHeader \ No newline at end of file diff --git a/pages/[username].tsx b/pages/[username].tsx index c63e9f45..a5d309c8 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -3,6 +3,7 @@ import { useRouter } from 'next/router' import api from '~utils/api' +import ProfileHeader from '~components/ProfileHeader' import GridRep from '~components/GridRep' import GridRepCollection from '~components/GridRepCollection' @@ -14,8 +15,11 @@ interface User { interface Party { id: string + name: string + raid: Raid shortcode: string weapons: GridWeapon[] + updated_at: string } const ProfileRoute: React.FC = () => { @@ -44,7 +48,9 @@ const ProfileRoute: React.FC = () => { username: response.data.user.username, 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(() => { setFound(true) @@ -65,7 +71,7 @@ const ProfileRoute: React.FC = () => { const content = (parties && parties.length > 0) ? renderGrids() : renderNoGrids() return (
-

{user.username}

+ {content}
) @@ -82,6 +88,9 @@ const ProfileRoute: React.FC = () => { parties.map((party, i) => { return