2021-07-31 15:57:43 +00:00
|
|
|
import { Suspense } from "react";
|
|
|
|
import type { BlitzPage } from "blitz";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-10-17 22:06:45 +00:00
|
|
|
import AppLayout from "app/core/layouts/layout";
|
2021-10-15 22:24:28 +00:00
|
|
|
import MissingTwilioCredentials from "app/core/components/missing-twilio-credentials";
|
|
|
|
import useCurrentUser from "app/core/hooks/use-current-user";
|
2021-10-19 21:56:16 +00:00
|
|
|
import PageTitle from "app/core/components/page-title";
|
|
|
|
import Spinner from "app/core/components/spinner";
|
|
|
|
import InactiveSubscription from "app/core/components/inactive-subscription";
|
|
|
|
import PhoneCallsList from "../components/phone-calls-list";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
|
|
|
const PhoneCalls: BlitzPage = () => {
|
2021-10-20 22:01:03 +00:00
|
|
|
const { hasFilledTwilioCredentials, hasPhoneNumber, hasOngoingSubscription } = useCurrentUser();
|
2021-10-15 22:24:28 +00:00
|
|
|
|
2021-10-15 23:25:13 +00:00
|
|
|
if (!hasFilledTwilioCredentials || !hasPhoneNumber) {
|
2021-10-15 22:24:28 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<MissingTwilioCredentials />
|
2021-10-17 22:06:45 +00:00
|
|
|
<PageTitle className="filter blur-sm select-none absolute top-0" title="Calls" />
|
2021-10-15 22:24:28 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-10-20 22:01:03 +00:00
|
|
|
if (!hasOngoingSubscription) {
|
2021-10-19 21:56:16 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<InactiveSubscription />
|
|
|
|
<div className="filter blur-sm select-none absolute top-0 w-full h-full z-0">
|
|
|
|
<PageTitle title="Calls" />
|
|
|
|
<section className="relative flex flex-grow flex-col">
|
|
|
|
<Suspense fallback={<Spinner />}>
|
|
|
|
<PhoneCallsList />
|
|
|
|
</Suspense>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-07-31 14:33:18 +00:00
|
|
|
return (
|
2021-08-01 03:05:40 +00:00
|
|
|
<>
|
2021-10-15 22:24:28 +00:00
|
|
|
<PageTitle className="pl-12" title="Calls" />
|
2021-09-24 23:07:40 +00:00
|
|
|
<section className="flex flex-grow flex-col">
|
2021-10-17 22:06:45 +00:00
|
|
|
<Suspense fallback={<Spinner />}>
|
|
|
|
{/* TODO: skeleton phone calls list */}
|
2021-09-24 23:07:40 +00:00
|
|
|
<PhoneCallsList />
|
|
|
|
</Suspense>
|
|
|
|
</section>
|
2021-08-01 03:05:40 +00:00
|
|
|
</>
|
2021-07-31 15:57:43 +00:00
|
|
|
);
|
|
|
|
};
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-10-17 22:06:45 +00:00
|
|
|
PhoneCalls.getLayout = (page) => <AppLayout title="Calls">{page}</AppLayout>;
|
2021-08-01 03:05:40 +00:00
|
|
|
|
2021-07-31 15:57:43 +00:00
|
|
|
export default PhoneCalls;
|