-
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.
Merge branch 'stage' into charts-period-selector
# Conflicts: # app/routes/account.$accountId._index/route.tsx
- Loading branch information
Showing
19 changed files
with
477 additions
and
140 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
import { Image, Text, Stack } from "@pokt-foundation/pocket-blocks" | ||
import { type ReactNode } from "react" | ||
|
||
type EmptyStateProps = { | ||
title: string | ||
subtitle: ReactNode | ||
imgSrc: string | ||
imgHeight: number | ||
imgWidth: number | ||
alt?: string | ||
callToAction?: ReactNode | ||
} | ||
|
||
export const EmptyState = ({ | ||
title, | ||
subtitle, | ||
imgSrc, | ||
imgHeight, | ||
imgWidth, | ||
alt, | ||
callToAction, | ||
}: EmptyStateProps) => { | ||
return ( | ||
<Stack align="center" justify="center" mt={120}> | ||
<Image | ||
withPlaceholder | ||
alt={alt ? alt : "Empty state placeholder"} | ||
height={imgHeight} | ||
src={imgSrc} | ||
width={imgWidth} | ||
/> | ||
<Text fw={600} fz="xl"> | ||
{title} | ||
</Text> | ||
<Text fw={400} fz="sm" ta="center"> | ||
{subtitle} | ||
</Text> | ||
{callToAction ? callToAction : null} | ||
</Stack> | ||
) | ||
} | ||
|
||
export default EmptyState |
File renamed without changes.
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 |
56 changes: 56 additions & 0 deletions
56
app/routes/account.$accountId.$appId.logs/components/LogsTable/LogsTable.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,56 @@ | ||
import React, { useState } from "react" | ||
import { DataTable } from "~/components/DataTable" | ||
import { Logs } from "~/models/dwh/sdk" | ||
import LogsSideDrawer from "~/routes/account.$accountId.$appId.logs/components/LogsSideDrawer" | ||
import { dayjs } from "~/utils/dayjs" | ||
|
||
type LogsTableProps = { | ||
logs: Logs[] | ||
searchTerm: string | ||
} | ||
|
||
const LogsTable = ({ logs, searchTerm }: LogsTableProps) => { | ||
const [selectedLogsItem, setSelectedLogsItem] = useState<Logs | undefined>() | ||
|
||
return ( | ||
<> | ||
<LogsSideDrawer | ||
logsItem={selectedLogsItem} | ||
onSideDrawerClose={() => setSelectedLogsItem(undefined)} | ||
/> | ||
<DataTable | ||
columns={["Timestamp", "Method", "Chain ID", "Error type", "Error name"]} | ||
data={logs.map((log) => { | ||
return { | ||
timestamp: { | ||
element: dayjs(log.ts).format("D MMMM, YYYY h:mm A"), | ||
value: log.ts, | ||
}, | ||
method: { | ||
element: log.chainMethod, | ||
value: log.chainMethod, | ||
}, | ||
chainId: { | ||
element: log.chainId, | ||
value: log.chainId, | ||
}, | ||
errorType: { | ||
element: log.errorType, | ||
value: log.errorType, | ||
}, | ||
errorName: { | ||
element: log.errorName, | ||
value: log.errorName, | ||
}, | ||
rowSelectData: log, | ||
} | ||
})} | ||
paginate={logs.length > 10 ? { perPage: 20 } : false} | ||
searchTerm={searchTerm} | ||
onRowClick={(logsItem) => setSelectedLogsItem(logsItem as unknown as Logs)} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export default LogsTable |
3 changes: 3 additions & 0 deletions
3
app/routes/account.$accountId.$appId.logs/components/LogsTable/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 LogsTable from "./LogsTable" | ||
export * from "./LogsTable" | ||
export default LogsTable |
Oops, something went wrong.