mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
Отрефакторил бэк, исправил ошибки (#138)
* fixed paths to match refactored backend * fixed some paths according to new backend * fixed auth urls for new endpoints * fixed urls * fixed error handling * fixes * fixed error handling on user form * fixed error handling on oauth * using fallback: true on node pages * type button for comment attach buttons * fixed return types of social delete * changed the way we upload user avatars
This commit is contained in:
parent
1745cc636d
commit
080d59858c
42 changed files with 544 additions and 420 deletions
|
@ -3,8 +3,7 @@ import React, { FC } from 'react';
|
|||
import { Group } from '~/components/containers/Group';
|
||||
import { Padder } from '~/components/containers/Padder';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { MenuButton } from '~/components/menu';
|
||||
import { MenuButton } from '~/components/menu/MenuButton';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
|
@ -12,17 +11,30 @@ interface ProfileSidebarLogoutButtonProps {
|
|||
onLogout?: () => void;
|
||||
}
|
||||
|
||||
const ProfileSidebarLogoutButton: FC<ProfileSidebarLogoutButtonProps> = ({ onLogout }) => (
|
||||
<MenuButton icon={<Button color="link" iconRight="logout">Выйти</Button>} position="top-end">
|
||||
const ProfileSidebarLogoutButton: FC<ProfileSidebarLogoutButtonProps> = ({
|
||||
onLogout,
|
||||
}) => (
|
||||
<MenuButton
|
||||
icon={
|
||||
<Button color="link" iconRight="logout">
|
||||
Выйти
|
||||
</Button>
|
||||
}
|
||||
position="top-end"
|
||||
>
|
||||
<Padder className={styles.wrapper}>
|
||||
<Group>
|
||||
<h5>Захотелось наружу?</h5>
|
||||
<div>Там холодно, страшно и больше не раздают пончики!</div>
|
||||
<div />
|
||||
<div><Button onClick={onLogout} color="primary" stretchy>Выпустите меня!</Button></div>
|
||||
<div>
|
||||
<Button onClick={onLogout} color="primary" stretchy>
|
||||
Выпустите меня!
|
||||
</Button>
|
||||
</div>
|
||||
</Group>
|
||||
</Padder>
|
||||
</MenuButton>
|
||||
);
|
||||
|
||||
export { ProfileSidebarLogoutButton }
|
||||
export { ProfileSidebarLogoutButton };
|
||||
|
|
|
@ -16,9 +16,6 @@ import styles from './styles.module.scss';
|
|||
|
||||
interface UserSettingsViewProps {}
|
||||
|
||||
const getError = (error?: string) =>
|
||||
error && has(error, ERROR_LITERAL) ? error : undefined;
|
||||
|
||||
const UserSettingsView: FC<UserSettingsViewProps> = () => {
|
||||
const { values, handleChange, errors } = useSettings();
|
||||
const { isPhone } = useWindowSize();
|
||||
|
@ -41,7 +38,7 @@ const UserSettingsView: FC<UserSettingsViewProps> = () => {
|
|||
value={values.fullname}
|
||||
handler={handleChange('fullname')}
|
||||
title="Полное имя"
|
||||
error={getError(errors.fullname)}
|
||||
error={errors.fullname}
|
||||
/>
|
||||
|
||||
<Textarea
|
||||
|
@ -79,14 +76,14 @@ const UserSettingsView: FC<UserSettingsViewProps> = () => {
|
|||
value={values.username}
|
||||
handler={handleChange('username')}
|
||||
title="Логин"
|
||||
error={getError(errors.username)}
|
||||
error={errors.username}
|
||||
/>
|
||||
|
||||
<InputText
|
||||
value={values.email}
|
||||
handler={handleChange('email')}
|
||||
title="E-mail"
|
||||
error={getError(errors.email)}
|
||||
error={errors.email}
|
||||
/>
|
||||
|
||||
<InputText
|
||||
|
@ -94,7 +91,7 @@ const UserSettingsView: FC<UserSettingsViewProps> = () => {
|
|||
handler={handleChange('newPassword')}
|
||||
title="Новый пароль"
|
||||
type="password"
|
||||
error={getError(errors.newPassword)}
|
||||
error={errors.newPassword}
|
||||
/>
|
||||
|
||||
<InputText
|
||||
|
@ -102,7 +99,7 @@ const UserSettingsView: FC<UserSettingsViewProps> = () => {
|
|||
handler={handleChange('password')}
|
||||
title="Старый пароль"
|
||||
type="password"
|
||||
error={getError(errors.password)}
|
||||
error={errors.password}
|
||||
/>
|
||||
|
||||
<div className={styles.small}>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import React, { useCallback, useEffect, useMemo, VFC } from 'react';
|
||||
|
||||
import { isNil } from 'ramda';
|
||||
|
||||
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||
import { ProfileSidebarNotes } from '~/components/profile/ProfileSidebarNotes';
|
||||
import { ProfileSidebarSettings } from '~/components/profile/ProfileSidebarSettings';
|
||||
|
@ -13,6 +11,7 @@ import { ProfileSidebarMenu } from '~/containers/profile/ProfileSidebarMenu';
|
|||
import { useAuth } from '~/hooks/auth/useAuth';
|
||||
import { useUser } from '~/hooks/auth/useUser';
|
||||
import type { SidebarComponentProps } from '~/types/sidebar';
|
||||
import { isNil } from '~/utils/ramda';
|
||||
|
||||
const tabs = ['profile', 'bookmarks'] as const;
|
||||
type TabName = typeof tabs[number];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue