Skip to content

Commit

Permalink
Merge branch 'develop' into feat/multiplepatch
Browse files Browse the repository at this point in the history
  • Loading branch information
duplixx authored Jan 17, 2024
2 parents a7e0ad7 + 5e4b1e1 commit bd552a8
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
"sortPost": "Sort Post",
"tag": " Your browser does not support the video tag",
"postCreatedSuccess": "Congratulations! You have Posted Something."
"pinPost": "Pin post"
},
"postNotFound": {
"post": "Post",
Expand Down
1 change: 1 addition & 0 deletions public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"sortPost": "Trier les publications",
"tag": "Votre navigateur ne prend pas en charge la balise vidéo",
"postCreatedSuccess": "Félicitations ! Vous avez publié quelque chose."
"pinPost": "Épingler le message"
},
"postNotFound": {
"post": "Poste",
Expand Down
1 change: 1 addition & 0 deletions public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"sortPost": "पोस्ट को क्रमित करें",
"tag": "आपका ब्राउज़र वीडियो टैग का समर्थन नहीं करता",
"postCreatedSuccess": "बधाई हो! आपने कुछ पोस्ट किया है।"
"pinPost": "पोस्ट को पिन करें"
},
"postNotFound": {
"post": "पोस्ट",
Expand Down
1 change: 1 addition & 0 deletions public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"sortPost": "Ordenar Publicaciones",
"tag": "Su navegador no admite la etiqueta de video",
"postCreatedSuccess": "¡Felicidades! Has publicado algo."
"pinPost": "Fijar publicación"
},
"postNotFound": {
"post": "Publicaciones",
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"sortPost": "排序帖子",
"tag": "您的浏览器不支持视频标签",
"postCreatedSuccess": "恭喜!您已经发布了一些内容。"
"pinPost": "针柱"
},
"postNotFound": {
"post": "郵政",
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Mutations/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export const CREATE_POST_MUTATION = gql`
$videoUrl: URL
$organizationId: ID!
$file: String
$pinned: Boolean
) {
createPost(
data: {
Expand All @@ -303,6 +304,7 @@ export const CREATE_POST_MUTATION = gql`
imageUrl: $imageUrl
videoUrl: $videoUrl
organizationId: $organizationId
pinned: $pinned
}
file: $file
) {
Expand Down
10 changes: 10 additions & 0 deletions src/screens/OrgPost/OrgPost.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ describe('Organisation Post Page', () => {
userEvent.type(screen.getByTestId('modalinfo'), formData.postinfo);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postImage);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postVideo);
userEvent.upload(
screen.getByTestId('organisationImage'),
formData.postImage
);
userEvent.upload(
screen.getByTestId('organisationImage'),
formData.postVideo
);
userEvent.click(screen.getByTestId('pinPost'));
expect(screen.getByTestId('pinPost')).toBeChecked();

userEvent.click(screen.getByTestId('createPostBtn'));

Expand Down
20 changes: 20 additions & 0 deletions src/screens/OrgPost/OrgPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function orgPost(): JSX.Element {
postImage: '',
postVideo: '',
addMedia: '',
pinPost: false,
});
const [sortingOption, setSortingOption] = useState('latest');
const [file, setFile] = useState<File | null>(null);
Expand All @@ -63,6 +64,7 @@ function orgPost(): JSX.Element {
postImage: '',
postVideo: '',
addMedia: '',
pinPost: false,
});
};

Expand Down Expand Up @@ -98,6 +100,7 @@ function orgPost(): JSX.Element {
postinfo: _postinfo,
postImage,
postVideo,
pinPost,
} = postformState;

const posttitle = _posttitle.trim();
Expand All @@ -114,6 +117,7 @@ function orgPost(): JSX.Element {
text: postinfo,
organizationId: currentUrl,
file: postImage || postVideo || postformState.addMedia,
pinned: pinPost,
},
});

Expand All @@ -127,6 +131,7 @@ function orgPost(): JSX.Element {
postImage: '',
postVideo: '',
addMedia: '',
pinPost: false,
});
setPostModalIsOpen(false);
}
Expand Down Expand Up @@ -441,6 +446,21 @@ function orgPost(): JSX.Element {
</button>
</div>
)}
<Form.Label htmlFor="pinpost" className="mt-3">
{t('pinPost')}
</Form.Label>
<Form.Switch
id="pinPost"
type="checkbox"
data-testid="pinPost"
defaultChecked={postformState.pinPost}
onChange={(): void =>
setPostFormState({
...postformState,
pinPost: !postformState.pinPost,
})
}
/>
</Modal.Body>

<Modal.Footer>
Expand Down

0 comments on commit bd552a8

Please sign in to comment.