diff --git a/client/src/components/AccountMenu.jsx b/client/src/components/AccountMenu.jsx index 0b84652..ab37c34 100644 --- a/client/src/components/AccountMenu.jsx +++ b/client/src/components/AccountMenu.jsx @@ -97,7 +97,7 @@ function AccountItems({ itemComponent: Item, itemClassName, onClose, onLogout }) )} - + diff --git a/client/src/components/common/Profile.jsx b/client/src/components/common/Profile.jsx index b389300..158be1d 100644 --- a/client/src/components/common/Profile.jsx +++ b/client/src/components/common/Profile.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeStyles } from '@mui/styles'; +import Container from '@mui/material/Container'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Grid'; import Avatar from '@mui/material/Avatar'; @@ -29,8 +30,16 @@ const validate = (username) => { const useStyles = makeStyles((theme) => ({ root: { + display: 'flex', + flexDirection: 'column', flexGrow: 1, - padding: '1em', + minHeight: 0, + overflowY: 'auto', + paddingBlock: theme.spacing(2), + }, + content: { + flexShrink: 0, + marginBlock: 'auto', }, avatar: { width: '10em', @@ -118,8 +127,8 @@ function Profile({ user, dispatch }) { return !user.id ? (
) : ( - - + +
{!user.canJoinRoom && ( - - +
+
); } diff --git a/cypress/e2e/local_stack.cy.js b/cypress/e2e/local_stack.cy.js index d45ec3b..39d9d3d 100644 --- a/cypress/e2e/local_stack.cy.js +++ b/cypress/e2e/local_stack.cy.js @@ -100,14 +100,30 @@ describe('local app stack', () => { cy.get('[aria-label="Find a cuber by username or visible WCA ID"]').should('not.exist'); }); - it('opens spacious account navigation', () => { + it('opens a centered profile from the account menu', () => { + cy.viewport(1280, 900); login(); cy.visit('/'); cy.get('button[aria-label="Open account menu"]').click(); - cy.get('[aria-label="Account navigation"]').contains('Friends').should('be.visible'); - cy.get('[aria-label="Account navigation"]').contains('Profile').should('be.visible'); - cy.get('[aria-label="Account navigation"]').contains('Log out').should('be.visible'); + cy.get('[aria-label="Account navigation"]').within(() => { + cy.contains('Friends').should('be.visible'); + cy.contains('Log out').should('be.visible'); + cy.get('a[href="/profile"]').should('have.text', 'Profile').click(); + }); + + cy.location('pathname').should('eq', '/profile'); + cy.get('main .MuiPaper-root').first().should(($paper) => { + const profile = $paper[0].getBoundingClientRect(); + const main = $paper[0].closest('main').getBoundingClientRect(); + + expect(profile.top - main.top).to.be.closeTo(main.bottom - profile.bottom, 1); + expect(profile.width).to.be.at.most(900); + }); + + cy.viewport(375, 420); + cy.get('main .MuiContainer-root').scrollTo('bottom'); + cy.contains('All preferences get saved automatically.').should('be.visible'); }); it('shows a not-found page for an unavailable user profile', () => {