diff --git a/.firebaserc b/.firebaserc index a78ff03..dc10c99 100644 --- a/.firebaserc +++ b/.firebaserc @@ -10,6 +10,9 @@ ], "qa": [ "hpos-qa" + ], + "dev": [ + "hpos-dev" ] } } diff --git a/README.md b/README.md index ced62e2..c777ea0 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,22 @@ http://localhost:3000 + +### add target (multi site), if not already defined for that site + + firebase target:apply hosting dev1 hpos-dev1 + +### add or change to firebase.json + + "target": "dev1", + +### run build + + npm build + + +### deploy + + firebase deploy --only hosting:dev + pyinstaller --noconfirm --noconsole -i "smi.ico" --windowed --clean hemocube.py diff --git a/src/assets/auto_analysis_help-1.png b/src/assets/auto_analysis_help-1.png new file mode 100644 index 0000000..d016749 Binary files /dev/null and b/src/assets/auto_analysis_help-1.png differ diff --git a/src/assets/auto_analysis_help-2.png b/src/assets/auto_analysis_help-2.png new file mode 100644 index 0000000..d5c3e87 Binary files /dev/null and b/src/assets/auto_analysis_help-2.png differ diff --git a/src/assets/auto_analysis_help-3.png b/src/assets/auto_analysis_help-3.png new file mode 100644 index 0000000..8e168c0 Binary files /dev/null and b/src/assets/auto_analysis_help-3.png differ diff --git a/src/assets/raw_data_help_1.png b/src/assets/raw_data_help_1.png new file mode 100644 index 0000000..b2c4d35 Binary files /dev/null and b/src/assets/raw_data_help_1.png differ diff --git a/src/assets/raw_data_help_2.png b/src/assets/raw_data_help_2.png new file mode 100644 index 0000000..c913f41 Binary files /dev/null and b/src/assets/raw_data_help_2.png differ diff --git a/src/assets/raw_data_help_3.png b/src/assets/raw_data_help_3.png new file mode 100644 index 0000000..7548e60 Binary files /dev/null and b/src/assets/raw_data_help_3.png differ diff --git a/src/assets/registration_help_1.png b/src/assets/registration_help_1.png new file mode 100644 index 0000000..764d1f7 Binary files /dev/null and b/src/assets/registration_help_1.png differ diff --git a/src/assets/registration_help_2.png b/src/assets/registration_help_2.png new file mode 100644 index 0000000..0f4613f Binary files /dev/null and b/src/assets/registration_help_2.png differ diff --git a/src/assets/registration_help_3.png b/src/assets/registration_help_3.png new file mode 100644 index 0000000..043f5dc Binary files /dev/null and b/src/assets/registration_help_3.png differ diff --git a/src/components/Accuracy.css b/src/components/Accuracy.css new file mode 100644 index 0000000..5a71fbb --- /dev/null +++ b/src/components/Accuracy.css @@ -0,0 +1,63 @@ +.button { + background-color: #4CAF50; + /* Green */ + border: none; + color: white; + /* padding: 15px 32px; */ + padding: 5px 10px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 15px; +} + +.file-row { + flex-direction: row; + display: flex; + justify-content: center; + align-items: center; + margin: 1.5rem; +} + +.file-label { + margin: 10px; +} + +.dates { + flex-direction: row; + display: flex; + justify-content: center; + align-items: center; + margin: 1.5rem; +} + +.start-date { + margin: 10px; +} + +.end-date { + margin: 10px; +} + +.download-row { + flex-direction: row; + display: flex; + justify-content: center; + align-items: center; + margin: 1.5rem; +} + +.loading-icon { + animation: rotate 2s linear infinite; +} + +@keyframes rotate { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} \ No newline at end of file diff --git a/src/components/Accuracy.js b/src/components/Accuracy.js new file mode 100644 index 0000000..db5c3b9 --- /dev/null +++ b/src/components/Accuracy.js @@ -0,0 +1,107 @@ +import React, { useState } from 'react'; +import { FaInfoCircle } from "react-icons/fa"; +import { AiOutlineLoading } from "react-icons/ai"; +import DatePicker from "react-datepicker"; +import moment from 'moment'; +import axios from 'axios'; + +import "react-datepicker/dist/react-datepicker.css"; +import './Accuracy.css'; + +function Accuracy({ show }) { + const [showCardInfo, setShowCardInfo] = useState(false); + const [startDate, setStartDate] = useState(""); + const [endDate, setEndDate] = useState(""); + const [selectedFile, setSelectedFile] = useState(null); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); // New state for handling errors + + const handleFileChange = (event) => { + setSelectedFile(event.target.files[0]); + }; + + + const fetchFile = async (start_date, end_date) => { + try { + setLoading(true); + setError(null); // Reset error state before making a new request + + if (selectedFile) { + const formData = new FormData(); + formData.append('file', selectedFile); + + const queryString = `start_date=${moment(startDate).format( + 'YYYY-MM-DD' + )}&end_date=${moment(endDate).format('YYYY-MM-DD')}`; + + const url = `https://asia-south1-hpos-af3cc.cloudfunctions.net/performance?${queryString}`; + + // Make a POST request using the Fetch API + const response = await fetch(url, { + method: 'POST', + body: formData, + headers: { + // Add any necessary headers + // 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', + }, + }); + + // Check if the request was successful (status code 2xx) + if (response.ok) { + // Create a blob from the response data + const blob = await response.blob(); + + // Create a download link and trigger a click to download the file + const link = document.createElement('a'); + link.href = window.URL.createObjectURL(blob); + link.download = 'autoanlysis.xlsx'; // Set the desired file name + document.body.appendChild(link); + link.click(); + + // Clean up + document.body.removeChild(link); + } else { + console.error('Error downloading file:', response.statusText); + setError('Error downloading file. Please try again.'); // Set error message + } + } else { + setError("Select file from reference device"); + } + } catch (error) { + console.error('Error downloading file:', error); + setError('Error downloading file. Please try again.'); // Set error message + } finally { + setLoading(false); // Set loading back to false when the request completes + } + }; + + + return ( +
+
+
+
+
+
+
+
+
+
+
+
+
+
+