@@ -12,7 +12,7 @@ import { useMutation } from "@tanstack/react-query";
1212import { useRouter , useSearchParams } from "next/navigation" ;
1313import { useEffect , useState } from "react" ;
1414import { toast } from "sonner" ;
15- import { updateDeveloperAutoTopUp } from "@/actions/developers/update-auto-topup" ;
15+
1616import { CreditTransactionTable } from "../_components/CreditTransactionTable" ;
1717import { StatBox } from "../_components/StatBox" ;
1818import { useDevelopersContext } from "../DevelopersContext" ;
@@ -37,7 +37,6 @@ export function CreditsClient({
3737
3838 const app = apps . find ( ( a ) => a . id === selectedApp ) ;
3939 const balance = app ?. creditAccount ?. balanceMicroCredits ?? 0 ;
40- const autoTopUp = app ?. creditAccount ?. autoTopUpEnabled ?? false ;
4140
4241 useEffect ( ( ) => {
4342 if ( searchParams . get ( "purchase" ) === "success" ) {
@@ -69,21 +68,6 @@ export function CreditsClient({
6968 } ,
7069 } ) ;
7170
72- const autoTopUpMutation = useMutation ( {
73- mutationFn : ( enabled : boolean ) =>
74- updateDeveloperAutoTopUp ( {
75- appId : selectedApp ,
76- enabled,
77- thresholdMicroCredits : 500_000 ,
78- amountCents : 2500 ,
79- } ) ,
80- onSuccess : ( ) => {
81- toast . success ( "Auto top-up updated" ) ;
82- router . refresh ( ) ;
83- } ,
84- onError : ( ) => toast . error ( "Failed to update auto top-up" ) ,
85- } ) ;
86-
8771 return (
8872 < div className = "flex flex-col gap-5" >
8973 < div className = "flex items-center justify-between" >
@@ -161,20 +145,19 @@ export function CreditsClient({
161145
162146 < Card >
163147 < CardHeader >
164- < CardTitle > Auto Top-Up</ CardTitle >
148+ < CardTitle className = "flex items-center gap-2" >
149+ Auto Top-Up
150+ < span className = "text-xs font-normal px-2 py-0.5 rounded-full bg-gray-3 text-gray-11" >
151+ Coming soon
152+ </ span >
153+ </ CardTitle >
165154 < CardDescription >
166155 Automatically add $25 when balance drops below $5.
167156 </ CardDescription >
168157 </ CardHeader >
169158 < div className = "mt-4" >
170- < Button
171- variant = { autoTopUp ? "dark" : "gray" }
172- size = "sm"
173- spinner = { autoTopUpMutation . isPending }
174- disabled = { autoTopUpMutation . isPending || ! selectedApp }
175- onClick = { ( ) => autoTopUpMutation . mutate ( ! autoTopUp ) }
176- >
177- { autoTopUp ? "Disable Auto Top-Up" : "Enable Auto Top-Up" }
159+ < Button variant = "gray" size = "sm" disabled >
160+ Enable Auto Top-Up
178161 </ Button >
179162 </ div >
180163 </ Card >
0 commit comments