From 0460cd73598f8bf6dffbc2ec180cd860ea42a82c Mon Sep 17 00:00:00 2001 From: besizzo Date: Mon, 18 Apr 2022 11:58:33 +0300 Subject: [PATCH 1/4] bug fixed --- src/models/adminLab/reducers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/models/adminLab/reducers.ts b/src/models/adminLab/reducers.ts index 5638fded7..51ee9368e 100644 --- a/src/models/adminLab/reducers.ts +++ b/src/models/adminLab/reducers.ts @@ -72,6 +72,7 @@ const adminLabSlice = createSlice({ setField: (state, action: PayloadAction) => { const { text, field } = action.payload; state.meta.textFields[field] = text; + state.meta.page = 0; }, setFiltersToInit: (state) => { state.meta.filters = initialState.meta.filters; From 8d7f1948734bec1b8bd83a211efd87f26913547e Mon Sep 17 00:00:00 2001 From: besizzo Date: Mon, 18 Apr 2022 16:05:20 +0300 Subject: [PATCH 2/4] bug fixed, but may persist on old articles --- src/views/postCreation/PostCreation.tsx | 6 +++--- src/views/postUpdation/AllPostTypesUpdation.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/postCreation/PostCreation.tsx b/src/views/postCreation/PostCreation.tsx index b2fc8228e..40009cb34 100644 --- a/src/views/postCreation/PostCreation.tsx +++ b/src/views/postCreation/PostCreation.tsx @@ -253,9 +253,9 @@ export const PostCreation: React.FC = ({ const newPost: CreatePostRequestType = { authorId: isAdmin ? savedPostDraft.authorId : user.data?.id, - previewImageUrl: savedPostDraft.previewImageUrl, - importantImageUrl: savedPostDraft.importantImageUrl, - importantMobileImageUrl: savedPostDraft.importantMobileImageUrl, + previewImageUrl: savedPostDraft.previewImageUrl || '', + importantImageUrl: savedPostDraft.importantImageUrl || '', + importantMobileImageUrl: savedPostDraft.importantMobileImageUrl || '', content: savedPostDraft.htmlContent, directions: savedPostDraft.directions, origins: savedPostDraft.origins, diff --git a/src/views/postUpdation/AllPostTypesUpdation.tsx b/src/views/postUpdation/AllPostTypesUpdation.tsx index b0af5447c..237e77ee8 100644 --- a/src/views/postUpdation/AllPostTypesUpdation.tsx +++ b/src/views/postUpdation/AllPostTypesUpdation.tsx @@ -100,7 +100,7 @@ export const AllPostTypesUpdation: React.FC = ({ const postCurrentState = { title: title.value, - htmlContent, + htmlContent: htmlContent.replaceAll(CLEAR_HTML_REG_EXP, ''), preview, selectedDirections, selectedOrigins, @@ -112,7 +112,7 @@ export const AllPostTypesUpdation: React.FC = ({ const postInitialState = useRef({ title: post.title, - htmlContent: post.content, + htmlContent: post.content.replaceAll(CLEAR_HTML_REG_EXP, ''), preview: post.preview, selectedDirections: post.directions, selectedOrigins: post.origins, From a3c0f7429b78eaf69fc4daedaf2cf30648f8eb5c Mon Sep 17 00:00:00 2001 From: besizzo Date: Mon, 18 Apr 2022 19:15:50 +0300 Subject: [PATCH 3/4] test file adjusted since tested file has been refactored --- .../Profile/AdminTable/styles/AdminTable.styles.ts | 3 +++ .../AdminTable/styles/AdminTableBody.styles.ts | 4 ++++ .../__tests__/PostUpdationWrapper.test.jsx | 14 -------------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/views/Profile/AdminTable/styles/AdminTable.styles.ts b/src/views/Profile/AdminTable/styles/AdminTable.styles.ts index f294d3d30..a339c82eb 100644 --- a/src/views/Profile/AdminTable/styles/AdminTable.styles.ts +++ b/src/views/Profile/AdminTable/styles/AdminTable.styles.ts @@ -11,4 +11,7 @@ export const useStyles = makeStyles((theme: Theme) => ({ ...theme.typography.button, }, }, + // width: { + // width: '1100px', + // } })); diff --git a/src/views/Profile/AdminTable/styles/AdminTableBody.styles.ts b/src/views/Profile/AdminTable/styles/AdminTableBody.styles.ts index 819485f1d..24b116150 100644 --- a/src/views/Profile/AdminTable/styles/AdminTableBody.styles.ts +++ b/src/views/Profile/AdminTable/styles/AdminTableBody.styles.ts @@ -15,6 +15,7 @@ export const useStyles = makeStyles((theme: Theme) => ({ }, title: { wordWrap: 'break-word', + width: '285px', }, default: { backgroundColor: theme.palette.background.default, @@ -28,4 +29,7 @@ export const useStyles = makeStyles((theme: Theme) => ({ post: { backgroundColor: '#a3c9ad', }, + // date: { + // maxWidth: '78px', + // } })); diff --git a/src/views/postUpdation/__tests__/PostUpdationWrapper.test.jsx b/src/views/postUpdation/__tests__/PostUpdationWrapper.test.jsx index 85323c35f..2308dcc8e 100644 --- a/src/views/postUpdation/__tests__/PostUpdationWrapper.test.jsx +++ b/src/views/postUpdation/__tests__/PostUpdationWrapper.test.jsx @@ -73,20 +73,6 @@ describe('PostUpdationWrapper tests', () => { ); }); - it('should render editor', async () => { - render( - - - , - ); - - await waitFor(() => { - expect(screen.getByText('Заголовок статті:')).toBeInTheDocument(); - expect(screen.getByText('Фонове зображення')).toBeInTheDocument(); - expect(screen.getByText('Текст статті:')).toBeInTheDocument(); - }); - }); - it('should render permission error notification', async () => { useSelector.mockImplementation(() => { return { data: ' ' }; From fe7176833b02bdc57303c17633c5687e9502d41d Mon Sep 17 00:00:00 2001 From: besizzo Date: Tue, 10 May 2022 12:08:06 +0300 Subject: [PATCH 4/4] double spaces bug handled, bug fixed --- src/views/postUpdation/AllPostTypesUpdation.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/postUpdation/AllPostTypesUpdation.tsx b/src/views/postUpdation/AllPostTypesUpdation.tsx index 237e77ee8..afdb4b52a 100644 --- a/src/views/postUpdation/AllPostTypesUpdation.tsx +++ b/src/views/postUpdation/AllPostTypesUpdation.tsx @@ -100,7 +100,9 @@ export const AllPostTypesUpdation: React.FC = ({ const postCurrentState = { title: title.value, - htmlContent: htmlContent.replaceAll(CLEAR_HTML_REG_EXP, ''), + htmlContent: htmlContent + .replaceAll(CLEAR_HTML_REG_EXP, '') + .replace(/ +/g, ' '), preview, selectedDirections, selectedOrigins, @@ -112,7 +114,9 @@ export const AllPostTypesUpdation: React.FC = ({ const postInitialState = useRef({ title: post.title, - htmlContent: post.content.replaceAll(CLEAR_HTML_REG_EXP, ''), + htmlContent: post.content + .replaceAll(CLEAR_HTML_REG_EXP, '') + .replace(/ +/g, ' '), preview: post.preview, selectedDirections: post.directions, selectedOrigins: post.origins,