diff --git a/backend/routes/auth/social/vk.js b/backend/routes/auth/social/vk.js index 3bbdee9..9f64777 100644 --- a/backend/routes/auth/social/vk.js +++ b/backend/routes/auth/social/vk.js @@ -58,7 +58,7 @@ module.exports = async (req, res) => { ...newUser, first_name, last_name, photo, name, }; - const auth = await User.findOne({ _id: user._id }); + const auth = await User.findOne({ _id: user._id }).populate('routes'); if (auth) { await auth.set({ diff --git a/src/components/panels/UserPanel.jsx b/src/components/panels/UserPanel.jsx index 4c54e87..44f52d4 100644 --- a/src/components/panels/UserPanel.jsx +++ b/src/components/panels/UserPanel.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { GuestButton } from '$components/user/GuestButton'; -import { SERVER, TEST } from '$constants/api'; +import { TEST } from '$constants/api'; import { DEFAULT_USER, ROLES } from '$constants/auth'; import { UserButton } from '$components/user/UserButton'; import { UserMenu } from '$components/user/UserMenu'; @@ -11,6 +11,8 @@ import { connect } from 'react-redux'; import type { UserType } from '$constants/types'; import { Icon } from '$components/panels/Icon'; +import classnames from 'classnames'; + type Props = { user: UserType, userLogout: Function, @@ -73,6 +75,8 @@ export class Component extends React.PureComponent { state: { menuOpened }, } = this; + const route_count = Object.keys(user.routes).length; + return (
@@ -92,9 +96,14 @@ export class Component extends React.PureComponent {
diff --git a/src/sprites/icon.svg b/src/sprites/icon.svg index d790bb5..08cc32d 100644 --- a/src/sprites/icon.svg +++ b/src/sprites/icon.svg @@ -299,8 +299,14 @@ + + + + + + - + diff --git a/src/styles/panel.less b/src/styles/panel.less index cdcd240..f6be8eb 100644 --- a/src/styles/panel.less +++ b/src/styles/panel.less @@ -75,6 +75,7 @@ height: 48px; box-sizing: border-box; user-select: none; + position: relative; &:hover { background: rgba(100, 100, 100, 0.2); @@ -152,6 +153,21 @@ } } +.control-bar-counter { + color: white; + min-width: 12px; + height: 12px; + border-radius: 10px; + font-weight: 600; + font-size: 10px; + position: absolute; + bottom: 50%; + right: 50%; + box-sizing: border-box; + transform: translate(50%, 50%); + line-height: 12px; +} + .panel-separator { height: 48px; width: 4px; diff --git a/src/utils/api.js b/src/utils/api.js index 0b0e218..e4a251a 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -2,7 +2,7 @@ import axios from 'axios/index'; import { API } from '$constants/api'; -const arrayToObject = (array, key) => array.reduce((obj, el) => ({ ...obj, [el[key]]: el })); +const arrayToObject = (array, key) => array.reduce((obj, el) => ({ ...obj, [el[key]]: el }), {}); export const checkUserToken = ({ id, token }) => axios.get(API.CHECK_TOKEN, { params: { id, token }