MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / Dashboard

Function Dashboard

pages/api-settings.tsx:25–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25function Dashboard() {
26 const { profile } = useProfile();
27 const supabase = useSupabaseClient();
28 const [token, setToken] = React.useState<string>("");
29 const [showKey, setShowKey] = React.useState<boolean>(false);
30 const [copyFeedback, setCopyFeedback] = React.useState<boolean>(false);
31 const [warningOpen, setWarningOpen] = React.useState<boolean>(false);
32
33 useEffect(() => {
34 if (profile) {
35 setToken(profile?.organizations?.api_key || "");
36 }
37 }, [profile]);
38
39 return (
40 <>
41 <WarningModal
42 title={"Deactivate previous API key?"}
43 description={
44 "By regenerating the organization's API key, you deactivate the previous one. Are you sure you want to do this?"
45 }
46 action={async () => {
47 const key = generateApiKey();
48 setToken(key);
49 const res = await supabase
50 .from("organizations")
51 .update({ api_key: key })
52 .eq("id", profile?.org_id);
53 if (res.error) throw res.error;
54 }}
55 actionColour={"purple"}
56 actionName={"Deactivate previous key"}
57 open={warningOpen}
58 setOpen={setWarningOpen}
59 />
60 <div className="min-h-screen bg-gray-800">
61 <Navbar current={"API"} />
62 <div className="h-[calc(100vh-4rem)] flex flex-col gap-y-4 mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
63 <div className="mt-8 bg-gray-850 rounded-md px-6 pt-4 pb-6">
64 <h2 className="text-xl text-gray-100">Superflows API key</h2>
65 <p className="mt-1 text-gray-400">
66 The Superflows API is secured behind a gateway which requires an
67 API Key for every request.
68 <br />
69 This is a secret and should not be shared with anyone.
70 </p>
71 <div className="flex flex-col place-items-end">
72 <div className="flex flex-row gap-x-3 mt-4 justify-end">
73 {token && (
74 <div className="font-mono rounded font-bold bg-red-700 text-gray-100 text-sm px-1.5 py-1 h-fit">
75 secret
76 </div>
77 )}
78 <div className="relative border border-gray-600 rounded-md bg-gray-800 text-gray-400 px-20 py-0.5 text-center">
79 {showKey ? token : "sfk-********-****-****-****-************"}
80 <div className="absolute left-1.5 top-0.5">
81 <button
82 className={

Callers

nothing calls this directly

Calls 3

useProfileFunction · 0.90
generateApiKeyFunction · 0.90
classNamesFunction · 0.85

Tested by

no test coverage detected