-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/RaZoom-Team/meeting-2107
- Loading branch information
Showing
35 changed files
with
641 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ __pycache__/ | |
.env | ||
data/ | ||
/frontend/node_modules | ||
/frontend/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { User } from "../../../entities"; | ||
|
||
export type UserEdit = Omit<User, 'focus_user' | 'focus_is_liked'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,131 @@ | ||
export function Edit() { | ||
return <>Редачить профиль</> | ||
import { useContext, useState } from 'react' | ||
import styles from './style.module.scss' | ||
import { addNotify, Card } from '../../../shared' | ||
import { ReactSVG } from 'react-svg' | ||
import PencilToSquareIcon from '@gravity-ui/icons/svgs/pencil-to-square.svg'; | ||
import {SealCheck} from '@gravity-ui/icons'; | ||
import { Button, Icon, Portal } from '@gravity-ui/uikit' | ||
import { UserContext } from '../../../app/providers' | ||
import { ModalEdit } from './modal_edit'; | ||
import { ModalAbout, ModalName, ModalClass } from './modals'; | ||
import { CropWidget } from '../../../widgets'; | ||
import { updateAvatar, User } from '../../../entities'; | ||
|
||
const myRoot = document.getElementById('my-root'); | ||
|
||
interface Props { | ||
verifySend: boolean | ||
verify_hook: React.Dispatch<React.SetStateAction<boolean>> | ||
} | ||
|
||
export function Edit({verifySend, verify_hook}: Props) { | ||
const [animEdit, setAnimEdit] = useState(false) | ||
const [editModal, setEdit] = useState(false) | ||
const [img, setImg] = useState<string | undefined>(undefined) | ||
const {user, setUser} = useContext(UserContext) | ||
|
||
const openModal = (func: React.Dispatch<React.SetStateAction<boolean>>) => { | ||
setEdit(false) | ||
func(true) | ||
setAnimEdit(false) | ||
} | ||
|
||
const [litera, setLitera] = useState(false) | ||
const [desc, setDesc] = useState(false) | ||
const [name, setName] = useState(false) | ||
|
||
const onEdit = () => { | ||
setAnimEdit(true) | ||
setEdit(true) | ||
} | ||
|
||
const onVerify = () => { | ||
addNotify({ | ||
title: 'Заявка отправлена', | ||
content: 'Заявка на верификацию успешно отправлена. Мы пришлем тебе уведомление после её рассмотрения', | ||
type: 'info' | ||
}) | ||
verify_hook(true) | ||
} | ||
|
||
const afterPhoto = (user: User) => { | ||
setUser(user) | ||
addNotify({ | ||
title: 'Фото обновлено', | ||
content: 'Вы успешно обновили фотографию своего профиля' | ||
}) | ||
} | ||
|
||
const onPhoto = () => { | ||
setAnimEdit(false) | ||
if (img) { | ||
fetch(img) | ||
.then(res => res.blob()) | ||
.then(blob => { | ||
const avatarForm = new FormData(); | ||
avatarForm.append('avatar', blob) | ||
updateAvatar(avatarForm).then(afterPhoto) | ||
}) | ||
} | ||
} | ||
|
||
if (user) | ||
return <main className={styles['main']}> | ||
|
||
{img && <CropWidget | ||
img={img} | ||
setImg={setImg} | ||
onComplete={onPhoto} | ||
/> | ||
} | ||
|
||
|
||
{myRoot && <Portal container={myRoot}> | ||
<ModalEdit | ||
is_open={editModal} | ||
open_litera={() => openModal(setLitera)} | ||
open_desc={() => openModal(setDesc)} | ||
open_name={() => openModal(setName)} | ||
set_photo={setImg} | ||
close_hook={() => setEdit(false) | ||
} | ||
/> | ||
</Portal> | ||
} | ||
|
||
|
||
|
||
|
||
<ModalAbout is_open={desc} close_hook={() => setDesc(false)} nowDesc={user.desc}></ModalAbout> | ||
<ModalName is_open={name} close_hook={() => setName(false)} nowName={user.name} nowSur={user.surname}></ModalName> | ||
<ModalClass is_open={litera} close_hook={() => setLitera(false)} nowClass={user.literal}></ModalClass> | ||
<div className={styles['container']}> | ||
<Card | ||
name={focus.name} | ||
surname={user.surname} | ||
avatar={user.attachments[0]} | ||
desc={user.desc} | ||
litera={user.literal} | ||
is_me_liked={false} | ||
is_verify={user.verify}> | ||
</Card> | ||
<div className={styles['button-list']}> | ||
<button className={styles['button']}> | ||
<ReactSVG | ||
className={`${styles['icon']} ${animEdit ? styles['active-edit'] : styles['edit-icon']}`} | ||
src={PencilToSquareIcon} | ||
onClick={onEdit} | ||
/> | ||
</button> | ||
</div> | ||
</div> | ||
<div className={styles['bottom-widget-container']}> | ||
<div style={verifySend ? { display: 'none'} : {}} className={styles['button-container']}> | ||
<Button onClick={onVerify} pin='circle-circle' view='normal' size='m'> | ||
<Icon data={SealCheck}></Icon> | ||
Верификация | ||
</Button> | ||
</div> | ||
</div> | ||
</main> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 16px; | ||
width: 100%; | ||
padding-bottom: 12px; | ||
--g-sheet-content-padding: 10px; | ||
--g-text-body-font-weight: 400; | ||
.button-list { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 4px; | ||
gap: 4px; | ||
} | ||
} |
Oops, something went wrong.