forked from hotosm/fAIr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hotosm#145 from hotosm/feature/feedback_v1
Enhance : Feedback Implented New Models & Styles
- Loading branch information
Showing
15 changed files
with
489 additions
and
280 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
frontend/src/components/Layout/AIModels/AIModelEditor/Feedback.js
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,60 @@ | ||
import { IconButton, Tooltip } from "@mui/material"; | ||
import React, { useContext } from "react"; | ||
import InfoIcon from "@mui/icons-material/Info"; | ||
import FeedbackIcon from "@mui/icons-material/Feedback"; | ||
import { useQuery } from "react-query"; | ||
import axios from "../../../../axios"; | ||
import AuthContext from "../../../../Context/AuthContext"; | ||
import FindReplaceIcon from "@mui/icons-material/FindReplace"; | ||
const Feedback = ({ trainingId }) => { | ||
const { accessToken } = useContext(AuthContext); | ||
const getFeedback = async () => { | ||
try { | ||
const headers = { | ||
"access-token": accessToken, | ||
}; | ||
const res = await axios.get(`/feedback/?training=${trainingId}`, null, { | ||
headers, | ||
}); | ||
|
||
if (res.error) { | ||
} else { | ||
// console.log(`/feedback/?training=${trainingId}`, res.data); | ||
return res.data; | ||
} | ||
} catch (e) { | ||
console.log("isError", e); | ||
} finally { | ||
} | ||
}; | ||
const { data: feedbackData, isLoading } = useQuery( | ||
"getFeedback" + trainingId, | ||
getFeedback, | ||
{ | ||
refetchInterval: 10000, | ||
} | ||
); | ||
|
||
return ( | ||
<> | ||
{feedbackData && | ||
feedbackData.features && | ||
feedbackData.features.length > 0 && ( | ||
<Tooltip | ||
title={`Total number of feedback on this training is ${feedbackData.features.length}`} | ||
placement="left" | ||
> | ||
<IconButton aria-label="popup"> | ||
<FeedbackIcon size="small" /> | ||
</IconButton> | ||
</Tooltip> | ||
)} | ||
{isLoading && ( | ||
<IconButton aria-label="popup"> | ||
<FindReplaceIcon size="small" /> | ||
</IconButton> | ||
)} | ||
</> | ||
); | ||
}; | ||
export default Feedback; |
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
Oops, something went wrong.