diff --git a/frontend/src/components/onedrive-picker.tsx b/frontend/src/components/onedrive-picker.tsx
index 739491c1..20eeeac7 100644
--- a/frontend/src/components/onedrive-picker.tsx
+++ b/frontend/src/components/onedrive-picker.tsx
@@ -3,7 +3,8 @@
import { useState, useEffect } from "react"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
-import { FileText, Folder, Trash2, X } from "lucide-react"
+import { Card, CardContent } from "@/components/ui/card"
+import { FileText, Folder, Plus, Trash2, ArrowLeft } from "lucide-react"
interface OneDrivePickerProps {
onFileSelected: (files: OneDriveFile[]) => void
@@ -29,16 +30,6 @@ interface GraphResponse {
value: OneDriveFile[]
}
-declare global {
- interface Window {
- mgt?: {
- Providers?: {
- globalProvider?: unknown
- }
- }
- }
-}
-
export function OneDrivePicker({
onFileSelected,
selectedFiles = [],
@@ -56,25 +47,6 @@ export function OneDrivePicker({
const [breadcrumbs, setBreadcrumbs] = useState<{id: string, name: string}[]>([
{id: 'root', name: connectorType === "sharepoint" ? 'SharePoint' : 'OneDrive'}
])
-
- useEffect(() => {
- const loadMGT = async () => {
- if (typeof window !== 'undefined' && !window.mgt) {
- try {
- await import('@microsoft/mgt-components')
- await import('@microsoft/mgt-msal2-provider')
-
- // For simplicity, we'll use direct Graph API calls instead of MGT components
- // MGT provider initialization would go here if needed
- } catch {
- console.warn('MGT not available, falling back to direct API calls')
- }
- }
- }
-
- loadMGT()
- }, [accessToken])
-
const fetchFiles = async (path: string = currentPath) => {
if (!accessToken) return
@@ -137,17 +109,20 @@ export function OneDrivePicker({
}
}
- const navigateToBreadcrumb = (index: number) => {
- if (index === 0) {
- setCurrentPath('me/drive/root/children')
- setBreadcrumbs([{id: 'root', name: 'OneDrive'}])
- fetchFiles('me/drive/root/children')
- } else {
- const targetCrumb = breadcrumbs[index]
- const newPath = `me/drive/items/${targetCrumb.id}/children`
- setCurrentPath(newPath)
- setBreadcrumbs(breadcrumbs.slice(0, index + 1))
- fetchFiles(newPath)
+ const navigateBack = () => {
+ if (breadcrumbs.length > 1) {
+ const newBreadcrumbs = breadcrumbs.slice(0, -1)
+ setBreadcrumbs(newBreadcrumbs)
+
+ if (newBreadcrumbs.length === 1) {
+ setCurrentPath('me/drive/root/children')
+ fetchFiles('me/drive/root/children')
+ } else {
+ const parentCrumb = newBreadcrumbs[newBreadcrumbs.length - 1]
+ const newPath = `me/drive/items/${parentCrumb.id}/children`
+ setCurrentPath(newPath)
+ fetchFiles(newPath)
+ }
}
}
@@ -158,9 +133,9 @@ export function OneDrivePicker({
const getFileIcon = (file: OneDriveFile) => {
if (file.driveItem?.folder) {
- return
+ Please connect to {serviceName} first to select specific files. +
++ Access token unavailable +
++ Try disconnecting and reconnecting your {serviceName} account. +
+- Choose specific files to sync instead of syncing everything -
-+ Select files from {serviceName} to ingest. +
+ +- Selected files ({selectedFiles.length}): -
-+ Added files +
+