mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
#23 lab doesn't require superpowers now
This commit is contained in:
parent
8a9a9b9104
commit
998a2e305a
3 changed files with 42 additions and 30 deletions
15
src/components/containers/Authorized/index.tsx
Normal file
15
src/components/containers/Authorized/index.tsx
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import React, { FC } from 'react';
|
||||||
|
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||||
|
import { selectUser } from '~/redux/auth/selectors';
|
||||||
|
|
||||||
|
interface IProps {}
|
||||||
|
|
||||||
|
const Authorized: FC<IProps> = ({ children }) => {
|
||||||
|
const user = useShallowSelect(selectUser);
|
||||||
|
|
||||||
|
if (!user.is_user) return null;
|
||||||
|
|
||||||
|
return <>{children}</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export { Authorized };
|
|
@ -14,7 +14,6 @@ const EditorPublicSwitch: FC<IProps> = ({ data, setData }) => {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Superpower>
|
|
||||||
<Button
|
<Button
|
||||||
color={data.is_promoted ? 'primary' : 'lab'}
|
color={data.is_promoted ? 'primary' : 'lab'}
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -36,7 +35,6 @@ const EditorPublicSwitch: FC<IProps> = ({ data, setData }) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</Superpower>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import React, { FC, useCallback, memo, useState, useEffect, useMemo } from 'react';
|
import React, { FC, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { push as historyPush } from 'connected-react-router';
|
import { push as historyPush } from 'connected-react-router';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Logo } from '~/components/main/Logo';
|
import { Logo } from '~/components/main/Logo';
|
||||||
|
|
||||||
import { Filler } from '~/components/containers/Filler';
|
import { Filler } from '~/components/containers/Filler';
|
||||||
import { selectUser, selectAuthUpdates } from '~/redux/auth/selectors';
|
import { selectAuthUpdates, selectUser } from '~/redux/auth/selectors';
|
||||||
import { Group } from '~/components/containers/Group';
|
import { Group } from '~/components/containers/Group';
|
||||||
import { DIALOGS } from '~/redux/modal/constants';
|
import { DIALOGS } from '~/redux/modal/constants';
|
||||||
import { pick } from 'ramda';
|
import { path, pick } from 'ramda';
|
||||||
import { path } from 'ramda';
|
|
||||||
import { UserButton } from '../UserButton';
|
import { UserButton } from '../UserButton';
|
||||||
import { Notifications } from '../Notifications';
|
import { Notifications } from '../Notifications';
|
||||||
import { URLS } from '~/constants/urls';
|
import { URLS } from '~/constants/urls';
|
||||||
|
@ -21,7 +20,7 @@ import * as MODAL_ACTIONS from '~/redux/modal/actions';
|
||||||
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
||||||
import { IState } from '~/redux/store';
|
import { IState } from '~/redux/store';
|
||||||
import isBefore from 'date-fns/isBefore';
|
import isBefore from 'date-fns/isBefore';
|
||||||
import { Superpower } from '~/components/boris/Superpower';
|
import { Authorized } from '~/components/containers/Authorized';
|
||||||
|
|
||||||
const mapStateToProps = (state: IState) => ({
|
const mapStateToProps = (state: IState) => ({
|
||||||
user: pick(['username', 'is_user', 'photo', 'last_seen_boris'])(selectUser(state)),
|
user: pick(['username', 'is_user', 'photo', 'last_seen_boris'])(selectUser(state)),
|
||||||
|
@ -90,14 +89,14 @@ const HeaderUnconnected: FC<IProps> = memo(
|
||||||
ФЛОУ
|
ФЛОУ
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Superpower>
|
<Authorized>
|
||||||
<Link
|
<Link
|
||||||
className={classNames(styles.item, { [styles.is_active]: pathname === URLS.BASE })}
|
className={classNames(styles.item, { [styles.is_active]: pathname === URLS.BASE })}
|
||||||
to={URLS.LAB}
|
to={URLS.LAB}
|
||||||
>
|
>
|
||||||
ЛАБ
|
ЛАБ
|
||||||
</Link>
|
</Link>
|
||||||
</Superpower>
|
</Authorized>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
className={classNames(styles.item, {
|
className={classNames(styles.item, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue