MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / StripeCheckPaymentBanner

Function StripeCheckPaymentBanner

src/components/StripeCheckPaymentBanner.tsx:12–40  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

10}
11
12const StripeCheckPaymentBanner = (props: Props) => {
13 const { sessionId } = props;
14 const { t } = useTranslation();
15 const [hideBanner, setHideBanner] = useState(false);
16 const show = !hideBanner;
17
18 const router = useRouter();
19
20 // Fetch CheckoutSession from static page via
21 // https://nextjs.org/docs/basic-features/data-fetching#static-generation
22 const { data } = useSWR(router.query.session_id ? `/api/checkout_sessions/${sessionId}` : null, fetchGetJSON);
23
24 return (
25 <>
26 <div
27 className={`${
28 !show && "!hidden"
29 } relative w-full flex flex-row justify-start sm:justify-center items-center py-1 bg-gray-100 dark:bg-zinc-700`}
30 >
31 <div className="text-sm leading-6 pr-4 cursor-pointer">
32 {t("payment.self")} {data?.payment_intent?.status ?? t("common.loading")}
33 </div>
34 <button className="absolute right-2 sm:right-4 opacity-60 hover:opacity-100" onClick={() => setHideBanner(true)}>
35 <Icon.BiX className="w-6 h-auto" />
36 </button>
37 </div>
38 </>
39 );
40};
41
42export default StripeCheckPaymentBanner;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected