updated header and cloud picker header
This commit is contained in:
parent
ac333b99d7
commit
11a6f0e8d4
2 changed files with 332 additions and 335 deletions
|
|
@ -36,7 +36,7 @@ export default function UploadProviderPage() {
|
|||
const [selectedFiles, setSelectedFiles] = useState<CloudFile[]>([]);
|
||||
const [isIngesting, setIsIngesting] = useState<boolean>(false);
|
||||
const [currentSyncTaskId, setCurrentSyncTaskId] = useState<string | null>(
|
||||
null,
|
||||
null
|
||||
);
|
||||
const [ingestSettings, setIngestSettings] = useState<IngestSettings>({
|
||||
chunkSize: 1000,
|
||||
|
|
@ -63,14 +63,14 @@ export default function UploadProviderPage() {
|
|||
|
||||
if (!providerInfo || !providerInfo.available) {
|
||||
setError(
|
||||
`Cloud provider "${provider}" is not available or configured.`,
|
||||
`Cloud provider "${provider}" is not available or configured.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check connector status
|
||||
const statusResponse = await fetch(
|
||||
`/api/connectors/${provider}/status`,
|
||||
`/api/connectors/${provider}/status`
|
||||
);
|
||||
if (!statusResponse.ok) {
|
||||
throw new Error(`Failed to check ${provider} status`);
|
||||
|
|
@ -80,7 +80,7 @@ export default function UploadProviderPage() {
|
|||
const connections = statusData.connections || [];
|
||||
const activeConnection = connections.find(
|
||||
(conn: { is_active: boolean; connection_id: string }) =>
|
||||
conn.is_active,
|
||||
conn.is_active
|
||||
);
|
||||
const isConnected = activeConnection !== undefined;
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ export default function UploadProviderPage() {
|
|||
if (isConnected && activeConnection) {
|
||||
try {
|
||||
const tokenResponse = await fetch(
|
||||
`/api/connectors/${provider}/token?connection_id=${activeConnection.connection_id}`,
|
||||
`/api/connectors/${provider}/token?connection_id=${activeConnection.connection_id}`
|
||||
);
|
||||
if (tokenResponse.ok) {
|
||||
const tokenData = await tokenResponse.json();
|
||||
|
|
@ -126,7 +126,7 @@ export default function UploadProviderPage() {
|
|||
setError(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "Failed to load connector information",
|
||||
: "Failed to load connector information"
|
||||
);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
|
@ -143,7 +143,7 @@ export default function UploadProviderPage() {
|
|||
if (!currentSyncTaskId) return;
|
||||
|
||||
const currentTask = tasks.find(
|
||||
(task) => task.task_id === currentSyncTaskId,
|
||||
(task) => task.task_id === currentSyncTaskId
|
||||
);
|
||||
|
||||
if (currentTask && currentTask.status === "completed") {
|
||||
|
|
@ -328,11 +328,11 @@ export default function UploadProviderPage() {
|
|||
|
||||
return (
|
||||
<div className="container mx-auto max-w-3xl p-6">
|
||||
<div className="mb-6 flex gap-2 items-center">
|
||||
<Button variant="ghost" onClick={() => router.back()}>
|
||||
<ArrowLeft className="h-4 w-4 scale-125" />
|
||||
<div className="mb-8 flex gap-2 items-center">
|
||||
<Button variant="ghost" onClick={() => router.back()} size="icon">
|
||||
<ArrowLeft size={18} />
|
||||
</Button>
|
||||
<h2 className="text-2xl font-bold">
|
||||
<h2 className="text-xl text-[18px] font-semibold">
|
||||
Add from {getProviderDisplayName()}
|
||||
</h2>
|
||||
</div>
|
||||
|
|
@ -366,9 +366,12 @@ export default function UploadProviderPage() {
|
|||
disabled={selectedFiles.length === 0 || isIngesting}
|
||||
>
|
||||
{isIngesting ? (
|
||||
<>Ingesting {selectedFiles.length} Files...</>
|
||||
<>
|
||||
Ingesting {selectedFiles.length} file
|
||||
{selectedFiles.length > 1 ? "s" : ""}...
|
||||
</>
|
||||
) : (
|
||||
<>Start ingest</>
|
||||
<>Ingest files</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -51,19 +51,13 @@ export const PickerHeader = ({
|
|||
Select files from {getProviderName(provider)} to ingest.
|
||||
</p>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={onAddFiles}
|
||||
disabled={!isPickerLoaded || isPickerOpen || !accessToken}
|
||||
className="bg-foreground text-background hover:bg-foreground/90 font-semibold"
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
{isPickerOpen ? "Opening Picker..." : "Add Files"}
|
||||
{isPickerOpen ? "Opening picker..." : "Add files"}
|
||||
</Button>
|
||||
<div className="text-xs text-muted-foreground pt-4">
|
||||
csv, json, pdf,{" "}
|
||||
<a className="underline dark:text-pink-400 text-pink-600">+16 more</a>{" "}
|
||||
<b>150 MB</b> max
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue