-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding LogsSideDrawer and handling row click
- Loading branch information
1 parent
1bed456
commit bad347c
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
app/routes/account.$accountId.$appId.logs/components/LogsSideDrawer/LogsSideDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { Divider } from "@mantine/core" | ||
import { Card, Drawer, Group, Stack, Text } from "@pokt-foundation/pocket-blocks" | ||
import React from "react" | ||
import { TitledCard } from "~/components/TitledCard" | ||
import { Logs } from "~/models/dwh/sdk" | ||
import { dayjs } from "~/utils/dayjs" | ||
|
||
type LogsSideDrawerProps = { | ||
logsItem?: Logs | ||
onSideDrawerClose: () => void | ||
} | ||
|
||
const LogsSideDrawer = ({ logsItem, onSideDrawerClose }: LogsSideDrawerProps) => { | ||
console.log({ logsItem }) | ||
const cardItems = [ | ||
{ | ||
label: "Date", | ||
value: dayjs(logsItem?.ts).format("D MMMM, YYYY"), | ||
}, | ||
{ | ||
label: "Time", | ||
value: dayjs(logsItem?.ts).format("h:mm A"), | ||
}, | ||
{ | ||
label: "Application ID", | ||
value: logsItem?.portalApplicationId, | ||
}, | ||
{ | ||
label: "Chain ID", | ||
value: logsItem?.chainId, | ||
}, | ||
{ | ||
label: "Supported method", | ||
value: logsItem?.chainMethod, | ||
}, | ||
{ | ||
label: "Error type", | ||
value: logsItem?.errorType, | ||
}, | ||
{ | ||
label: "Error name", | ||
value: logsItem?.errorName, | ||
}, | ||
] | ||
|
||
return ( | ||
<Drawer | ||
opened={!!logsItem} | ||
overlayColor="#000000" | ||
overlayOpacity={0.5} | ||
padding="sm" | ||
position="right" | ||
size={800} | ||
onClose={onSideDrawerClose} | ||
> | ||
<Stack> | ||
<TitledCard header={() => <Text weight={600}>Summary</Text>}> | ||
<Card.Section p="md"> | ||
<Stack spacing={12}> | ||
{cardItems.map(({ label, value }, index) => ( | ||
<React.Fragment key={`${label}-${index}`}> | ||
<Group position="apart" px={12}> | ||
<Text>{label}</Text> <Text>{value}</Text> | ||
</Group> | ||
{index !== cardItems.length - 1 && <Divider />} | ||
</React.Fragment> | ||
))} | ||
</Stack> | ||
</Card.Section> | ||
</TitledCard> | ||
|
||
<TitledCard header={() => <Text weight={600}>Message</Text>}> | ||
<Card.Section p="md"> | ||
<Text>{logsItem?.errorMessage}</Text> | ||
</Card.Section> | ||
</TitledCard> | ||
</Stack> | ||
</Drawer> | ||
) | ||
} | ||
|
||
export default LogsSideDrawer |
3 changes: 3 additions & 0 deletions
3
app/routes/account.$accountId.$appId.logs/components/LogsSideDrawer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LogsSideDrawer from "./LogsSideDrawer" | ||
export * from "./LogsSideDrawer" | ||
export default LogsSideDrawer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters