Skip to content

Commit

Permalink
feat: Wide profile page (#1286)
Browse files Browse the repository at this point in the history
* fix: vote pagination bug

* wide profile page
  • Loading branch information
ncomerci authored Sep 25, 2023
1 parent 2940284 commit 988845a
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 13 deletions.
7 changes: 5 additions & 2 deletions src/back/routes/votes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ export async function getCachedVotes(req: Request) {

async function getAddressVotesWithProposals(req: Request) {
const address = validateAddress(req.params.address)
const first = Number(req.query.first) || undefined
const skip = Number(req.query.skip) || undefined
const numFirst = Number(req.query.first)
const numSkip = Number(req.query.skip)

const first = Number.isInteger(numFirst) ? numFirst : undefined
const skip = Number.isInteger(numSkip) ? numSkip : undefined

const votes = await SnapshotService.getAddressesVotes([address], first, skip)

Expand Down
4 changes: 4 additions & 0 deletions src/components/Common/BoxTabs.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.BoxTabs .dcl.tabs .ui.container {
width: 100%;
}

.BoxTabs .dcl.tabs {
display: flex !important;
padding: 0 18px;
Expand Down
4 changes: 0 additions & 4 deletions src/components/Home/OpenProposals.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
margin-bottom: 16px;
}

.OpenProposals__ProposalsContainer .dcl.tabs .ui.container {
width: 100%;
}

.OpenProposals__Loader,
.OpenProposals__Empty {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/ActivityBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ActivityBox = ({ address }: Props) => {
const { requestsStatus } = useProposalsByCoAuthor(isLoggedUserProfile ? account : null, CoauthorStatus.PENDING)

return (
<Container>
<Container fluid>
<BoxTabsContainer>
<BoxTabs>
<BoxTabs.Left>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/GrantBeneficiaryBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function GrantBeneficiaryBox({ address }: Props) {
if (!hasGrants) return null

return (
<Container className="GrantBeneficiaryBox">
<Container fluid className="GrantBeneficiaryBox">
<ProfileBox title={t('page.profile.grants.title')} info={t('page.profile.grants.info')}>
<GrantBeneficiaryList grants={grants} />
</ProfileBox>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/VotedProposalsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function VotedProposalsBox({ address }: Props) {
const { votes, isLoading, handleViewMore, hasMoreProposals } = useVotedProposals(address, PROPOSALS_PER_PAGE)

return (
<Container>
<Container fluid>
<ProfileBox title={t('page.profile.voted_proposals.title')}>
{isLoading && <SkeletonBars amount={votes.length || 3} height={89} />}
{!isLoading &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/VpDelegationBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function VpDelegationBox({ address, delegation, isLoadingDelegation, ownVp, isLo
const profileHasADelegation = delegatedTo.length > 0 && !!ownVp

return (
<Container>
<Container fluid>
<ProfileBox
title={t('page.profile.delegation.title')}
info={t('page.profile.delegation.helper')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/VpDelegatorsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function VpDelegatorsBox({
!isLoggedUserProfile && !isLoadingUserVpDistribution && profileAddress && accountHasDelegations

return (
<Container>
<Container fluid>
<ProfileBox
className="VpDelegatorsBox"
title={t('page.profile.delegators.title')}
Expand Down
3 changes: 3 additions & 0 deletions src/components/User/UserStats.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
.UserStats__StatBoxes {
display: flex;
justify-content: space-between;
}

.UserStats__StatBoxes:not(:last-child) {
margin-bottom: 44px;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/User/UserStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function UserStats({ address, vpDistribution, isLoadingVpDistribu
const { total } = vpDistribution || { total: 0 }

return (
<Container className="UserStats__Container">
<Container fluid className="UserStats__Container">
<div className="UserStats__UserInfo">
<div className="UserStats__UsernameContainer">
<Username address={address} size={isMobile ? 'small' : 'medium'} className="UserStats__Username" />
Expand Down
4 changes: 4 additions & 0 deletions src/pages/profile.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.ProfilePage__Container {
display: flex;
flex-direction: column;
width: 100%;
max-width: 1410px !important;
padding: 0px 1rem !important;
gap: 24px;
margin: auto;
}

@media (min-width: 768px) {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ export default function ProfilePage() {
image="https://decentraland.org/images/decentraland.png"
/>
<Navigation activeTab={NavigationTab.Profile} />
<UserStats address={address} vpDistribution={vpDistribution} isLoadingVpDistribution={isLoadingVpDistribution} />
<div className="ProfilePage__Container">
<UserStats
address={address}
vpDistribution={vpDistribution}
isLoadingVpDistribution={isLoadingVpDistribution}
/>
<GrantBeneficiaryBox address={address} />
<ActivityBox address={address} />
<VpDelegationBox
Expand Down

0 comments on commit 988845a

Please sign in to comment.