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} ) : null}
</div> </div>
</form> </form>
<div className="recent-list"> <div className="recent-list">
{[...weights] {[...weights]
.sort((left, right) => right.recordedOn.localeCompare(left.recordedOn)) .filter(isWeightEditable)
.map((weight) => { .sort((left, right) => right.recordedOn.localeCompare(left.recordedOn))
const weightCanBeEdited = isWeightEditable(weight); .map((weight) => (
<article className="vet-visit-card" key={weight.id}>
return ( <strong>{formatWeight(weight.weightGrams)}</strong>
<article className="vet-visit-card" key={weight.id}> <span>{formatDate(weight.recordedOn)}</span>
<strong>{formatWeight(weight.weightGrams)}</strong> <small>{weight.notes || 'No notes recorded.'}</small>
<span>{formatDate(weight.recordedOn)}</span> <div className="button-row">
<small>{weight.notes || 'No notes recorded.'}</small> <button className="secondary-button" onClick={() => handleEditWeight(weight)} type="button">
{weightCanBeEdited ? ( Edit
<div className="button-row"> </button>
<button className="secondary-button" onClick={() => handleEditWeight(weight)} type="button"> </div>
Edit </article>
</button> ))}
</div> {!weights.some(isWeightEditable) ? <p className="muted">No editable weight entries from the last 3 days.</p> : null}
) : ( </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>
</section> </section>
</div> </div>
) : null} ) : null}