Updated weight edit

This commit is contained in:
Corey Blais
2026-06-16 10:33:34 -04:00
parent 53b7d34520
commit 1849ecd73b
+18 -25
View File
@@ -6589,31 +6589,24 @@ function App() {
) : null}
</div>
</form>
<div className="recent-list">
{[...weights]
.sort((left, right) => right.recordedOn.localeCompare(left.recordedOn))
.map((weight) => {
const weightCanBeEdited = isWeightEditable(weight);
return (
<article className="vet-visit-card" key={weight.id}>
<strong>{formatWeight(weight.weightGrams)}</strong>
<span>{formatDate(weight.recordedOn)}</span>
<small>{weight.notes || 'No notes recorded.'}</small>
{weightCanBeEdited ? (
<div className="button-row">
<button className="secondary-button" onClick={() => handleEditWeight(weight)} type="button">
Edit
</button>
</div>
) : (
<small>Editing available for the last 3 days only.</small>
)}
</article>
);
})}
{!weights.length ? <p className="muted">No weight entries recorded yet.</p> : null}
</div>
<div className="recent-list">
{[...weights]
.filter(isWeightEditable)
.sort((left, right) => right.recordedOn.localeCompare(left.recordedOn))
.map((weight) => (
<article className="vet-visit-card" key={weight.id}>
<strong>{formatWeight(weight.weightGrams)}</strong>
<span>{formatDate(weight.recordedOn)}</span>
<small>{weight.notes || 'No notes recorded.'}</small>
<div className="button-row">
<button className="secondary-button" onClick={() => handleEditWeight(weight)} type="button">
Edit
</button>
</div>
</article>
))}
{!weights.some(isWeightEditable) ? <p className="muted">No editable weight entries from the last 3 days.</p> : null}
</div>
</section>
</div>
) : null}