mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 15:52:40 +02:00
chore: ran linting
This commit is contained in:
parent
5ebb9d7aea
commit
43e50e90df
3 changed files with 55 additions and 29 deletions
|
|
@ -144,10 +144,7 @@ export function DocumentsTableShell({
|
||||||
Get started by uploading your first document.
|
Get started by uploading your first document.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button onClick={openDialog} className="mt-2">
|
||||||
onClick={openDialog}
|
|
||||||
className="mt-2"
|
|
||||||
>
|
|
||||||
<Plus className="mr-2 h-4 w-4" />
|
<Plus className="mr-2 h-4 w-4" />
|
||||||
Upload Documents
|
Upload Documents
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import { type FC, createContext, useContext, useState, useCallback, useRef, type ReactNode } from "react";
|
import {
|
||||||
|
type FC,
|
||||||
|
createContext,
|
||||||
|
useContext,
|
||||||
|
useState,
|
||||||
|
useCallback,
|
||||||
|
useRef,
|
||||||
|
type ReactNode,
|
||||||
|
} from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
|
import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
|
||||||
import { Dialog, DialogContent } from "@/components/ui/dialog";
|
import { Dialog, DialogContent } from "@/components/ui/dialog";
|
||||||
|
|
@ -45,7 +53,8 @@ export const DocumentUploadDialogProvider: FC<{ children: ReactNode }> = ({ chil
|
||||||
}, 300);
|
}, 300);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleOpenChange = useCallback((open: boolean) => {
|
const handleOpenChange = useCallback(
|
||||||
|
(open: boolean) => {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
// Only close if not already in closing state
|
// Only close if not already in closing state
|
||||||
if (!isClosingRef.current) {
|
if (!isClosingRef.current) {
|
||||||
|
|
@ -57,7 +66,9 @@ export const DocumentUploadDialogProvider: FC<{ children: ReactNode }> = ({ chil
|
||||||
setIsOpen(true);
|
setIsOpen(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [closeDialog]);
|
},
|
||||||
|
[closeDialog]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocumentUploadDialogContext.Provider value={{ openDialog, closeDialog }}>
|
<DocumentUploadDialogContext.Provider value={{ openDialog, closeDialog }}>
|
||||||
|
|
@ -98,4 +109,3 @@ const DocumentUploadPopupContent: FC<{
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,12 @@ import { useCallback, useMemo, useState, useRef } from "react";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { uploadDocumentMutationAtom } from "@/atoms/documents/document-mutation.atoms";
|
import { uploadDocumentMutationAtom } from "@/atoms/documents/document-mutation.atoms";
|
||||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
|
import {
|
||||||
|
Accordion,
|
||||||
|
AccordionContent,
|
||||||
|
AccordionItem,
|
||||||
|
AccordionTrigger,
|
||||||
|
} from "@/components/ui/accordion";
|
||||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
@ -262,7 +267,13 @@ export function DocumentUploadTab({ searchSpaceId, onSuccess }: DocumentUploadTa
|
||||||
{t("total_size")}: {formatFileSize(totalFileSize)}
|
{t("total_size")}: {formatFileSize(totalFileSize)}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="outline" size="sm" className="text-xs sm:text-sm shrink-0" onClick={() => setFiles([])} disabled={isUploading}>
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
className="text-xs sm:text-sm shrink-0"
|
||||||
|
onClick={() => setFiles([])}
|
||||||
|
disabled={isUploading}
|
||||||
|
>
|
||||||
{t("clear_all")}
|
{t("clear_all")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -352,14 +363,22 @@ export function DocumentUploadTab({ searchSpaceId, onSuccess }: DocumentUploadTa
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
|
||||||
<Accordion type="single" collapsible className={`w-full ${cardClass} border border-border rounded-lg`}>
|
<Accordion
|
||||||
|
type="single"
|
||||||
|
collapsible
|
||||||
|
className={`w-full ${cardClass} border border-border rounded-lg`}
|
||||||
|
>
|
||||||
<AccordionItem value="supported-file-types" className="border-0">
|
<AccordionItem value="supported-file-types" className="border-0">
|
||||||
<AccordionTrigger className="px-3 sm:px-6 py-3 sm:py-4 hover:no-underline">
|
<AccordionTrigger className="px-3 sm:px-6 py-3 sm:py-4 hover:no-underline">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Tag className="h-4 w-4 sm:h-5 sm:w-5 shrink-0" />
|
<Tag className="h-4 w-4 sm:h-5 sm:w-5 shrink-0" />
|
||||||
<div className="text-left min-w-0">
|
<div className="text-left min-w-0">
|
||||||
<div className="font-semibold text-sm sm:text-base">{t("supported_file_types")}</div>
|
<div className="font-semibold text-sm sm:text-base">
|
||||||
<div className="text-xs sm:text-sm text-muted-foreground font-normal">{t("file_types_desc")}</div>
|
{t("supported_file_types")}
|
||||||
|
</div>
|
||||||
|
<div className="text-xs sm:text-sm text-muted-foreground font-normal">
|
||||||
|
{t("file_types_desc")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue