-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
8 changed files
with
366 additions
and
104 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,42 @@ | ||
import "./styles/App.css" | ||
import "./styles/theme.css" | ||
import "bootstrap/dist/css/bootstrap.min.css" | ||
|
||
import { useState } from "react" | ||
import { Row } from "react-bootstrap" | ||
import { HttpMethod } from "@data/enums" | ||
import Fetch from "@API/Fetch" | ||
import PredictForm from "components/PredictForm" | ||
|
||
export default function App() { | ||
|
||
var [predict, setPredict] = useState(0) | ||
|
||
async function getPredict(date) { | ||
var data = await Fetch({ action: "api/v1/predict/", method: HttpMethod.POST }) | ||
|
||
if (data && data.ok) { | ||
// console.log(data) | ||
// setPredict(data.predict) | ||
} | ||
setPredict(Math.random()) | ||
} | ||
|
||
return ( | ||
<div className="App"> | ||
Hello | ||
<br /> | ||
<h2 className="text-center">Сгенерить предикт на следующий день</h2> | ||
<br /> | ||
|
||
<PredictForm func={getPredict} /> | ||
|
||
<br /> | ||
<br /> | ||
|
||
{predict > 0 && | ||
<Row className="Row green text-large"> | ||
{predict} | ||
</Row> | ||
} | ||
</div> | ||
) | ||
|
||
} |
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,35 @@ | ||
import { useState } from "react" | ||
import { Button, Form, InputGroup } from "react-bootstrap" | ||
|
||
export default function PredictForm({ func }) { | ||
|
||
var [date, setDate] = useState(undefined) | ||
|
||
async function callFunc(event) { | ||
await event.preventDefault() | ||
var date_obj = Date.parse(date) | ||
return await func(date_obj) | ||
} | ||
|
||
return ( | ||
<> | ||
<Form formAction="POST" onSubmit={e => callFunc(e)}> | ||
<Form.Group className="mb-3"> | ||
<InputGroup className="mb-3"> | ||
<Form.Control | ||
type="date" | ||
onChange={e => setDate(e.target.value)} | ||
/> | ||
<Button | ||
variant="outline-secondary" | ||
id="button-addon1" | ||
type="submit" | ||
> | ||
get predict | ||
</Button> | ||
</InputGroup> | ||
</Form.Group> | ||
</Form> | ||
</> | ||
) | ||
} |
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 was deleted.
Oops, something went wrong.