dynamic import rainbow (only if installed) (#4409)

pull/4428/head^2
hexcowboy 2022-09-13 03:59:53 -07:00 committed by GitHub
parent b2d3432438
commit 5db525a62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1,8 +1,7 @@
import dynamic from "next/dynamic";
import { Dispatch, useState, useEffect } from "react"; import { Dispatch, useState, useEffect } from "react";
import { JSONObject } from "superjson/dist/types"; import { JSONObject } from "superjson/dist/types";
import RainbowGate from "@calcom/app-store/rainbow/components/RainbowKit";
export type Gate = undefined | "rainbow"; // Add more like ` | "geolocation" | "payment"` export type Gate = undefined | "rainbow"; // Add more like ` | "geolocation" | "payment"`
export type GateState = { export type GateState = {
@ -16,6 +15,8 @@ type GateProps = {
dispatch: Dispatch<Partial<GateState>>; dispatch: Dispatch<Partial<GateState>>;
}; };
const RainbowGate = dynamic(() => import("@calcom/app-store/rainbow/components/RainbowKit"));
// To add a new Gate just add the gate logic to the switch statement // To add a new Gate just add the gate logic to the switch statement
const Gates: React.FC<GateProps> = ({ children, gates, metadata, dispatch }) => { const Gates: React.FC<GateProps> = ({ children, gates, metadata, dispatch }) => {
const [rainbowToken, setRainbowToken] = useState<string>(); const [rainbowToken, setRainbowToken] = useState<string>();