Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { HoldersAndDelegatesDrawer } from "@/features/holders-and-delegates";
import { ProposalHeaderProvider } from "@/features/governance/context/ProposalHeaderContext";
import { Button } from "@/shared/components";
import { ConnectWalletCustom } from "@/shared/components/wallet/ConnectWalletCustom";
import { TelegramBotMessage } from "@/shared/components/messages";
import daoConfig from "@/shared/dao-config";
import { DaoIdEnum } from "@/shared/types/daos";

Expand Down Expand Up @@ -276,11 +275,6 @@ export const ProposalSection = ({
proposal={proposal}
isOffchain={isOffchain}
/>
{!isOffchain && supportValue !== undefined ? (
<div className="border-border-default bg-surface-default border px-4 py-3">
<TelegramBotMessage />
</div>
) : null}
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the proposal Telegram CTA

For on-chain proposal pages where supportValue is available, this deletion removes the only in-page Telegram bot CTA instead of restyling it: the import and component are gone, and a repo-wide search for TelegramBotMessage / ANTICAPTURE_TELEGRAM_BOT shows no replacement in the proposal overview flow. The remaining alert links live in global/mobile header or other pages, so users on the desktop proposal view no longer see the proposal-specific security-updates CTA that this change set says it preserves.

Useful? React with 👍 / 👎.


<TabsSection
Expand Down
49 changes: 30 additions & 19 deletions apps/dashboard/features/revenue/components/KpiRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useMemo, useState } from "react";
import { ArrowDown, ArrowUp, Info } from "lucide-react";
import { ArrowDown, ArrowUp } from "lucide-react";
import {
useGetRevenueNewWallets,
useGetRevenueRenewalFunnel,
Expand Down Expand Up @@ -34,6 +34,9 @@ const WINDOW_BY_PERIOD: Record<string, KpiWindow> = {

const KPI_COUNT = 3;

const PERCENTAGE_POINTS_TOOLTIP =
"Percentage points: the absolute change between two percentages. Going from 30% to 39% is +9pp, not +9%.";

export const KpiRow = () => {
const [timePeriod, setTimePeriod] = useState("1y");

Expand Down Expand Up @@ -116,23 +119,9 @@ export const KpiRow = () => {
"border-border-default border-b lg:border-b-0 lg:border-r",
)}
>
<div className="flex items-center gap-1.5">
<p className="text-secondary text-sm font-medium">
{kpi.title}
</p>
{kpi.tooltip && (
<Tooltip
tooltipContent={
<p className="text-secondary text-sm font-normal leading-5">
{kpi.tooltip}
</p>
}
triggerClassName="inline-flex cursor-help items-center border-0 bg-transparent p-0"
>
<Info className="text-secondary size-3.5" />
</Tooltip>
)}
</div>
<p className="text-secondary text-sm font-medium">
{kpi.title}
</p>
<p className="text-primary mt-1 font-mono text-[30px] font-medium leading-9">
{kpi.value}
</p>
Expand All @@ -152,7 +141,29 @@ export const KpiRow = () => {
: "text-secondary"
}
>
{kpi.subtext}
{kpi.delta ? (
<>
{kpi.delta.value}
{kpi.delta.unit === "pp" ? (
<Tooltip
asChild
tooltipContent={
<p className="text-secondary text-sm font-normal leading-5">
{PERCENTAGE_POINTS_TOOLTIP}
</p>
}
triggerClassName="cursor-help underline decoration-dotted underline-offset-2"
>
<span>{kpi.delta.unit}</span>
</Tooltip>
) : (
kpi.delta.unit
)}{" "}
{kpi.delta.comparison}
</>
) : (
kpi.subtext
)}
</span>
</p>
</div>
Expand Down
6 changes: 5 additions & 1 deletion apps/dashboard/features/revenue/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export type KpiCard = {
title: string;
value: string;
subtext: string;
delta?: {
value: string;
unit: string;
comparison: string;
};
trend?: "up" | "down";
tooltip?: string;
};
19 changes: 11 additions & 8 deletions apps/dashboard/features/revenue/utils/transform/kpis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function buildFlowKpi<T extends { date: number }>(args: {
/** "pct" for sums, "pp" for averages-of-percentages */
deltaKind: "pct" | "pp";
window: KpiWindow;
tooltip?: string;
}): KpiCard {
const sinceLabel = buildSinceLabel(args.items);
const { current, previous } = splitIntoWindows(
Expand All @@ -55,17 +54,23 @@ function buildFlowKpi<T extends { date: number }>(args: {

const presentation =
args.window.months !== null && rawDelta !== null
? presentDelta(rawDelta, args.deltaKind === "pct" ? "%" : "pp")
? presentDelta(rawDelta)
: null;

const unit = args.deltaKind === "pct" ? "%" : "pp";

return {
title: args.title,
value: current.length > 0 ? args.formatValue(currentValue) : "—",
subtext: presentation
? `${presentation.text} vs prev. ${args.window.label}`
: sinceLabel,
subtext: sinceLabel,
delta: presentation
? {
value: presentation.text,
unit,
comparison: `vs prev. ${args.window.label}`,
}
: undefined,
trend: presentation?.trend,
tooltip: args.tooltip,
};
}

Expand Down Expand Up @@ -99,8 +104,6 @@ export function computeKpis(
formatValue: (n) => `${n.toFixed(0)}%`,
deltaKind: "pp",
window,
tooltip:
"Share of expiring names that were renewed. 'pp' (percentage points) is the absolute change between two percentages.",
}),
buildFlowKpi({
title: "Revenue",
Expand Down
16 changes: 3 additions & 13 deletions apps/dashboard/features/revenue/utils/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,15 @@ export type DeltaPresentation = {
trend: "up" | "down" | undefined;
};

/**
* Formats a percentage-ish delta with adaptive precision: up to 2 decimals
* for small magnitudes (<0.1), 1 decimal for [0.1, 1), 0 decimals otherwise.
* Returns the trend in lockstep with the rendered value — when the value
* rounds to 0 at the chosen precision, the trend is `undefined` (neutral).
*
* The point: a real +0.4% change should display as "+0.4%" with an up arrow,
* not "+0%" (which would erase the signal) and not "+0%" with an arrow
* (which would conflict with the rendered value).
*/
export function presentDelta(value: number, suffix: string): DeltaPresentation {
export function presentDelta(value: number): DeltaPresentation {
const abs = Math.abs(value);
const precision = abs >= 1 ? 0 : abs >= 0.1 ? 1 : 2;
// Snap to display precision so text and trend can never disagree.
const snapped = Number(value.toFixed(precision));
if (snapped === 0) return { text: `0${suffix}`, trend: undefined };
if (snapped === 0) return { text: "0", trend: undefined };
const prefix = snapped > 0 ? "+" : "";
return {
text: `${prefix}${snapped.toFixed(precision)}${suffix}`,
text: `${prefix}${snapped.toFixed(precision)}`,
trend: snapped > 0 ? "up" : "down",
};
}

This file was deleted.

1 change: 0 additions & 1 deletion apps/dashboard/shared/components/messages/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/dashboard/widgets/WhitelabelSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const WhitelabelSidebar = ({
rel="noopener noreferrer"
className="text-link"
>
Blockful
blockful
</a>
</p>
)}
Expand Down
Loading