diff --git a/client-portal/modules/appContext.tsx b/client-portal/modules/appContext.tsx index 4ed6dbcee74..f4c22681601 100644 --- a/client-portal/modules/appContext.tsx +++ b/client-portal/modules/appContext.tsx @@ -27,7 +27,11 @@ function AppProvider({ children }: Props) { const [currentUser, setCurrentUser] = React.useState(null); const [notificationsCount, setNotificationsCount] = React.useState(0); - const userQuery = useQuery(gql(queries.currentUser)); + const { data: userData, loading: userLoading } = useQuery( + gql(queries.currentUser) + ); + + const response: any = useQuery(gql(clientPortalGetConfig), {}); const notificationsCountQry = useQuery( gql(queries.notificationsCountQuery), @@ -37,8 +41,8 @@ function AppProvider({ children }: Props) { ); useEffect(() => { - if (userQuery.data && userQuery.data.clientPortalCurrentUser) { - setCurrentUser(userQuery.data.clientPortalCurrentUser); + if (userData && userData.clientPortalCurrentUser) { + setCurrentUser(userData.clientPortalCurrentUser); } if ( @@ -87,15 +91,13 @@ function AppProvider({ children }: Props) { unsubscribe2(); }; }, [ - userQuery, + userData, currentUser, notificationsCountQry, notificationsCount, setNotificationsCount, ]); - const response: any = useQuery(gql(clientPortalGetConfig), {}); - const config: Config = response.data ? response.data.clientPortalGetConfigByDomain : {}; @@ -107,12 +109,16 @@ function AppProvider({ children }: Props) { skip: !config.knowledgeBaseTopicId, }); + if (userLoading || response.loading || topicResponse.loading) { + return null; + } + const topic = (topicResponse.data ? topicResponse.data.clientPortalKnowledgeBaseTopicDetail : {}) || {}; - if (userQuery.loading || response.loading) { + if (response.loading) { return null; } diff --git a/client-portal/modules/card/components/ListHeader.tsx b/client-portal/modules/card/components/ListHeader.tsx index b9f46107984..debd33df82e 100644 --- a/client-portal/modules/card/components/ListHeader.tsx +++ b/client-portal/modules/card/components/ListHeader.tsx @@ -1,7 +1,7 @@ +import { CardTab, FilterGroup } from "../../styles/cards"; import { typeFilters, viewModes } from "../../main/constants"; import Button from "../../common/Button"; -import { CardTab } from "../../styles/cards"; import { Dropdown } from "react-bootstrap"; import DropdownToggle from "../../common/DropdownToggle"; import { HeaderWrapper } from "../../styles/main"; @@ -23,16 +23,7 @@ type Props = { export default class ListHeader extends React.Component { renderFilters() { - const { - mode, - setMode, - baseColor, - setShowForm, - setViewType, - viewType, - type, - hideHeader, - } = this.props; + const { mode, setMode, setViewType, viewType, hideHeader } = this.props; if (hideHeader) { return null; @@ -40,33 +31,22 @@ export default class ListHeader extends React.Component { return ( <> - - {viewModes.map((item) => ( - setViewType(item.type)} - > -   {item.label} - - ))} - - {viewType !== "board" && ( - - -   {mode} - - + +   + + +   {mode} + + + @@ -85,6 +65,36 @@ export default class ListHeader extends React.Component { )} + + + + +   + + +   {viewType} + + + + + + + {viewModes.map((item) => ( + { + setViewType(item.type); + }} + > + {item.label} + + ))} + + ); } diff --git a/client-portal/modules/common/Button.tsx b/client-portal/modules/common/Button.tsx index 8afcd25f327..c42f08a5186 100644 --- a/client-portal/modules/common/Button.tsx +++ b/client-portal/modules/common/Button.tsx @@ -60,7 +60,7 @@ const ButtonStyled = styledTS<{ block?: boolean; uppercase?: boolean; }>(styled.button)` - border-radius: 30px; + border-radius: 8px; position: relative; transition: all 0.3s ease; outline: 0; diff --git a/client-portal/modules/main/components/SettingsLayout.tsx b/client-portal/modules/main/components/SettingsLayout.tsx index cbdaf766752..15e7afdc6b6 100644 --- a/client-portal/modules/main/components/SettingsLayout.tsx +++ b/client-portal/modules/main/components/SettingsLayout.tsx @@ -1,11 +1,10 @@ import { Config, IUser } from "../../types"; import { LeftContent, LeftSidebar } from "../../styles/profile"; -import React, { useState } from "react"; import Dropdown from "react-bootstrap/Dropdown"; import Icon from "../../common/Icon"; -import Link from "next/link"; import NameCard from "../../common/nameCard/NameCard"; +import React from "react"; import { getConfigColor } from "../../common/utils"; import { renderUserFullName } from "../../utils"; import { useRouter } from "next/router"; diff --git a/client-portal/modules/styles/cards.ts b/client-portal/modules/styles/cards.ts index 4b150fcd780..05f7707d98d 100644 --- a/client-portal/modules/styles/cards.ts +++ b/client-portal/modules/styles/cards.ts @@ -308,7 +308,7 @@ const CardTab = styledTS<{baseColor?: string}>(styled.div)` font-size: 13px; background: #f4f4f4; border: 1px solid ${colors.borderPrimary}; - border-radius: ${dimensions.unitSpacing}px; + border-radius: ${dimensions.unitSpacing - 2}px; color: ${colors.colorCoreGray}; overflow: hidden; @@ -345,6 +345,13 @@ const FlexRow = styled.div` } `; +const FilterGroup = styled.div` + label { + font-size: 14px; + margin: 0 5px 0 0; + } +`; + export { TicketRow, TicketLabel, @@ -352,6 +359,7 @@ export { Table, Label, DetailHeader, + FilterGroup, ListHead, ListBody, ListRow, diff --git a/client-portal/modules/styles/main.ts b/client-portal/modules/styles/main.ts index 975d0059230..93991610ffa 100644 --- a/client-portal/modules/styles/main.ts +++ b/client-portal/modules/styles/main.ts @@ -100,8 +100,10 @@ const SupportMenus = styledTS<{ color?: string, baseColor?: string }>(styled.div .dropdown-menu { width: 210px; - right: 0px; + right: -50px; left: auto !important; + top: 35px !important; + transform: none !important; } > button { @@ -537,6 +539,8 @@ const NotificationList = styled.ul` margin: 0; padding: 0; list-style: none; + max-height: 450px; + overflow: auto; li { padding: ${dimensions.unitSpacing}px ${dimensions.coreSpacing}px; diff --git a/client-portal/modules/styles/notifications.ts b/client-portal/modules/styles/notifications.ts index 3716573f9cc..8c077e699a8 100644 --- a/client-portal/modules/styles/notifications.ts +++ b/client-portal/modules/styles/notifications.ts @@ -86,9 +86,25 @@ const TabCaption = styled.span` } `; +const NotificationSettingsRow = styled.div` + font-size: 13px; + color: #666; + margin-bottom: ${dimensions.coreSpacing}px; + + p { + margin-bottom: ${dimensions.unitSpacing - 2}px; + } + + .react-toggle { + margin-right: ${dimensions.unitSpacing}px; + } +`; + + export { NotificationWrapper, NotificationFooter, + NotificationSettingsRow, CreatedUser, AvatarSection, TabCaption, diff --git a/client-portal/modules/user/components/Profile.tsx b/client-portal/modules/user/components/Profile.tsx index 21f8494ca09..22e03e274c9 100644 --- a/client-portal/modules/user/components/Profile.tsx +++ b/client-portal/modules/user/components/Profile.tsx @@ -5,7 +5,6 @@ import { IFormProps } from "../../common/types"; import { IUser } from "../../types"; import { ModalFooter } from "../../common/form/styles"; import React from "react"; -import { useRouter } from "next/router"; type Props = { currentUser: IUser; @@ -99,7 +98,7 @@ function Profile({ currentUser, renderButton }: Props) { {...formProps} name="companyName" type="number" - defaultValue={object.phone} + defaultValue={object.companyName} /> )} diff --git a/client-portal/modules/user/components/Register.tsx b/client-portal/modules/user/components/Register.tsx index 95b398573f6..286b46922e1 100644 --- a/client-portal/modules/user/components/Register.tsx +++ b/client-portal/modules/user/components/Register.tsx @@ -1,13 +1,13 @@ -import { LoginFormWrapper, WithIconFormControl } from '../../styles/form'; -import React, { useState } from 'react'; +import { LoginFormWrapper, WithIconFormControl } from "../../styles/form"; +import React, { useState } from "react"; -import { Config } from '../../types'; -import Form from '../../common/form/Form'; -import FormControl from '../../common/form/Control'; -import FormGroup from '../../common/form/Group'; -import { IButtonMutateProps } from '../../common/types'; -import Icon from '../../common/Icon'; -import { LOGIN_TYPES } from '../types'; +import { Config } from "../../types"; +import Form from "../../common/form/Form"; +import FormControl from "../../common/form/Control"; +import FormGroup from "../../common/form/Group"; +import { IButtonMutateProps } from "../../common/types"; +import Icon from "../../common/Icon"; +import { LOGIN_TYPES } from "../types"; type Props = { config: Config; @@ -22,11 +22,11 @@ function Register({ renderButton, hasCompany, setRegister, - setLogin + setLogin, }: Props) { const [type, changeType] = useState(LOGIN_TYPES.CUSTOMER); - const onChange = e => { + const onChange = (e) => { changeType(e.target.value); e.isDefaultPrevented(); }; @@ -36,7 +36,7 @@ function Register({ setLogin(true); }; - const renderForm = formProps => { + const renderForm = (formProps) => { if (type === LOGIN_TYPES.CUSTOMER) { return ( <> @@ -46,7 +46,7 @@ function Register({ @@ -58,7 +58,7 @@ function Register({ @@ -70,7 +70,7 @@ function Register({ @@ -82,7 +82,7 @@ function Register({ @@ -98,7 +98,7 @@ function Register({ @@ -110,7 +110,7 @@ function Register({ @@ -120,7 +120,7 @@ function Register({ ); }; - const renderContent = formProps => { + const renderContent = (formProps) => { const { values, isSubmitted } = formProps; return ( @@ -142,7 +142,7 @@ function Register({ @@ -155,7 +155,7 @@ function Register({ {...formProps} name="password" type="password" - placeholder={'Enter your password'} + placeholder={"Enter your password"} required={true} /> @@ -164,14 +164,14 @@ function Register({ {renderButton({ values: { ...values, type, clientPortalId: config._id }, - isSubmitted + isSubmitted, })}
- Already have an account?{' '} + Already have an account?{" "} Sign in @@ -182,8 +182,8 @@ function Register({ return ( -

{'Sign up'}

-

{'Free forever. No credit card needed'}

+

{"Sign up"}

+

{"Free forever. No credit card needed"}

); diff --git a/client-portal/modules/user/components/Settings.tsx b/client-portal/modules/user/components/Settings.tsx index 9af4d53ac7d..0c261ab2d15 100644 --- a/client-portal/modules/user/components/Settings.tsx +++ b/client-portal/modules/user/components/Settings.tsx @@ -1,11 +1,12 @@ -import { ControlLabel, FormGroup } from "../../common/form"; import { SettingsContent, SettingsTitle } from "../../styles/profile"; import Button from "../../common/Button"; +import { ControlLabel } from "../../common/form"; import { IUser } from "../../types"; import { ModalFooter } from "../../common/form/styles"; +import { NotificationSettingsRow } from "../../styles/notifications"; import React from "react"; -import ToggleButton from "react-bootstrap/ToggleButton"; +import Toggle from "react-toggle"; type Props = { currentUser: IUser; @@ -13,10 +14,12 @@ type Props = { }; function Settings({ currentUser = {} as IUser, onSave }: Props) { - const notificationSettings = currentUser.notificationSettings || { - receiveByEmail: false, - receiveBySms: false, - }; + const notificationSettings = currentUser + ? currentUser.notificationSettings + : { + receiveByEmail: false, + receiveBySms: false, + }; const [receiveByEmail, setReceiveByEmail] = React.useState( notificationSettings.receiveByEmail @@ -37,31 +40,28 @@ function Settings({ currentUser = {} as IUser, onSave }: Props) { User Settings {"Notification settings"} - - setReceiveByEmail(e.currentTarget.checked)} - color="white" - > - {" Receive by mail"} - - - setreceiveBySms(e.currentTarget.checked)} - color="white" - > - {" Receive by SMS"} - - + +

Receive notification by email

+
+ setReceiveByEmail(!receiveByEmail)} + /> + {receiveByEmail ? "On" : "Off"} +
+
+ +

Receive notification by SMS

+
+ setreceiveBySms(!receiveBySms)} + /> + {receiveBySms ? "On" : "Off"} +
+