import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Badge, List, ListItem, ListItemText, ListItemTitle, Switch, showToast } from "@calcom/ui"; export const FlagAdminList = () => { const [data] = trpc.viewer.features.list.useSuspenseQuery(); return ( {data.map((flag) => (
{flag.slug}    {flag.type?.replace("_", " ")} {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.admin.toggleFeatureFlag.useMutation({ onSuccess: () => { showToast("Flags successfully updated", "success"); utils.viewer.features.list.invalidate(); utils.viewer.features.map.invalidate(); }, }); return ( { mutation.mutate({ slug, enabled: checked }); }} /> ); };