Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations refactor #1044

Merged
merged 3 commits into from
Feb 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add submitting state to CommentInput
jakubfiala committed Feb 21, 2025
commit a1ee40aff64f5dbe0a8783096eed0086482b39c2
5 changes: 5 additions & 0 deletions src/components/CommentInput/CommentInput.jsx
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ const CommentInput = ({
const [files, setFiles] = useState(initFiles)
const [filesUploading, setFilesUploading] = useState([])
const [isDropping, setIsDropping] = useState(false)
const [isSubmitting, setIsSubmitting] = useState(false)

const { annotations, removeAnnotation, goToAnnotation } = useAnnotationsSync({
entityId: entities[0]?.id,
@@ -442,6 +443,7 @@ const CommentInput = ({

const handleSubmit = async () => {
try {
setIsSubmitting(true);
// upload any annotations first
let annotationFiles = []
if (annotations.length) {
@@ -470,6 +472,8 @@ const CommentInput = ({
} catch (error) {
console.error(error)
toast.error('Something went wrong')
} finally {
setIsSubmitting(false);
}
}

@@ -559,6 +563,7 @@ const CommentInput = ({
isDropping,
disabled,
isLoading,
isSubmitting,
})}
onKeyDown={handleKeyDown}
onClick={handleOpenClick}
7 changes: 6 additions & 1 deletion src/components/CommentInput/CommentInput.styled.js
Original file line number Diff line number Diff line change
@@ -253,12 +253,17 @@ export const Comment = styled.div`
background-color: var(--md-sys-color-surface-container-lowest);
}
&.isLoading {
&.isLoading,
&.isSubmitting {
cursor: default;
pointer-events: none;
user-select: none;
}
&.isSubmitting {
opacity: 0.3;
}
/* toolbar styles */
.ql-toolbar.ql-snow {
border: none;