Skip to content

Commit

Permalink
fix: style
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren committed Oct 13, 2024
1 parent 68bfe71 commit 7c830bf
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions keep-ui/app/incidents/[id]/incident-activity.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlertDto, Severity, Status } from "@/app/alerts/models";
import { AlertDto } from "@/app/alerts/models";
import { IncidentDto } from "../models";
import { Chrono } from "react-chrono";
import { useUsers } from "@/utils/hooks/useUsers";
Expand Down Expand Up @@ -131,24 +131,25 @@ export default function IncidentActivity({
)
return <Loading />;

const activities = [
{
id: "newcomment",
type: "newcomment",
timestamp: new Date().toISOString(),
initiator:
users?.find((u) => u.email === session?.user.email)?.picture ||
session?.user.email,
}, // this is placeholder for the new comment activity
...(auditEvents
const newCommentActivity = {
id: "newcomment",
type: "newcomment",
timestamp: new Date().toISOString(),
initiator:
users?.find((u) => u.email === session?.user.email)?.picture ||
session?.user.email,
};

const auditActivities =
auditEvents
?.concat(incidentEvents || [])
.sort(
(a, b) =>
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
)
.map((auditEvent) => {
const _type =
auditEvent.action === "A comment was added to the incident"
auditEvent.action === "A comment was added to the incident" // @tb: I wish this was INCIDENT_COMMENT and not the text..
? "comment"
: "alert";
return {
Expand All @@ -164,8 +165,9 @@ export default function IncidentActivity({
text: auditEvent.description,
timestamp: auditEvent.timestamp,
} as IncidentActivity;
}) || []),
];
}) || [];

const activities = [newCommentActivity, ...auditActivities];

const chronoContent = activities?.map((activity, index) =>
activity.type === "newcomment" ? (
Expand Down

0 comments on commit 7c830bf

Please sign in to comment.