From be57fd5f67a52fd04f7da6a08998476a1ba36802 Mon Sep 17 00:00:00 2001 From: Mitry Date: Wed, 21 Aug 2024 15:28:08 -0300 Subject: [PATCH] fix goal bar overflow, add sort by complete --- frontend-app/src/components/ProjectGoals/index.jsx | 2 +- frontend-app/src/components/common/GoalCard/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend-app/src/components/ProjectGoals/index.jsx b/frontend-app/src/components/ProjectGoals/index.jsx index 8938f23..5b8880c 100644 --- a/frontend-app/src/components/ProjectGoals/index.jsx +++ b/frontend-app/src/components/ProjectGoals/index.jsx @@ -87,7 +87,7 @@ export default function ProjectEdit({ pathID, attributes }) { var { data } = await api.get(`/api/projects/goals/${pathID}/`, { headers: { "Authorization": "Bearer " + localStorage.getItem("dtcAccess") } }); - setGoals(data); + setGoals(data.sort((a, b) => Number(a.complete >= b.complete) || -1)); } catch ({ message, response }) { var authFailed = response?.status === 401 || response?.status === 403; diff --git a/frontend-app/src/components/common/GoalCard/index.jsx b/frontend-app/src/components/common/GoalCard/index.jsx index 010df7b..575e7a6 100644 --- a/frontend-app/src/components/common/GoalCard/index.jsx +++ b/frontend-app/src/components/common/GoalCard/index.jsx @@ -9,7 +9,7 @@ import "./styles.css"; */ export default function GoalCard({ goalItem, onDelete }) { const { attribute, amount, complete, id } = goalItem; - const progress = Math.ceil(complete / amount * 100); + const progress = Math.min(Math.ceil(complete / amount * 100)); return

{attribute}