@@ -77,7 +89,9 @@ export default function DocumentSidebar({
async function loadDriveStatus() {
try {
- const data = await api.get<{ connected: boolean }>("/api/v1/auth/google-drive/status");
+ const data = await api.get<{ connected: boolean }>(
+ "/api/v1/auth/google-drive/status",
+ );
if (!cancelled) setDriveConnected(data.connected);
} catch {
if (!cancelled) setDriveError("Unable to load Google Drive status");
@@ -106,15 +120,18 @@ export default function DocumentSidebar({
const file = acceptedFiles[i];
const formData = new FormData();
formData.append("file", file);
-
+
toast.info(`⏳ Uploading '${file.name}'...`);
await api.postForm("/api/v1/documents/upload", formData);
setUploadProgress(((i + 1) / acceptedFiles.length) * 100);
- toast.success(`📤 '${file.name}' uploaded successfully! Ingestion started.`);
+ toast.success(
+ `📤 '${file.name}' uploaded successfully! Ingestion started.`,
+ );
}
await onDocumentsChange();
} catch (err) {
- const message = err instanceof Error ? err.message : t("documents.uploadFailed");
+ const message =
+ err instanceof Error ? err.message : t("documents.uploadFailed");
setUploadError(message);
toast.error(`❌ Upload failed: ${message}`);
} finally {
@@ -123,14 +140,15 @@ export default function DocumentSidebar({
}
})();
},
- [onDocumentsChange, t]
+ [onDocumentsChange, t],
);
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop,
accept: {
"application/pdf": [".pdf"],
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
+ [".docx"],
"text/plain": [".txt"],
"text/markdown": [".md"],
},
@@ -153,7 +171,7 @@ export default function DocumentSidebar({
const handleSettingsClick = (doc: DocInfo, e: React.MouseEvent) => {
e.stopPropagation(); // Prevent triggering document selection
- setSettingsDoc(doc);
+ setSettingsDoc(doc);
};
const startRename = (doc: DocInfo, e?: React.MouseEvent) => {
@@ -198,7 +216,10 @@ export default function DocumentSidebar({
}
};
- const handleRenameKeyDown = (doc: DocInfo, e: React.KeyboardEvent
) => {
+ const handleRenameKeyDown = (
+ doc: DocInfo,
+ e: React.KeyboardEvent,
+ ) => {
if (e.key === "Enter") {
e.preventDefault();
void submitRename(doc);
@@ -221,10 +242,14 @@ export default function DocumentSidebar({
setDriveError("");
try {
- const data = await api.get<{ auth_url: string }>("/api/v1/auth/google-drive/connect");
+ const data = await api.get<{ auth_url: string }>(
+ "/api/v1/auth/google-drive/connect",
+ );
window.location.assign(data.auth_url);
} catch (err) {
- setDriveError(err instanceof Error ? err.message : "Failed to connect Google Drive");
+ setDriveError(
+ err instanceof Error ? err.message : "Failed to connect Google Drive",
+ );
setDriveConnecting(false);
}
};
@@ -234,16 +259,21 @@ export default function DocumentSidebar({
setDriveError("");
try {
- const data = await api.delete<{ connected: boolean }>("/api/v1/auth/google-drive/disconnect");
+ const data = await api.delete<{ connected: boolean }>(
+ "/api/v1/auth/google-drive/disconnect",
+ );
setDriveConnected(data.connected);
} catch (err) {
- setDriveError(err instanceof Error ? err.message : "Failed to disconnect Google Drive");
+ setDriveError(
+ err instanceof Error
+ ? err.message
+ : "Failed to disconnect Google Drive",
+ );
} finally {
setDriveConnecting(false);
}
};
-
const statusIcon = (status: string) => {
switch (status) {
case "ready":
@@ -285,14 +315,25 @@ export default function DocumentSidebar({
{uploading ? (
-
{t("documents.uploading")}
+
+ {t("documents.uploading")}
+
) : (
<>
-
-
- {isDragActive ? t("documents.dropHere") : t("documents.dropOrClick")}
+ {isDragActive ? (
+
+ ) : (
+
+ )}
+
+ {isDragActive
+ ? t("documents.dropHere")
+ : t("documents.dropOrClick")}
{t("documents.uploadFormats")}
@@ -307,7 +348,9 @@ export default function DocumentSidebar({
Google Drive
- {driveConnected ? "Connected for PDF sync" : "Connect to import PDFs"}
+ {driveConnected
+ ? "Connected for PDF sync"
+ : "Connect to import PDFs"}
@@ -320,7 +363,9 @@ export default function DocumentSidebar({
variant={driveConnected ? "outline" : "secondary"}
size="sm"
className="w-full"
- onClick={driveConnected ? handleDisconnectDrive : handleConnectDrive}
+ onClick={
+ driveConnected ? handleDisconnectDrive : handleConnectDrive
+ }
disabled={driveLoading || driveConnecting}
>
{driveConnecting || driveLoading ? (
@@ -328,7 +373,9 @@ export default function DocumentSidebar({
) : (
)}
- {driveConnected ? "Disconnect Google Drive" : "Connect Google Drive"}
+ {driveConnected
+ ? "Disconnect Google Drive"
+ : "Connect Google Drive"}