Fix build errors

This commit is contained in:
Darren Clarke 2023-03-14 17:40:24 +00:00
parent 785d0965e3
commit d0f1c1337c
28 changed files with 268 additions and 112 deletions

View file

@ -1,6 +1,6 @@
import { List, Datagrid, TextField } from "react-admin";
const WhatsappAttachmentList = (props) => (
const WhatsappAttachmentList = (props: any) => (
<List {...props} exporter={false}>
<Datagrid rowClick="show">
<TextField source="id" />

View file

@ -3,7 +3,7 @@ import { SimpleForm, Create, TextInput, required } from "react-admin";
import { useSession } from "next-auth/react";
import { validateE164Number } from "../../../lib/phone-numbers";
const WhatsappBotCreate = (props) => {
const WhatsappBotCreate = (props: any) => {
// const MuiPhoneNumber = dynamic(() => import("material-ui-phone-number"), {
// ssr: false,
// });

View file

@ -6,7 +6,7 @@ import {
BooleanField,
} from "react-admin";
const WhatsappBotList = (props) => (
const WhatsappBotList = (props: any) => (
<List {...props} exporter={false}>
<Datagrid rowClick="show">
<TextField source="phoneNumber" />

View file

@ -12,8 +12,7 @@ import {
SimpleShowLayout,
TextField,
ShowProps,
useQuery,
useMutation,
useGetOne,
useRefresh,
BooleanField,
} from "react-admin";
@ -21,7 +20,7 @@ import QRCode from "react-qr-code";
import useSWR from "swr";
import RefreshIcon from "@material-ui/icons/Refresh";
const Sidebar = ({ record }) => {
const Sidebar = ({ record }: any) => {
const [receivedMessages, setReceivedMessages] = useState([]);
const [phoneNumber, setPhoneNumber] = useState("");
const handlePhoneNumberChange = (event: any) => {
@ -101,7 +100,7 @@ const Sidebar = ({ record }) => {
</IconButton>
</Grid>
</Grid>
{receivedMessages.map((receivedMessage, index) => (
{receivedMessages.map((receivedMessage: any, index: number) => (
<Grid key={index} item container direction="column" spacing={1}>
<Grid item style={{ fontWeight: "bold", color: "#999" }}>
{receivedMessage.key.remoteJid.replace("@s.whatsapp.net", "")}
@ -118,11 +117,7 @@ const Sidebar = ({ record }) => {
const WhatsappBotShow = (props: ShowProps) => {
const refresh = useRefresh();
const { data } = useQuery({
type: "getOne",
resource: "whatsappBots",
payload: { id: props.id },
});
const { data } = useGetOne("whatsappBots", props.id as any);
const { data: registerData, error: registerError } = useSWR(
data && !data?.isVerified
@ -150,10 +145,10 @@ const WhatsappBotShow = (props: ShowProps) => {
}, 10000);
return () => clearInterval(interval);
}
return undefined;
}, [refresh, data]);
return (
// @ts-expect-error: Missing props
<Show {...props} title="Bot" aside={<Sidebar />}>
<SimpleShowLayout>
<TextField source="phoneNumber" />