Updated weight edit
This commit is contained in:
+4
-11
@@ -6591,28 +6591,21 @@ function App() {
|
||||
</form>
|
||||
<div className="recent-list">
|
||||
{[...weights]
|
||||
.filter(isWeightEditable)
|
||||
.sort((left, right) => right.recordedOn.localeCompare(left.recordedOn))
|
||||
.map((weight) => {
|
||||
const weightCanBeEdited = isWeightEditable(weight);
|
||||
|
||||
return (
|
||||
.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>
|
||||
{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}
|
||||
))}
|
||||
{!weights.some(isWeightEditable) ? <p className="muted">No editable weight entries from the last 3 days.</p> : null}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user