Skip to content

Commit

Permalink
fix(frontend): upload knwoledge in brains manegement (#2131)
Browse files Browse the repository at this point in the history
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
Zewed authored and StanGirard committed Feb 5, 2024
1 parent 5b9f07e commit 0d8bcc1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/lib/hooks/useDropzone.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { usePathname } from "next/navigation";
import { FileRejection, useDropzone } from "react-dropzone";
import { useTranslation } from "react-i18next";

Expand All @@ -18,6 +19,7 @@ export const useCustomDropzone = () => {
useKnowledgeToFeedContext();
const { isOnboarding } = useOnboarding();
const { trackOnboardingEvent } = useOnboardingTracker();
const pathname = usePathname();

const files: File[] = (
knowledgeToFeed.filter((c) => c.source === "upload") as FeedItemUploadType[]
Expand All @@ -29,7 +31,9 @@ export const useCustomDropzone = () => {
const { t } = useTranslation(["upload"]);

const onDrop = (acceptedFiles: File[], fileRejections: FileRejection[]) => {
setShouldDisplayFeedCard(true);
if (pathname && !pathname.includes("brains-management")) {
setShouldDisplayFeedCard(true);
}
if (fileRejections.length > 0) {
const firstRejection = fileRejections[0];

Expand Down

0 comments on commit 0d8bcc1

Please sign in to comment.