Skip to content

Commit

Permalink
Merge pull request #525 from pokt-foundation/fixes-and-clean-up
Browse files Browse the repository at this point in the history
Fixes and clean up
  • Loading branch information
RabeeAbuBaker authored Oct 18, 2023
2 parents a3a236e + 152615a commit 114dbf8
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/components/Sparkline/Sparkline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Sparkline = ({
>
<Text className="label">Date: {label}</Text>
<Text className="desc">
{payload[0].value
{payload[0].value || payload[0].value === 0
? `${
commifyValue ? commify(payload[0].value) : payload[0].value
} ${valueLabel}`
Expand Down
32 changes: 16 additions & 16 deletions app/routes/account.$accountId.$appId.insights/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ export default function ApplicationInsightsView({ data }: ApplicationInsightsVie
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Total Relays
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Total Relays</Text>
<Badge px={6} radius="sm">
{commify(total?.countTotal ?? 0)}
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -77,12 +77,12 @@ export default function ApplicationInsightsView({ data }: ApplicationInsightsVie
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Average Latency{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Average Latency </Text>
<Badge px={6} radius="sm">
{commify(total?.avgLatency ?? 0)}ms
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -98,12 +98,12 @@ export default function ApplicationInsightsView({ data }: ApplicationInsightsVie
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Success Rate{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Success Rate </Text>
<Badge px={6} radius="sm">
{commify(total?.rateSuccess ?? 0)}%
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -120,12 +120,12 @@ export default function ApplicationInsightsView({ data }: ApplicationInsightsVie
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Total Errors{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Total Errors </Text>
<Badge px={6} radius="sm">
{totalErrors ? commify(totalErrors) : 0}
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand Down
1 change: 1 addition & 0 deletions app/routes/account.$accountId.$appId.logs/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const loader: LoaderFunction = async ({ request, params }) => {
error: false,
})
} catch (error) {
console.error(error)
return json<DataStruct<AppLogsData>>({
data: null,
error: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const ApprovedChainsModal = ({
)

const deleteSelectedChain = (chainId: string) => {
console.log(chainId)
setSelectedBlockchainsIds((ids) => ids.filter((id) => chainId !== id))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const WhitelistUserAgentsModal = ({ dispatch }: WhitelistUserAgentsModalProps) =
const [selectedUserAgents, setSelectedUserAgents] = useState<string[]>([])
const [inputUserAgent, setInputUserAgent] = useState("")
const deletedAgent = (deletedAgent: string) => {
console.log(deletedAgent)
setSelectedUserAgents((agents) => agents.filter((agent) => agent !== deletedAgent))
}

Expand Down
1 change: 1 addition & 0 deletions app/routes/account.$accountId._index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const loader: LoaderFunction = async ({ request, params }) => {
error: false,
})
} catch (error) {
console.error(error)
return json<DataStruct<AccountInsightsData>>({
data: null,
error: true,
Expand Down
32 changes: 16 additions & 16 deletions app/routes/account.$accountId._index/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export const AccountInsightsView = ({ data }: AccountInsightsViewProps) => {
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Total Relays{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Total Relays</Text>
<Badge px={6} radius="sm">
{commify(total?.countTotal ?? 0)}
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -78,12 +78,12 @@ export const AccountInsightsView = ({ data }: AccountInsightsViewProps) => {
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Average Latency{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Average Latency</Text>
<Badge px={6} radius="sm">
{commify(total?.avgLatency ?? 0)}ms
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -99,12 +99,12 @@ export const AccountInsightsView = ({ data }: AccountInsightsViewProps) => {
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Success Rate{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Success Rate</Text>
<Badge px={6} radius="sm">
{commify(total?.rateSuccess ?? 0)}%
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand All @@ -122,12 +122,12 @@ export const AccountInsightsView = ({ data }: AccountInsightsViewProps) => {
<TitledCard
header={() => (
<Group position="apart">
<Text weight={600}>
Total Errors{" "}
<Badge ml="sm" px={6} radius="sm">
<Group>
<Text weight={600}>Total Errors</Text>
<Badge px={6} radius="sm">
{totalErrors ? commify(totalErrors) : 0}
</Badge>
</Text>
</Group>
<ChartPeriodSelector />
</Group>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const AppForm = ({ app, onSubmit }: AppFormProps) => {

const [name, setName] = useState(app?.name ?? "")
const [referral, setReferral] = useState("")
const [appmoji, setAppmoji] = useState(DEFAULT_APPMOJI)
const [appmoji, setAppmoji] = useState(app?.appEmoji ?? DEFAULT_APPMOJI)

useEffect(() => {
const rid = window.localStorage.getItem("rid")
Expand Down
4 changes: 2 additions & 2 deletions app/styles/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ button.pokt-button-with__icon:hover {
}

.clickable-table tbody tr:hover {
background-color: rgba(37, 38, 43, 0.50) !important
}
background-color: rgba(37, 38, 43, 0.5) !important;
}
6 changes: 5 additions & 1 deletion app/utils/chartUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { AnalyticsRelaysAggregated, AnalyticsRelaysTotal } from "~/models/dwh/sd
export const getTotalErrors = (
aggregatedData: AnalyticsRelaysAggregated | AnalyticsRelaysTotal,
) => {
if (!aggregatedData || !aggregatedData.rateError || !aggregatedData.countTotal) {
if (
!aggregatedData ||
!aggregatedData.countTotal ||
(!aggregatedData.rateError && aggregatedData?.rateError !== 0)
) {
return null
}

Expand Down

0 comments on commit 114dbf8

Please sign in to comment.