mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix pr review comments
This commit is contained in:
parent
864b0db1fb
commit
c80034ad1f
@ -400,6 +400,7 @@ describe("ProjectOnboardingWizard", () => {
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("button", { name: "Do Later" }).getAttribute("data-loading")).toBe("true");
|
||||
});
|
||||
expect(screen.getByRole("button", { name: "Do Later" }).hasAttribute("disabled")).toBe(true);
|
||||
expect(screen.getByRole("button", { name: "Connect" }).hasAttribute("disabled")).toBe(true);
|
||||
expect(screen.getByRole("button", { name: "Connect" }).getAttribute("data-loading")).toBe("false");
|
||||
});
|
||||
@ -455,6 +456,7 @@ describe("ProjectOnboardingWizard", () => {
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("button", { name: "Connect" }).getAttribute("data-loading")).toBe("true");
|
||||
});
|
||||
expect(screen.getByRole("button", { name: "Connect" }).hasAttribute("disabled")).toBe(true);
|
||||
expect(screen.getByRole("button", { name: "Do Later" }).hasAttribute("disabled")).toBe(true);
|
||||
expect(screen.getByRole("button", { name: "Do Later" }).getAttribute("data-loading")).toBe("false");
|
||||
});
|
||||
|
||||
@ -378,8 +378,8 @@ export function ProjectOnboardingWizard(props: {
|
||||
]);
|
||||
|
||||
const deferPaymentsSetup = useCallback(async () => {
|
||||
setPaymentsSetupAction("defer");
|
||||
await runWithSaving(async () => {
|
||||
setPaymentsSetupAction("defer");
|
||||
try {
|
||||
if (selectedPaymentsCountry === "US") {
|
||||
await props.project.app.setupPayments();
|
||||
@ -393,8 +393,8 @@ export function ProjectOnboardingWizard(props: {
|
||||
}, [persistOnboardingState, props.project.app, runWithSaving, selectedPaymentsCountry, setStatus]);
|
||||
|
||||
const connectPaymentsSetup = useCallback(async () => {
|
||||
setPaymentsSetupAction("connect");
|
||||
await runWithSaving(async () => {
|
||||
setPaymentsSetupAction("connect");
|
||||
try {
|
||||
const setup = await props.project.app.setupPayments();
|
||||
const redirectUrl = new URL(setup.url);
|
||||
@ -926,7 +926,7 @@ export function ProjectOnboardingWizard(props: {
|
||||
primaryAction={
|
||||
<DesignButton
|
||||
className="rounded-full px-6"
|
||||
disabled={saving && paymentsSetupAction !== "defer"}
|
||||
disabled={saving || paymentsSetupAction != null}
|
||||
loading={paymentsSetupAction === "defer"}
|
||||
onClick={() => runAsynchronouslyWithAlert(deferPaymentsSetup)}
|
||||
>
|
||||
@ -937,7 +937,7 @@ export function ProjectOnboardingWizard(props: {
|
||||
<DesignButton
|
||||
className="rounded-full px-6"
|
||||
variant="outline"
|
||||
disabled={saving && paymentsSetupAction !== "connect"}
|
||||
disabled={saving || paymentsSetupAction != null}
|
||||
loading={paymentsSetupAction === "connect"}
|
||||
onClick={() => runAsynchronouslyWithAlert(connectPaymentsSetup)}
|
||||
>
|
||||
|
||||
@ -2492,7 +2492,7 @@ function RevenueHoverTooltip({ active, payload }: TooltipProps<number, string>)
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<span className="h-2 w-2 rounded-full" style={{ backgroundColor: "hsl(355, 70%, 68%)" }} />
|
||||
<span className="h-2 w-2 rounded-full" style={{ backgroundColor: "var(--color-refund_cents)" }} />
|
||||
<span className="text-[11px] text-muted-foreground">Refunds</span>
|
||||
<span className="ml-auto font-mono text-xs font-semibold tabular-nums text-foreground">
|
||||
{formatUsdCompact(row.refund_cents)}
|
||||
|
||||
@ -162,12 +162,12 @@ export function AnalyticsChartPie({
|
||||
return config;
|
||||
}, [canonicalSeries, segmentColors]);
|
||||
|
||||
const activeRow = hoverKey
|
||||
const activeRow = hoverKey != null
|
||||
? legendRows.find((r) => r.key === hoverKey) ?? null
|
||||
: null;
|
||||
const [centerDisplayKey, setCenterDisplayKey] = useState<string | null>(null);
|
||||
const [centerDisplayVisible, setCenterDisplayVisible] = useState(true);
|
||||
const centerDisplayRow = centerDisplayKey
|
||||
const centerDisplayRow = centerDisplayKey != null
|
||||
? legendRows.find((r) => r.key === centerDisplayKey) ?? null
|
||||
: null;
|
||||
useEffect(() => {
|
||||
@ -197,7 +197,7 @@ export function AnalyticsChartPie({
|
||||
|
||||
const outerData = legendRows.map((r) => ({ name: cssIdent(r.key), hoverKey: r.key, value: r.value, fill: r.fill }));
|
||||
const innerData = legendRows.map((r) => ({ name: cssIdent(r.key), hoverKey: r.key, value: r.prevValue, fill: r.fillCompare }));
|
||||
const activeIdx = hoverKey ? legendRows.findIndex((r) => r.key === hoverKey) : -1;
|
||||
const activeIdx = hoverKey != null ? legendRows.findIndex((r) => r.key === hoverKey) : -1;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Loading…
Reference in New Issue
Block a user