Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Dashboard Improvements #3005

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/Chart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export const formatCurrencyTick = (value: unknown): string => {
return `${formatCurrency(valueNum / 1000)}k`;
}

if (valueNum > 100) {
return `${formatCurrency(valueNum)}`;
}

return formatCurrency(valueNum, 2);
};

Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useFederatedSubgraphQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,20 @@ export const useMetricsQuery = ({
startDate,
includeContentRecords,
ignoreCache,
crossChainDataComplete,
}: {
startDate?: string | null;
includeContentRecords?: boolean;
ignoreCache?: boolean;
crossChainDataComplete?: boolean;
}) => {
return useFederatedSubgraphQuery({
operationName: "paginated/metrics",
input: {
startDate: startDate || "",
includeRecords: includeContentRecords || false,
ignoreCache: ignoreCache || false,
crossChainDataComplete: crossChainDataComplete || true,
},
enabled: startDate != null,
retry: 3, // Queries with long periods and with includeRecords = true will take a while if not cached, leading to a timeout
Expand Down
9 changes: 6 additions & 3 deletions src/views/Lending/Cooler/dashboard/IncomeGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ export const IncomeGraph = ({ startDate }: { startDate?: Date }) => {
const bulletpointStyles = getBulletpointStylesMap(DEFAULT_BULLETPOINT_COLOURS, dataKeys);
const colorsMap = getDataKeyColorsMap(DEFAULT_COLORS, dataKeys);
const dataKeyLabels = getCategoriesMap(itemNames, dataKeys);
const tickStyle = getTickStyle(theme);
tickStyle.stroke = "#8A8B90";
tickStyle.fill = "#8A8B90";

return (
<Grid container>
<Grid item xs={12}>
<Typography variant="h6" color="textSecondary" display="inline">
<Grid item xs={12} paddingBottom={1}>
<Typography variant="h6" color="rgb(238, 233, 226)" display="inline">
Protocol Income
</Typography>
</Grid>
Expand All @@ -68,7 +71,7 @@ export const IncomeGraph = ({ startDate }: { startDate?: Date }) => {
dataKeyLabels={dataKeyLabels}
infoTooltipMessage={""}
isLoading={!coolerSnapshots}
tickStyle={getTickStyle(theme)}
tickStyle={tickStyle}
itemDecimals={0}
margin={{ left: 30 }}
/>
Expand Down
9 changes: 6 additions & 3 deletions src/views/Lending/Cooler/dashboard/MaturityGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ export const MaturityGraph = () => {
const bulletpointStyles = getBulletpointStylesMap(DEFAULT_BULLETPOINT_COLOURS, dataKeys);
const colorsMap = getDataKeyColorsMap(DEFAULT_COLORS, dataKeys);
const dataKeyLabels = getCategoriesMap(itemNames, dataKeys);
const tickStyle = getTickStyle(theme);
tickStyle.stroke = "#8A8B90";
tickStyle.fill = "#8A8B90";

return (
<Grid container>
<Grid item xs={12}>
<Typography variant="h6" color="textSecondary" display="inline">
<Grid item xs={12} paddingBottom={1}>
<Typography variant="h6" color="rgb(238, 233, 226)" display="inline">
Projected Maturity
</Typography>
</Grid>
Expand All @@ -131,7 +134,7 @@ export const MaturityGraph = () => {
dataKeyLabels={dataKeyLabels}
infoTooltipMessage={""}
isLoading={!coolerSnapshots}
tickStyle={getTickStyle(theme)}
tickStyle={tickStyle}
itemDecimals={0}
margin={{ left: 30 }}
displayTooltipTotal={true}
Expand Down
10 changes: 9 additions & 1 deletion src/views/Lending/Cooler/dashboard/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ export const TotalCapacityRemaining = () => {
label="Total Capacity Remaining"
metric={formatCurrency(getTotalCapacity(latestSnapshot), 0, "DAI")}
isLoading={latestSnapshot === undefined}
tooltip="The value of the total capacity remaining in the clearinghouse and treasury"
tooltip={`The capacity remaining is the sum of the DAI and sDAI in the clearinghouse and treasury. As of the latest snapshot, the values (in DAI) are:

Clearinghouse:
DAI: ${formatCurrency(latestSnapshot?.clearinghouse?.daiBalance || 0, 0, "DAI")}
sDAI: ${formatCurrency(latestSnapshot?.clearinghouse?.sDaiInDaiBalance || 0, 0, "DAI")}

Treasury:
DAI: ${formatCurrency(latestSnapshot?.treasury?.daiBalance || 0, 0, "DAI")}
sDAI: ${formatCurrency(latestSnapshot?.treasury?.sDaiInDaiBalance || 0, 0, "DAI")}`}
/>
);
};
Expand Down
9 changes: 6 additions & 3 deletions src/views/Lending/Cooler/dashboard/UtilisationGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ export const UtilisationGraph = ({ startDate }: { startDate?: Date }) => {
const bulletpointStyles = getBulletpointStylesMap(DEFAULT_BULLETPOINT_COLOURS, dataKeys);
const colorsMap = getDataKeyColorsMap(DEFAULT_COLORS, dataKeys);
const dataKeyLabels = getCategoriesMap(itemNames, dataKeys);
const tickStyle = getTickStyle(theme);
tickStyle.stroke = "#8A8B90";
tickStyle.fill = "#8A8B90";

return (
<Grid container>
<Grid item xs={12}>
<Typography variant="h6" color="textSecondary" display="inline">
<Grid item xs={12} paddingBottom={1}>
<Typography variant="h6" color="rgb(238, 233, 226)" display="inline">
Utilisation
</Typography>
</Grid>
Expand All @@ -72,7 +75,7 @@ export const UtilisationGraph = ({ startDate }: { startDate?: Date }) => {
dataKeyLabels={dataKeyLabels}
infoTooltipMessage={""}
isLoading={!coolerSnapshots}
tickStyle={getTickStyle(theme)}
tickStyle={tickStyle}
itemDecimals={0}
margin={{ left: 30 }}
/>
Expand Down
Loading