Updated weight edit
This commit is contained in:
+18
-25
@@ -7093,31 +7093,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}
|
||||||
|
|||||||
Reference in New Issue
Block a user