mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-20 01:27:48 +01:00
39 lines
948 B
TypeScript
39 lines
948 B
TypeScript
import { VStack } from './core/Stacks';
|
|
import { Button } from './core/Button';
|
|
import { useState } from 'react';
|
|
|
|
interface Props {
|
|
importData: () => Promise<void>;
|
|
}
|
|
|
|
export function ImportDataDialog({ importData }: Props) {
|
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
return (
|
|
<VStack space={5} className="pb-4">
|
|
<VStack space={1}>
|
|
<p>Supported Formats:</p>
|
|
<ul className="list-disc pl-5">
|
|
<li>Postman Collection v2+</li>
|
|
<li>Insomnia v4+</li>
|
|
<li>Curl command(s)</li>
|
|
</ul>
|
|
</VStack>
|
|
<Button
|
|
size="sm"
|
|
color="primary"
|
|
isLoading={isLoading}
|
|
onClick={async () => {
|
|
setIsLoading(true);
|
|
try {
|
|
await importData();
|
|
} finally {
|
|
setIsLoading(false);
|
|
}
|
|
}}
|
|
>
|
|
{isLoading ? 'Importing' : 'Select File'}
|
|
</Button>
|
|
</VStack>
|
|
);
|
|
}
|