dynamic import rainbow (only if installed) (#4409)
parent
b2d3432438
commit
5db525a62d
|
@ -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>();
|
||||||
|
|
Loading…
Reference in New Issue