Skip to content

Commit

Permalink
fix: consolidate some props
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jan 8, 2024
1 parent 8558cbf commit 5bfa309
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
7 changes: 3 additions & 4 deletions src/components/Interpretations/InterpretationModal/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ const Comment = ({
onThreadUpdated,
canComment,
fetching,
setRemoveInProgress,
setUpdateInProgress,
setCommentActionInProgress,

Check failure on line 21 in src/components/Interpretations/InterpretationModal/Comment.js

View workflow job for this annotation

GitHub Actions / unit

'setCommentActionInProgress' is missing in props validation
}) => {
const [isUpdateMode, setIsUpdateMode] = useState(false)

Expand All @@ -34,7 +33,7 @@ const Comment = ({
text={comment.text}
currentUser={currentUser}
fetching={fetching}
setUpdateInProgress={setUpdateInProgress}
setUpdateInProgress={setCommentActionInProgress}
/>
) : (
<Message
Expand All @@ -56,7 +55,7 @@ const Comment = ({
interpretationId={interpretationId}
onComplete={() => onThreadUpdated(true)}
fetching={fetching}
setRemoveInProgress={setRemoveInProgress}
setRemoveInProgress={setCommentActionInProgress}
/>
)}
</MessageStatsBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const CommentAddForm = ({ currentUser, focusRef, fetching, save }) => {
primary
small
onClick={saveComment}
loading={fetching}
disabled={fetching}
>
{i18n.t('Post reply')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const CommentUpdateForm = ({
/>
<MessageButtonStrip>
<Button
loading={isDisabled}
disabled={isDisabled}
primary
small
onClick={updateComment}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ const InterpretationThread = ({
initialFocus,
onThreadUpdated,
downloadMenuComponent: DownloadMenu,
fetchingComplete,
}) => {
const [removeInProgress, setRemoveInProgress] = useState(false)
const [updateInProgress, setUpdateInProgress] = useState(false)
const [commentActionInProgress, setCommentActionInProgress] =
useState(false)

const { toggleLike, isLikedByCurrentUser, toggleLikeInProgress } = useLike({
interpretation,
Expand Down Expand Up @@ -66,11 +65,9 @@ const InterpretationThread = ({
return (
<div className="container">
{fetching ||
!fetchingComplete ||
toggleLikeInProgress ||
loadingNewComment ||
removeInProgress ||
updateInProgress ? (
commentActionInProgress ? (
<Cover>
<CenteredContent>
<CircularLoader />
Expand Down Expand Up @@ -108,14 +105,10 @@ const InterpretationThread = ({
interpretationId={interpretation.id}
onThreadUpdated={onThreadUpdated}
canComment={interpretationAccess.comment}
fetching={
fetching ||
!fetchingComplete ||
removeInProgress ||
updateInProgress
fetching={fetching || commentActionInProgress}
setCommentActionInProgress={
setCommentActionInProgress
}
setRemoveInProgress={setRemoveInProgress}
setUpdateInProgress={setUpdateInProgress}
/>
))}
</div>
Expand All @@ -125,7 +118,9 @@ const InterpretationThread = ({
currentUser={currentUser}
interpretationId={interpretation.id}
focusRef={focusRef}
fetching={fetching || loadingNewComment}
fetching={
fetching || loadingNewComment || commentActionInProgress
}
save={save}
/>
)}
Expand Down Expand Up @@ -178,7 +173,6 @@ const InterpretationThread = ({
InterpretationThread.propTypes = {
currentUser: PropTypes.object.isRequired,
fetching: PropTypes.bool.isRequired,
fetchingComplete: PropTypes.bool.isRequired,
interpretation: PropTypes.object.isRequired,
onInterpretationDeleted: PropTypes.func.isRequired,
downloadMenuComponent: PropTypes.oneOfType([
Expand Down

0 comments on commit 5bfa309

Please sign in to comment.