mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
typed some components
This commit is contained in:
parent
a3f7fd9b46
commit
a5126aff4a
7 changed files with 23 additions and 31 deletions
|
@ -1,8 +1,6 @@
|
|||
// flow
|
||||
import * as React from 'react';
|
||||
import { UserLocation } from '$components/UserLocation';
|
||||
import { DistanceBar } from '$components/panels/DistanceBar';
|
||||
import { Tooltip } from "$components/panels/Tooltip";
|
||||
|
||||
export const TopLeftPanel = () => (
|
||||
<div className="status-panel top left">
|
||||
|
|
|
@ -16,10 +16,6 @@ import { IRootState } from "$redux/user/reducer";
|
|||
import { Tooltip } from "$components/panels/Tooltip";
|
||||
|
||||
interface Props extends IRootState {
|
||||
is_empty: boolean,
|
||||
dialog: string,
|
||||
dialog_active: boolean,
|
||||
|
||||
userLogout: typeof userLogout,
|
||||
setDialog: typeof setDialog,
|
||||
setDialogActive: typeof setDialogActive,
|
||||
|
@ -109,7 +105,7 @@ export class Component extends React.PureComponent<Props, State> {
|
|||
}
|
||||
{
|
||||
(user && user.role && user.role !== 'guest' && menuOpened) &&
|
||||
<UserMenu user={user} userLogout={this.props.userLogout} openAppInfoDialog={this.openAppInfoDialog} />
|
||||
<UserMenu userLogout={this.props.userLogout} openAppInfoDialog={this.openAppInfoDialog} />
|
||||
}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as React from 'react';
|
|||
import { Icon } from '$components/panels/Icon';
|
||||
|
||||
type Props = {
|
||||
onClick: Function,
|
||||
onClick: () => void,
|
||||
}
|
||||
|
||||
export const GuestButton = ({ onClick }: Props) => (
|
|
@ -1,17 +1,17 @@
|
|||
// @flow
|
||||
import * as React from 'react';
|
||||
import { UserPicture } from '$components/user/UserPicture';
|
||||
import { IUser } from '$constants/auth';
|
||||
import { IUser } from "$constants/auth";
|
||||
|
||||
type Props = {
|
||||
interface Props {
|
||||
user: IUser,
|
||||
setMenuOpened: Function,
|
||||
};
|
||||
setMenuOpened: () => void,
|
||||
}
|
||||
|
||||
export const UserButton = ({
|
||||
setMenuOpened,
|
||||
user: {
|
||||
_id,
|
||||
id,
|
||||
photo,
|
||||
first_name,
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ export const UserButton = ({
|
|||
<UserPicture photo={photo} />
|
||||
|
||||
<div className="user-button-fields">
|
||||
<div className="user-button-name">{(first_name || _id || '...')}</div>
|
||||
<div className="user-button-text">{(_id || 'пользователь')}</div>
|
||||
<div className="user-button-name">{(first_name || id || '...')}</div>
|
||||
<div className="user-button-text">{(id || 'пользователь')}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,9 +1,10 @@
|
|||
import * as React from 'react';
|
||||
import { APP_INFO } from '$constants/app_info';
|
||||
import { userLogout } from "$redux/user/actions";
|
||||
|
||||
type Props = {
|
||||
userLogout: Function,
|
||||
openAppInfoDialog: Function,
|
||||
interface Props {
|
||||
userLogout: typeof userLogout,
|
||||
openAppInfoDialog: () => void,
|
||||
}
|
||||
|
||||
export const UserMenu = ({ userLogout, openAppInfoDialog }: Props) => (
|
||||
|
@ -13,7 +14,7 @@ export const UserMenu = ({ userLogout, openAppInfoDialog }: Props) => (
|
|||
<br />
|
||||
MAP
|
||||
<span className="user-panel-ver">
|
||||
- {(APP_INFO.VERSION || 1)}.{(APP_INFO.RELEASE.length || 0)}
|
||||
- {(APP_INFO.VERSION || 1)}.{(Object.keys(APP_INFO.CHANGELOG).length || 0)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="user-panel-item" onClick={openAppInfoDialog}>
|
|
@ -12,12 +12,13 @@ export interface IUser {
|
|||
success: boolean,
|
||||
id?: string,
|
||||
token?: string,
|
||||
userdata: {
|
||||
name: string,
|
||||
agent: string,
|
||||
ip: string,
|
||||
photo: string,
|
||||
}
|
||||
photo: string,
|
||||
first_name: string,
|
||||
// userdata: {
|
||||
// name: string,
|
||||
// agent: string,
|
||||
// ip: string,
|
||||
// }
|
||||
}
|
||||
|
||||
export const ROLES: IRoles = {
|
||||
|
@ -34,10 +35,6 @@ export const DEFAULT_USER: IUser = {
|
|||
success: false,
|
||||
id: null,
|
||||
token: null,
|
||||
userdata: {
|
||||
name: '',
|
||||
agent: '',
|
||||
ip: '',
|
||||
photo: '',
|
||||
}
|
||||
photo: null,
|
||||
first_name: null,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue