import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Badge, List, ListItem, ListItemText, ListItemTitle, Switch } from "@calcom/ui"; export const FlagAdminList = () => { const [data] = trpc.viewer.features.list.useSuspenseQuery(); return ( {data.map((flag) => ( {flag.slug} {flag.type} {flag.description} ))} ); }; type Flag = RouterOutputs["viewer"]["features"]["list"][number]; const FlagToggle = (props: { flag: Flag }) => { const { flag: { slug, enabled }, } = props; const utils = trpc.useContext(); const mutation = trpc.viewer.features.toggle.useMutation({ onSuccess: () => { utils.viewer.features.list.invalidate(); utils.viewer.features.map.invalidate(); }, }); return ( { mutation.mutate({ slug, enabled: checked }); }} /> ); };