This commit is contained in:
Nicolas Mowen 2024-12-29 08:12:21 -07:00
parent 05d4996d14
commit b862ef0391

View File

@ -64,7 +64,7 @@ export default function FaceLibrary() {
setUpload(false); setUpload(false);
refreshFaces(); refreshFaces();
toast.success( toast.success(
"Successfully uploaded iamge. View the file in the /exports folder.", "Successfully uploaded image. View the file in the /exports folder.",
{ position: "top-center" }, { position: "top-center" },
); );
} }
@ -143,7 +143,7 @@ export default function FaceLibrary() {
</div> </div>
{pageToggle && {pageToggle &&
(pageToggle == "attempts" ? ( (pageToggle == "attempts" ? (
<AttemptsGrid attemptImages={faceAttempts} /> <AttemptsGrid attemptImages={faceAttempts} onRefresh={refreshFaces} />
) : ( ) : (
<FaceGrid <FaceGrid
faceImages={faceImages} faceImages={faceImages}
@ -157,12 +157,13 @@ export default function FaceLibrary() {
type AttemptsGridProps = { type AttemptsGridProps = {
attemptImages: string[]; attemptImages: string[];
onRefresh: () => void;
}; };
function AttemptsGrid({ attemptImages }: AttemptsGridProps) { function AttemptsGrid({ attemptImages, onRefresh }: AttemptsGridProps) {
return ( return (
<div className="scrollbar-container flex flex-wrap gap-2 overflow-y-scroll"> <div className="scrollbar-container flex flex-wrap gap-2 overflow-y-scroll">
{attemptImages.map((image: string) => ( {attemptImages.map((image: string) => (
<FaceAttempt key={image} image={image} /> <FaceAttempt key={image} image={image} onRefresh={onRefresh} />
))} ))}
</div> </div>
); );
@ -170,6 +171,7 @@ function AttemptsGrid({ attemptImages }: AttemptsGridProps) {
type FaceAttemptProps = { type FaceAttemptProps = {
image: string; image: string;
onRefresh: () => void;
}; };
function FaceAttempt({ image }: FaceAttemptProps) { function FaceAttempt({ image }: FaceAttemptProps) {
const [hovered, setHovered] = useState(false); const [hovered, setHovered] = useState(false);
@ -189,7 +191,9 @@ function FaceAttempt({ image }: FaceAttemptProps) {
.post(`/faces/debug/delete`, { ids: [image] }) .post(`/faces/debug/delete`, { ids: [image] })
.then((resp) => { .then((resp) => {
if (resp.status == 200) { if (resp.status == 200) {
toast.error(`Successfully deleted face.`, { position: "top-center" }); toast.success(`Successfully deleted face.`, {
position: "top-center",
});
} }
}) })
.catch((error) => { .catch((error) => {