-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8661aa6
commit 81a6e24
Showing
6 changed files
with
138 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import axios, { AxiosResponse } from 'axios'; | ||
|
||
export async function LeofetchData(query: string): Promise<string> { | ||
try { | ||
const response: AxiosResponse = await axios.get(`https://leo.tektorch.info/query/?q=${encodeURIComponent(query)}`); | ||
return response.data; | ||
} catch (error) { | ||
console.error('Error fetching data:', error); | ||
throw error; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useState } from 'react'; | ||
import { Box, Button, Flex, Input, Text } from '@chakra-ui/react'; | ||
|
||
interface FileUploadComponentProps { | ||
onFileSelect: (file: File) => void; | ||
} | ||
|
||
const FileUploadComponent: React.FC<FileUploadComponentProps> = ({ onFileSelect }) => { | ||
const [selectedFile, setSelectedFile] = useState<File | null>(null); | ||
|
||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
if (e.target.files && e.target.files.length > 0) { | ||
const file = e.target.files[0]; | ||
setSelectedFile(file); | ||
onFileSelect(file); | ||
} | ||
}; | ||
|
||
return ( | ||
<Flex align="center"> | ||
<Box> | ||
{selectedFile ? ( | ||
<Text>{selectedFile.name}</Text> | ||
) : ( | ||
<Button as="label" htmlFor="file-input" colorScheme="blue"> | ||
Choose File | ||
</Button> | ||
)} | ||
</Box> | ||
<Input | ||
id="file-input" | ||
type="file" | ||
display="none" | ||
onChange={handleFileChange} | ||
accept=".pdf,.doc,.docx,.jpg,.png" | ||
/> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default FileUploadComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters