* mv PaymentPage to web * mv 2 more components to web * refactor * update imports * mv * revert * fix * fix * update * migrate relevant test too * move setup components to web from appstore * move wipemycalother * mv * fix typechecks * mv more routing forms components * fix * fix * fix * fix: resolve type errors in SingleForm.tsx after migration - Updated SingleFormComponentProps type to include enriched form properties - Added proper typing for user, team, nonOrgUsername, nonOrgTeamslug, userOrigin, teamOrigin - Fixes type errors that occurred after migrating SingleForm.tsx from packages/app-store/routing-forms/components/ - Resolves both SingleForm.tsx and TestForm.tsx type errors Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * delete * refactors * fix * fix * fix * remove usage of trpc client from OmniInstallAppButton.tsx * fix test * import only type * fix test * remove trpc package from appstore package.json * remove remaining trpc usage * update test * fix type checks * fix errors * fix * make it error * nit --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
22 lines
634 B
TypeScript
22 lines
634 B
TypeScript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export function DynamicComponent<T extends Record<string, React.ComponentType<any>>>(props: {
|
|
componentMap: T;
|
|
slug: string;
|
|
onAppInstallSuccess?: () => void;
|
|
wrapperClassName?: string;
|
|
}) {
|
|
const { componentMap, slug, wrapperClassName, ...rest } = props;
|
|
const dirName = slug === "stripe" ? "stripepayment" : slug;
|
|
|
|
// There can be apps with no matching component
|
|
if (!componentMap[dirName]) return null;
|
|
|
|
const Component = componentMap[dirName];
|
|
|
|
return (
|
|
<div className={wrapperClassName || ""}>
|
|
<Component {...rest} />
|
|
</div>
|
|
);
|
|
}
|