blur phone call history if on free plan

This commit is contained in:
m5r
2021-10-19 23:56:16 +02:00
parent fd003f461b
commit 59b13bd0ea
5 changed files with 61 additions and 7 deletions

View File

@ -7,8 +7,10 @@ import PhoneInitLoader from "app/core/components/phone-init-loader";
import EmptyCalls from "../components/empty-calls";
import usePhoneCalls from "../hooks/use-phone-calls";
import { formatRelativeDate } from "app/core/helpers/date-formatter";
import useCurrentUser from "app/core/hooks/use-current-user";
export default function PhoneCallsList() {
const { hasActiveSubscription } = useCurrentUser();
const [phoneCalls, query] = usePhoneCalls();
useEffect(() => {
@ -23,7 +25,7 @@ export default function PhoneCallsList() {
}
if (phoneCalls.length === 0) {
return <EmptyCalls />;
return hasActiveSubscription ? <EmptyCalls /> : null;
}
return (

View File

@ -3,14 +3,15 @@ import type { BlitzPage } from "blitz";
import { Routes } from "blitz";
import AppLayout from "app/core/layouts/layout";
import PhoneCallsList from "../components/phone-calls-list";
import MissingTwilioCredentials from "app/core/components/missing-twilio-credentials";
import useCurrentUser from "app/core/hooks/use-current-user";
import PageTitle from "../../core/components/page-title";
import Spinner from "../../core/components/spinner";
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";
const PhoneCalls: BlitzPage = () => {
const { hasFilledTwilioCredentials, hasPhoneNumber } = useCurrentUser();
const { hasFilledTwilioCredentials, hasPhoneNumber, hasActiveSubscription } = useCurrentUser();
if (!hasFilledTwilioCredentials || !hasPhoneNumber) {
return (
@ -21,6 +22,22 @@ const PhoneCalls: BlitzPage = () => {
);
}
if (!hasActiveSubscription) {
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>
</>
);
}
return (
<>
<PageTitle className="pl-12" title="Calls" />