Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/AccountMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function AccountItems({ itemComponent: Item, itemClassName, onClose, onLogout })
)}
<Item className={itemClassName} component={Link} onClick={onClose} to="/profile">
<ListItemIcon className={classes.menuIcon}><PersonIcon /></ListItemIcon>
<ListItemText primary="Profile" secondary="Your cuber identity" />
<ListItemText primary="Profile" />
</Item>
<Divider />
<Item className={itemClassName} onClick={onLogout}>
Expand Down
19 changes: 14 additions & 5 deletions client/src/components/common/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -118,8 +127,8 @@ function Profile({ user, dispatch }) {
return !user.id ? (
<div />
) : (
<Grid container justify="center" className={classes.root}>
<Grid item xs={12} md={8}>
<Container className={classes.root} maxWidth="md">
<div className={classes.content}>
{!user.canJoinRoom && (
<Alert
severity="error"
Expand Down Expand Up @@ -208,8 +217,8 @@ function Profile({ user, dispatch }) {
</Paper>
</Grid>
</Paper>
</Grid>
</Grid>
</div>
</Container>
);
}

Expand Down
24 changes: 20 additions & 4 deletions cypress/e2e/local_stack.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading