1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

change user profile page layout

This commit is contained in:
Fedor Katurov 2025-01-22 14:36:26 +07:00
parent 25c67310d4
commit 5ef19f49c5
5 changed files with 61 additions and 34 deletions

View file

@ -11,7 +11,7 @@ export const API = {
ME: '/auth', ME: '/auth',
UPDATE_PHOTO: '/auth/photo', UPDATE_PHOTO: '/auth/photo',
UPDATE_COVER: '/auth/photo', UPDATE_COVER: '/auth/photo',
PROFILE: (username: string) => `/users/${username}/profile`, PROFILE: (username: string) => `/users/${username}`,
MESSAGES: (username: string) => `/users/${username}/messages`, MESSAGES: (username: string) => `/users/${username}/messages`,
MESSAGE_SEND: (username: string) => `/users/${username}/messages`, MESSAGE_SEND: (username: string) => `/users/${username}/messages`,
MESSAGE_DELETE: (username: string, id: number) => MESSAGE_DELETE: (username: string, id: number) =>

View file

@ -1,6 +1,7 @@
import { FC } from 'react'; import { FC } from 'react';
import { Avatar } from '~/components/common/Avatar'; import { Avatar } from '~/components/common/Avatar';
import { Card } from '~/components/common/Card';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';
import { imagePresets } from '~/constants/urls'; import { imagePresets } from '~/constants/urls';
import { IUser } from '~/types/auth'; import { IUser } from '~/types/auth';
@ -11,11 +12,18 @@ interface Props {
profile: IUser; profile: IUser;
isLoading: boolean; isLoading: boolean;
username: string; username: string;
description: string;
} }
const ProfilePageLeft: FC<Props> = ({ username, profile, isLoading }) => { const ProfilePageLeft: FC<Props> = ({
username,
profile,
description,
isLoading,
}) => {
return ( return (
<div className={styles.wrap}> <Card className={styles.wrap} elevation={0} seamless>
<Card seamless>
<Avatar <Avatar
username={username} username={username}
url={profile?.photo?.url} url={profile?.photo?.url}
@ -32,7 +40,11 @@ const ProfilePageLeft: FC<Props> = ({ username, profile, isLoading }) => {
{isLoading ? <Placeholder /> : `~${profile?.username}`} {isLoading ? <Placeholder /> : `~${profile?.username}`}
</div> </div>
</div> </div>
</Card>
<div className={styles.region}>
<div className={styles.description}>{description}</div>
</div> </div>
</Card>
); );
}; };

View file

@ -1,29 +1,26 @@
@import 'src/styles/variables'; @import 'src/styles/variables';
.wrap { .wrap {
@include outer_shadow;
@include blur;
padding: $gap $gap $gap * 2;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: stretch; align-items: stretch;
justify-content: stretch; justify-content: stretch;
flex-direction: column; flex-direction: column;
height: 100%;
border-radius: $radius; border-radius: $radius;
} }
.top {
padding: 0;
}
.avatar { .avatar {
width: 100%; width: 100%;
height: 0; height: 0;
padding-bottom: 100%; padding-bottom: 100%;
margin-bottom: $gap * 2;
} }
.region { .region {
width: 100%; padding: $gap;
text-align: center;
} }
.name { .name {
@ -44,8 +41,7 @@
.description { .description {
@include clamp(3, 21px * 3); @include clamp(3, 21px * 3);
line-height: 21px;
font: $font_14_regular; font: $font_14_regular;
margin-top: $gap * 3; line-height: 1.25em;
display: none; opacity: 0.5;
} }

View file

@ -2,7 +2,10 @@ import { FC } from 'react';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';
import { Card } from '~/components/common/Card';
import { Container } from '~/components/common/Container'; import { Container } from '~/components/common/Container';
import { Sticky } from '~/components/common/Sticky';
import { FlowGrid } from '~/containers/flow/FlowGrid';
import { ProfilePageLeft } from '~/containers/profile/ProfilePageLeft'; import { ProfilePageLeft } from '~/containers/profile/ProfilePageLeft';
import { useUser } from '~/hooks/auth/useUser'; import { useUser } from '~/hooks/auth/useUser';
import { useGetProfile } from '~/hooks/profile/useGetProfile'; import { useGetProfile } from '~/hooks/profile/useGetProfile';
@ -24,16 +27,21 @@ const ProfileLayout: FC<Props> = observer(({ username }) => {
<Container className={styles.wrap}> <Container className={styles.wrap}>
<div className={styles.grid}> <div className={styles.grid}>
<div className={styles.stamp}> <div className={styles.stamp}>
<div className={styles.row}> <Sticky>
<ProfilePageLeft <ProfilePageLeft
description={profile.description}
profile={profile} profile={profile}
username={username} username={username}
isLoading={isLoading} isLoading={isLoading}
/> />
</div> </Sticky>
</div> </div>
<div>here should be grid</div> <Card className={styles.description}>{profile.description}</Card>
<div className={styles.nodes}>
<FlowGrid nodes={nodes} user={user} onChangeCellView={() => {}} />
</div>
</div> </div>
</Container> </Container>
); );

View file

@ -8,7 +8,10 @@
} }
.grid { .grid {
@include flow_grid; grid-template-columns: 250px 5fr;
display: grid;
column-gap: $gap;
row-gap: $gap;
} }
.row { .row {
@ -18,10 +21,18 @@
.description { .description {
font: $font_14_semibold; font: $font_14_semibold;
text-align: center;
padding: $gap * 2 $gap;
} }
.stamp { .stamp {
grid-row-end: span 2; grid-row-end: span 2;
} }
.nodes {
@include flow_grid();
}
.content {
display: flex;
flex-direction: column;
gap: $gap;
}