mirror of https://github.com/statping/statping
PCORE-2213: cosmetic changes on incident updates (#38)
* feat: minor cosmetic change in showing dates * feat: minor cosmetic change in showing dates * feat: scroll to input when editing incident * fix: class to classname * fix: added array check for api data * feat: used created_at instead of updated_at * feat: added empty message when no incident updates are therepull/1113/head
parent
14e6b69c6b
commit
a51d42b2e2
|
@ -17,7 +17,7 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
data = await API.incidents_service(service.id);
|
||||
}
|
||||
|
||||
if(Array.isArray(data)) {
|
||||
if (Array.isArray(data)) {
|
||||
setIncidents(data);
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,7 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
{incidents?.length > 0 ? (
|
||||
incidents?.map((incident) => {
|
||||
const { id, title, description, updates, updated_at } = incident;
|
||||
const latestUpdate =
|
||||
updates?.length > 0 && updates[0];
|
||||
const latestUpdate = updates?.length > 0 && updates[0];
|
||||
const updatedAt = latestUpdate
|
||||
? latestUpdate.created_at
|
||||
: updated_at;
|
||||
|
@ -50,7 +49,6 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
className={`incident-title col-12 ${
|
||||
incidentsShow[id] && "mb-3"
|
||||
}`}>
|
||||
{updates?.length > 0 && (
|
||||
<>
|
||||
{incidentsShow[id] ? (
|
||||
<button
|
||||
|
@ -68,7 +66,6 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="title-wrapper">
|
||||
<span className="subtitle no-decoration">{title}</span>
|
||||
|
@ -87,6 +84,8 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
|
||||
{incidentsShow[id] && (
|
||||
<div className="incident-updates-wrapper col-12">
|
||||
{updates?.length > 0 ? (
|
||||
<>
|
||||
{updates?.map((update) => {
|
||||
return (
|
||||
<IncidentUpdate
|
||||
|
@ -96,6 +95,18 @@ const IncidentsBlock = ({ service, group }) => {
|
|||
/>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<div className="d-flex">
|
||||
<div className="mr-2 d-flex align-items-center">
|
||||
<span className="dot"></span>
|
||||
</div>
|
||||
|
||||
<div className="font-14 text-muted">
|
||||
No recent updates
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</Fragment>
|
||||
|
|
Loading…
Reference in New Issue