42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
'use client';
|
|
import 'reflect-metadata';
|
|
|
|
import { FC, useCallback } from 'react';
|
|
import useSWR from 'swr';
|
|
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
|
|
import { AddEditModal } from '@gitroom/frontend/components/launches/add.edit.model';
|
|
import dayjs from 'dayjs';
|
|
|
|
export const StandaloneModal: FC = () => {
|
|
const fetch = useFetch();
|
|
const load = useCallback(async (path: string) => {
|
|
return (await (await fetch(path)).json()).integrations;
|
|
}, []);
|
|
|
|
const {
|
|
isLoading,
|
|
data: integrations,
|
|
mutate,
|
|
} = useSWR('/integrations/list', load, {
|
|
fallbackData: [],
|
|
});
|
|
|
|
if (isLoading) {
|
|
return <div className="w-full h-full flex items-center justify-center">Loading...</div>;
|
|
}
|
|
|
|
return (
|
|
<AddEditModal
|
|
customClose={() => {
|
|
window.parent.postMessage({ action: 'closeIframe' }, '*');
|
|
}}
|
|
padding="50px"
|
|
mutate={() => {}}
|
|
integrations={integrations}
|
|
reopenModal={() => {}}
|
|
allIntegrations={integrations}
|
|
date={dayjs()}
|
|
/>
|
|
);
|
|
};
|