Skip to content

Commit 8ec8ca1

Browse files
authored
Merge pull request #1310 from priya-tik/event-details-comments-dropdown-fix
Event details comments dropdown fix
2 parents d4ae5f0 + 94ee3a1 commit 8ec8ca1

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules
22
/build
3+
.idea/

src/components/events/partials/ModalTabsAndPages/EventDetailsCommentsTab.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useEffect } from "react";
1+
import React, { useState, useEffect } from "react";
22
import {
33
getComments,
44
getCommentReasons,
@@ -60,7 +60,7 @@ const EventDetailsCommentsTab = ({
6060
const user = useAppSelector(state => getUserInformation(state));
6161

6262
const saveComment = (commentText: string, commentReason: string) => {
63-
dispatch(saveNewComment({ eventId, commentText, commentReason })).then(successful => {
63+
dispatch(saveNewComment({eventId, commentText, commentReason})).then(successful => {
6464
if (successful) {
6565
dispatch(fetchComments(eventId));
6666
setNewCommentText("");
@@ -84,7 +84,7 @@ const EventDetailsCommentsTab = ({
8484
};
8585

8686
const saveReply = (originalComment: Comment, reply: string, isResolved: boolean) => {
87-
dispatch(saveNewCommentReply({ eventId, commentId: originalComment.id, replyText: reply, commentResolved: isResolved })).then(
87+
dispatch(saveNewCommentReply({eventId, commentId: originalComment.id, replyText: reply, commentResolved: isResolved})).then(
8888
success => {
8989
if (success) {
9090
dispatch(fetchComments(eventId));
@@ -95,15 +95,15 @@ const EventDetailsCommentsTab = ({
9595
};
9696

9797
const deleteComment = (comment: Comment) => {
98-
dispatch(deleteOneComment({ eventId, commentId: comment.id })).then(success => {
98+
dispatch(deleteOneComment({eventId, commentId: comment.id})).then(success => {
9999
if (success) {
100100
dispatch(fetchComments(eventId));
101101
}
102102
});
103103
};
104104

105105
const deleteReply = (comment: Comment, reply: CommentReply) => {
106-
dispatch(deleteCommentReply({ eventId, commentId: comment.id, replyId: reply.id })).then(success => {
106+
dispatch(deleteCommentReply({eventId, commentId: comment.id, replyId: reply.id})).then(success => {
107107
if (success) {
108108
dispatch(fetchComments(eventId));
109109
}
@@ -251,13 +251,13 @@ const EventDetailsCommentsTab = ({
251251
required={true}
252252
handleChange={element => {
253253
if (element) {
254-
setCommentReason(element.value);
254+
setCommentReason(element.value)
255255
}
256256
}}
257257
placeholder={t(
258258
"EVENTS.EVENTS.DETAILS.COMMENTS.SELECTPLACEHOLDER",
259259
)}
260-
customCSS={{ width: 200, optionPaddingTop: 5, optionLineHeight: "105%" }}
260+
customCSS={{width: 200, optionPaddingTop: 5, optionLineHeight: "105%"}}
261261
/>
262262
</div>
263263

@@ -363,7 +363,7 @@ const EventDetailsCommentsTab = ({
363363
originalComment,
364364
commentReplyText,
365365
commentReplyIsResolved,
366-
);
366+
)
367367
}
368368
}}
369369
>

src/components/shared/DropDown.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const DropDown = <T, >({
3333
creatable = false,
3434
disabled = false,
3535
menuIsOpen = undefined,
36+
menuPlacement = "auto",
3637
handleMenuIsOpen = undefined,
3738
customCSS,
3839
}: {
@@ -51,6 +52,7 @@ const DropDown = <T, >({
5152
disabled?: boolean,
5253
menuIsOpen?: boolean,
5354
handleMenuIsOpen?: (open: boolean) => void,
55+
menuPlacement?: 'auto' | 'top' | 'bottom',
5456
customCSS?: {
5557
isMetadataStyle?: boolean,
5658
width?: number | string,
@@ -75,14 +77,14 @@ const DropDown = <T, >({
7577
if (handleMenuIsOpen !== undefined) {
7678
handleMenuIsOpen(open);
7779
}
78-
};
80+
}
7981

8082
const formatOptions = (
8183
unformattedOptions: DropDownOption[],
8284
required: boolean,
8385
) => {
8486
// Translate?
85-
unformattedOptions = unformattedOptions.map(option => ({ ...option, label: t(option.label as ParseKeys) }));
87+
unformattedOptions = unformattedOptions.map(option => ({...option, label: t(option.label as ParseKeys)}));
8688

8789
// Add "No value" option
8890
if (!required) {
@@ -106,14 +108,14 @@ const DropDown = <T, >({
106108
unformattedOptions.sort((a, b) => JSON.parse(a.label).order - JSON.parse(b.label).order);
107109
} else {
108110
// Apply alphabetical ordering.
109-
unformattedOptions.sort((a, b) => a.label.localeCompare(b.label));
111+
unformattedOptions.sort((a, b) => a.label.localeCompare(b.label))
110112
}
111113

112114
return unformattedOptions;
113115
};
114116

115-
116117
const commonProps: Props = {
118+
menuPlacement: menuPlacement ?? 'auto',
117119
tabIndex: tabIndex,
118120
theme: theme => (dropDownSpacingTheme(theme)),
119121
styles: style,

0 commit comments

Comments
 (0)