Skip to content

Commit

Permalink
feat: show canceled events
Browse files Browse the repository at this point in the history
  • Loading branch information
jog1t authored and NathanFlurry committed Aug 16, 2024
1 parent 41944ce commit 6c99872
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,41 @@ const getResponseTypeVariant = (type: "warning" | "error" | "success") => {
return "outline";
};

const getResponseLabel = (outcome: string, type: string) => {
if (outcome === "canceled") {
return "CANCELED";
}
if (type === "error") {
return "ERROR";
}
return "OK";
};

interface GameBackendResponseBadgeProps extends BackendEvent {}

export function GameBackendResponseBadge({
backendCall,
event,
outcome,
}: GameBackendResponseBadgeProps) {
const type = getResponseType(event);
const variant = getResponseTypeVariant(type);

const label = getResponseLabel(outcome, type);

if (backendCall) {
return (
<>
<Badge>CALL</Badge>
<Badge variant={variant}>{type === "error" ? "ERROR" : "OK"}</Badge>
<Badge variant={variant}>{label}</Badge>
</>
);
}
return (
<>
<Badge>HTTP</Badge>
<Badge variant={variant}>
{event.response.status} {type === "error" ? "ERROR" : "OK"}
{event.response.status} {label}
</Badge>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/domains/game/queries/backend/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const BackendEvent = z
}),
)
.optional(),
outcome: z.string(),
outcome: z.literal("canceled").or(z.string()),
scriptName: z.string(),
scriptVersion: z.object({
id: z.string(),
Expand Down
Binary file modified apps/hub/vendor/rivet-gg-api-ee.tgz
Binary file not shown.
17 changes: 2 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3544,27 +3544,14 @@ __metadata:

"@rivet-gg/api-ee@file:vendor/rivet-gg-api-ee.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Aapps%2Fhub":
version: 0.0.1
resolution: "@rivet-gg/api-ee@file:vendor/rivet-gg-api-ee.tgz#vendor/rivet-gg-api-ee.tgz::hash=483e89&locator=%40rivet-gg%2Fhub%40workspace%3Aapps%2Fhub"
resolution: "@rivet-gg/api-ee@file:vendor/rivet-gg-api-ee.tgz#vendor/rivet-gg-api-ee.tgz::hash=1f46df&locator=%40rivet-gg%2Fhub%40workspace%3Aapps%2Fhub"
dependencies:
form-data: "npm:^4.0.0"
js-base64: "npm:^3.7.5"
node-fetch: "npm:2"
qs: "npm:^6.11.2"
url-join: "npm:^5.0.0"
checksum: 10c0/a63ec57ebc021c7dd1ea4ddb63871336675c7c5659a34c8c48697e86404b30a9e2d01df55e6a0b832834666ef6737ad1b1709bed4ae033c393c946f49a2beb50
languageName: node
linkType: hard

"@rivet-gg/api@file:vendor/rivet-gg-api.tgz::locator=%40rivet-gg%2Fhub%40workspace%3Aapps%2Fhub":
version: 24.1.0
resolution: "@rivet-gg/api@file:vendor/rivet-gg-api.tgz#vendor/rivet-gg-api.tgz::hash=eeecae&locator=%40rivet-gg%2Fhub%40workspace%3Aapps%2Fhub"
dependencies:
form-data: "npm:^4.0.0"
js-base64: "npm:^3.7.5"
node-fetch: "npm:2"
qs: "npm:^6.11.2"
url-join: "npm:^5.0.0"
checksum: 10c0/5f6d86420b3a80265ed75c55cc7f612506f917268b5227bf20980e385947d9ab1effc207521e53c626906a0e02b0a129329d5ba4e560762ccbc624ee6bbe8e2d
checksum: 10c0/78cd73d70223d145b4dea1cb11f15c76e5f1a551ae8aea53da7bf4a1bc56bd640e60a19f5dc795f2303a55eb2c54a1dad683223d8214732b366805163db860d5
languageName: node
linkType: hard

Expand Down

0 comments on commit 6c99872

Please sign in to comment.