Skip to content

Commit 5469a4b

Browse files
committed
Improve the upgrade dashboard modal
1 parent 3d33ee5 commit 5469a4b

1 file changed

Lines changed: 66 additions & 10 deletions

File tree

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ export function SideMenu({
629629
isCollapsed
630630
? LineChartIcon
631631
: isLast
632-
? TreeConnectorEnd
633-
: TreeConnectorBranch
632+
? TreeConnectorEnd
633+
: TreeConnectorBranch
634634
}
635635
activeIconColor={isCollapsed ? "text-customDashboards" : undefined}
636636
inactiveIconColor={isCollapsed ? "text-customDashboards" : undefined}
@@ -1220,6 +1220,11 @@ function CreateDashboardButton({
12201220
);
12211221
}
12221222

1223+
const PROGRESS_RING_R = 27.5;
1224+
const PROGRESS_RING_CIRCUMFERENCE = 2 * Math.PI * PROGRESS_RING_R;
1225+
const PROGRESS_COLOR_SUCCESS = "#28BF5C"; // mint-500 / success
1226+
const PROGRESS_COLOR_ERROR = "#E11D48"; // rose-600 / error
1227+
12231228
function CreateDashboardUpgradeDialog({
12241229
limits,
12251230
canUpgrade,
@@ -1229,20 +1234,71 @@ function CreateDashboardUpgradeDialog({
12291234
canUpgrade: boolean;
12301235
organization: MatchedOrganization;
12311236
}) {
1237+
const percentage = Math.min(limits.used / limits.limit, 1);
1238+
const filled = percentage * PROGRESS_RING_CIRCUMFERENCE;
1239+
12321240
return (
12331241
<DialogContent>
1234-
<DialogHeader>You've exceeded your limit</DialogHeader>
1235-
<DialogDescription>
1236-
You've used {limits.used}/{limits.limit} of your custom dashboards.
1237-
</DialogDescription>
1238-
<DialogFooter>
1242+
<DialogHeader>Dashboard limit reached</DialogHeader>
1243+
<div className="flex items-center gap-4 pt-3">
1244+
<div className="relative ml-1 mt-2 shrink-0" style={{ width: 60, height: 60 }}>
1245+
<svg className="h-full w-full -rotate-90 overflow-visible">
1246+
<circle
1247+
className="fill-none stroke-grid-bright"
1248+
strokeWidth="5"
1249+
r={PROGRESS_RING_R}
1250+
cx="30"
1251+
cy="30"
1252+
/>
1253+
<motion.circle
1254+
className="fill-none"
1255+
strokeWidth="5"
1256+
r={PROGRESS_RING_R}
1257+
cx="30"
1258+
cy="30"
1259+
strokeLinecap="round"
1260+
initial={{
1261+
strokeDasharray: `0 ${PROGRESS_RING_CIRCUMFERENCE}`,
1262+
stroke: PROGRESS_COLOR_SUCCESS,
1263+
}}
1264+
animate={{
1265+
strokeDasharray: `${filled} ${PROGRESS_RING_CIRCUMFERENCE}`,
1266+
stroke: PROGRESS_COLOR_ERROR,
1267+
}}
1268+
transition={{ duration: 1.2, ease: "easeInOut" }}
1269+
/>
1270+
</svg>
1271+
<span className="absolute inset-0 flex items-center justify-center text-lg text-text-dimmed">
1272+
{limits.limit}
1273+
</span>
1274+
</div>
1275+
<DialogDescription className="pt-0">
1276+
{canUpgrade ? (
1277+
<>
1278+
You've used all {limits.limit} of your custom dashboards. Upgrade your plan to create
1279+
more.
1280+
</>
1281+
) : (
1282+
<>
1283+
You've used all {limits.limit} of your custom dashboards. To create more, request a
1284+
limit increase or visit the{" "}
1285+
<TextLink to={v3BillingPath(organization)}>billing page</TextLink> for pricing
1286+
details.
1287+
</>
1288+
)}
1289+
</DialogDescription>
1290+
</div>
1291+
<DialogFooter className="flex justify-between">
1292+
<DialogClose asChild>
1293+
<Button variant="secondary/medium">Cancel</Button>
1294+
</DialogClose>
12391295
{canUpgrade ? (
1240-
<LinkButton variant="primary/small" to={v3BillingPath(organization)}>
1241-
Upgrade
1296+
<LinkButton variant="primary/medium" to={v3BillingPath(organization)}>
1297+
Upgrade plan
12421298
</LinkButton>
12431299
) : (
12441300
<Feedback
1245-
button={<Button variant="primary/small">Request more</Button>}
1301+
button={<Button variant="primary/medium">Request increase…</Button>}
12461302
defaultValue="help"
12471303
/>
12481304
)}

0 commit comments

Comments
 (0)