Skip to content

Commit

Permalink
Merge branch 'release' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
NabokinAlexandr authored Aug 20, 2021
2 parents 7da86c6 + 587616c commit bc6cd28
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 57 deletions.
6 changes: 5 additions & 1 deletion src/components/Header/AccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
StyledMenu,
StyledMenuItem,
} from '../../old/lib/components/Menu/StyledMenu';
import { signOutAction, getUserAsyncAction , selectCurrentUser } from '../../models/user';
import {
signOutAction,
getUserAsyncAction,
selectCurrentUser,
} from '../../models/user';
import { useActions } from '../../shared/hooks';
import { AuthContext } from '../../old/provider/AuthProvider/AuthContext';
import { AccountIcon } from '../../old/lib/components/icons/AccountIcon';
Expand Down
8 changes: 7 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ export const Header: React.FC = () => {
</Box>
<Box className={classes.actionsContainer}>
{authenticated && <PostCreationMenu />}
{authenticated ? <AccountMenu /> : <Route path='/opendoctorgate' ><LoginModal/></Route>}
{authenticated ? (
<AccountMenu />
) : (
<Route path="/opendoctorgate">
<LoginModal />
</Route>
)}
</Box>
</Toolbar>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const ExpertOpinionPostPreviewCard: React.FC<IPostPreviewCardProps> = ({
const expertLink = `/experts/${post.author?.id}`;
const postLink = `/posts/${post.id}`;
const authorFullName = `${post.author?.firstName} ${post.author?.lastName}`;

const expertOrigin = (
<Typography
className={classes.postType}
Expand Down
8 changes: 4 additions & 4 deletions src/locales/uk/parts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const common = {
post: 'Допис',
yes: 'Так',
no: 'Ні',
close:'Закрити',
close: 'Закрити',
post_1: 'Дописи',
post_2: 'Дописи',
cancel: 'Скасувати',
create: 'Створити',
add: 'Додати',
error404: 'Помилка 404',
error404Message:'На жаль, таку сторінку не знайдено.',
error404Message: 'На жаль, таку сторінку не знайдено.',
byType: 'За типом',
byOrigin: 'За джерелом',
allOrigins: 'Всі джерела',
Expand Down Expand Up @@ -58,6 +58,6 @@ export const common = {
preview: 'Перегляд',
noInfo: 'На жаль, даних, що відповідають вашому запиту, не знайдено.',
goBackToMain: 'Повернутися на головну',
permissionError:'На жаль, Ви не можете редагувати цей пост',
noFoundAuthors:'Такого автора не знайдено',
permissionError: 'На жаль, Ви не можете редагувати цей пост',
noFoundAuthors: 'Такого автора не знайдено',
};
8 changes: 4 additions & 4 deletions src/locales/uk/parts/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const editor = {
addImgFromPC: 'Завантажити зображення із комп`ютера',
addImgFromExternalResource:
'Додати посилання на зображення із зовнішнього ресурсу',
requiredField:'Заповніть, будь-ласка, обов`язкові поля, помічені зірочкою',
notEnoughLength:'Ви ввели недостатньо символів',
notUASymbols:'Введіть текст українською мовою',
noVideo:'Додайте, будь-ласка, відео',
requiredField: 'Заповніть, будь-ласка, обов`язкові поля, помічені зірочкою',
notEnoughLength: 'Ви ввели недостатньо символів',
notUASymbols: 'Введіть текст українською мовою',
noVideo: 'Додайте, будь-ласка, відео',
};
1 change: 0 additions & 1 deletion src/models/authorities/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export interface IAuthority {
loading: LoadingStatusEnum;
error: string | null;
}

Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ export const CheckboxDropdownFilterForm: React.FC<ICheckboxDropdownFilterFormPro
>
<Grid container>
<Grid item xs={2} style={{ marginRight: '-30px' }}>
<Typography className={isRequired ? classes.requiredField : undefined} variant="h5">
<Typography
className={isRequired ? classes.requiredField : undefined}
variant="h5"
>
{filterTitle}
</Typography>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const useStyles = makeStyles({

filtersWrapper: {
width: '280px',
marginTop : '0',
marginTop: '0',
},
filterTitle: {
fontFamily: 'Raleway',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ import { selectAuthorities } from '../../../../../../models/authorities';
const AdminPage: React.FC = () => {
const [selectedOption, changeOption] = useState<
IAdminMenuOption | Record<string, never>
>({});
>({});

const authorities = useSelector(selectAuthorities).data?.includes('SET_IMPORTANCE');
const authorities = useSelector(selectAuthorities).data?.includes(
'SET_IMPORTANCE',
);

return authorities ? (
<>
<Sidemenu selectedOption={selectedOption} changeOption={changeOption} />
<OperationView selectedOption={selectedOption} />
</>
) : <><Page404 /></>;
) : (
<>
<Page404 />
</>
);
};

export default AdminPage;
15 changes: 9 additions & 6 deletions src/old/lib/components/Users/LoginModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ export const LoginModal: React.FC = () => {
setAuthorization(response.data.accessToken);
boundAuthorities();
handleLoginClose();
swalWithCustomButton.fire(
t(langTokens.loginRegistration.congratulation),
t(langTokens.loginRegistration.youAreWelcome),
'success',
).then(()=>history.push('/'));
}).catch((err) => {
swalWithCustomButton
.fire(
t(langTokens.loginRegistration.congratulation),
t(langTokens.loginRegistration.youAreWelcome),
'success',
)
.then(() => history.push('/'));
})
.catch((err) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
setError(err.response.data.status);
});
Expand Down
2 changes: 1 addition & 1 deletion src/old/modules/posts/components/PostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PostView: React.FC<IPostViewProps> = ({
const user = useSelector(selectCurrentUser);
const authorities = useSelector(selectAuthorities);
const isAdmin = authorities.data?.includes('SET_IMPORTANCE');
const permission = user?.data?.id===post?.author?.id || isAdmin;
const permission = user?.data?.id === post?.author?.id || isAdmin;

const classes = useStyles();

Expand Down
6 changes: 2 additions & 4 deletions src/old/navigation/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const PrivateRoute: React.FC<IRouteConfig> = ({ path, exact, component }) => {
const user = useSelector(selectCurrentUser);
const { authenticated } = useContext(AuthContext);

if (
user.loading === LoadingStatusEnum.pending
) {
if (user.loading === LoadingStatusEnum.pending) {
return (
<Page
component={() => <LoadingContainer loading={user.loading} expand />}
Expand All @@ -31,7 +29,7 @@ const PrivateRoute: React.FC<IRouteConfig> = ({ path, exact, component }) => {
);
}

return <Redirect to='/error_404' />;
return <Redirect to="/error_404" />;
};

const AdminRoute: React.FC<IRouteConfig> = ({ path, exact, component }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState } from 'react';
import { Container, Box } from '@material-ui/core';
import i18n, { langTokens } from '../../locales/localizationInit';
import { Sidemenu } from './Sidemenu';
Expand Down
4 changes: 2 additions & 2 deletions src/views/postCreation/PostCreationButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { InformationModal } from '../../old/lib/components/Modals/InformationMod
interface IIsModal {
isEmpty: boolean;
isEnoughLength: boolean;
isVideoEmpty?:boolean;
isHasUASymbols?:boolean;
isVideoEmpty?: boolean;
isHasUASymbols?: boolean;
}

export interface IPostCreationButtonsProps {
Expand Down
2 changes: 1 addition & 1 deletion src/views/postCreation/RequiredFieldsStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useStyle = makeStyles(() => ({
fontSize: '27px',
},
},
requiredAuthorField:{
requiredAuthorField: {
'&::before': {
content: '"*"',
color: 'red',
Expand Down
4 changes: 1 addition & 3 deletions src/views/postCreation/TextPostCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ export const TextPostCreation: React.FC<IPostCreationProps> = ({
const isEnoughLength =
newPost.content.length < 15 || newPost.title.length < 10;

const isHasUASymbols = !regExp.test(
newPost.title
);
const isHasUASymbols = !regExp.test(newPost.title);

const previewPost = React.useMemo(
() =>
Expand Down
6 changes: 2 additions & 4 deletions src/views/postCreation/VideoCreation/VideoPostCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ export const VideoPostCreation: React.FC<IVideoPostCreationProps> = ({
const isEnoughLength =
newPost.content.length < 15 || newPost.title.length < 10;

const isHasUASymbols = !regExp.test(
newPost.title
);
const isHasUASymbols = !regExp.test(newPost.title);

const isVideoEmpty = !newPost.videoUrl;

Expand Down Expand Up @@ -393,7 +391,7 @@ export const VideoPostCreation: React.FC<IVideoPostCreationProps> = ({

<PostCreationButtons
action="creating"
isModal={{ isEmpty,isEnoughLength,isVideoEmpty, isHasUASymbols }}
isModal={{ isEmpty, isEnoughLength, isVideoEmpty, isHasUASymbols }}
onPublishClick={handlePublishClick}
onPreviewClick={() => {
setPreviewing(!previewing);
Expand Down
16 changes: 5 additions & 11 deletions src/views/postUpdation/PostUpdationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PostUpdationWrapper: React.FC = () => {
const isAdmin = authorities.data?.includes('SET_IMPORTANCE');

const { t } = useTranslation();

const [loadedPost, setLoadedPost] = useState<IPost>();
const [statusCode, setStatusCode] = useState<number>();

Expand Down Expand Up @@ -65,18 +65,12 @@ const PostUpdationWrapper: React.FC = () => {
{loadedPost &&
(user.data?.id === loadedPost?.author.id || isAdmin ? (
<>
{loadedPost.type.id === 1 && (
<ArticleUpdation post={loadedPost} />
)}
{loadedPost.type.id === 3 && (
<NoteUpdation post={loadedPost} />
)}
{loadedPost.type.id === 2 && (
<VideoUpdation post={loadedPost} />
)}
{loadedPost.type.id === 1 && <ArticleUpdation post={loadedPost} />}
{loadedPost.type.id === 3 && <NoteUpdation post={loadedPost} />}
{loadedPost.type.id === 2 && <VideoUpdation post={loadedPost} />}
</>
) : (
<Notification message={t(langTokens.common.permissionError)}/>
<Notification message={t(langTokens.common.permissionError)} />
))}
</>
);
Expand Down
4 changes: 1 addition & 3 deletions src/views/postUpdation/TextPostUpdation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ export const TextPostUpdation: React.FC<ITextPostUpdationProps> = ({
const isEnoughLength =
updatedPost.content.length < 15 || updatedPost.title.length < 10;

const isHasUASymbols = !regExp.test(
updatedPost.title
);
const isHasUASymbols = !regExp.test(updatedPost.title);

const previewPost: IPost = {
...post,
Expand Down
6 changes: 2 additions & 4 deletions src/views/postUpdation/VideoUpdation/VideoPostUpdation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ export const VideoPostUpdation: React.FC<ITextPostUpdationProps> = ({
const isEnoughLength =
updatedPost.content.length < 15 || updatedPost.title.length < 10;

const isHasUASymbols = !regExp.test(
updatedPost.title
);
const isHasUASymbols = !regExp.test(updatedPost.title);

const isVideoEmpty = !updatedPost.videoUrl;

Expand Down Expand Up @@ -255,7 +253,7 @@ export const VideoPostUpdation: React.FC<ITextPostUpdationProps> = ({

<PostCreationButtons
action="updating"
isModal={{ isEmpty,isEnoughLength,isVideoEmpty,isHasUASymbols }}
isModal={{ isEmpty, isEnoughLength, isVideoEmpty, isHasUASymbols }}
onCancelClick={() => {
history.goBack();
}}
Expand Down

0 comments on commit bc6cd28

Please sign in to comment.