Metamigo frontend updates
This commit is contained in:
parent
9edbeed056
commit
6e3e178187
9 changed files with 56 additions and 56 deletions
|
|
@ -1,11 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|
@ -20,10 +16,7 @@
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./*", "../../node_modules/*"]
|
||||||
"./*",
|
|
||||||
"../../node_modules/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
|
|
@ -31,13 +24,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules", "babel__core"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".next/types/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ type AccountEditToolbarProps = {
|
||||||
record?: any;
|
record?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AccountEditToolbar: FC<AccountEditToolbarProps> = (props: any) => {
|
const AccountEditToolbar: FC<AccountEditToolbarProps> = (props) => {
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
const classes = useStyles(props);
|
const classes = useStyles(props);
|
||||||
return (
|
return (
|
||||||
|
|
@ -43,7 +43,7 @@ const AccountTitle = ({ record }: { record?: any }) => {
|
||||||
return <span>Account {title}</span>;
|
return <span>Account {title}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AccountEdit = (props: EditProps) => (
|
export const AccountEdit: FC<EditProps> = (props) => (
|
||||||
<Edit title={<AccountTitle />} {...props}>
|
<Edit title={<AccountTitle />} {...props}>
|
||||||
<SimpleForm toolbar={<AccountEditToolbar />}>
|
<SimpleForm toolbar={<AccountEditToolbar />}>
|
||||||
<TextInput disabled source="id" />
|
<TextInput disabled source="id" />
|
||||||
|
|
@ -58,4 +58,5 @@ export const AccountEdit = (props: EditProps) => (
|
||||||
</SimpleForm>
|
</SimpleForm>
|
||||||
</Edit>
|
</Edit>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default AccountEdit;
|
export default AccountEdit;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type DeleteNotSelfButtonProps = {
|
||||||
record?: any;
|
record?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DeleteNotSelfButton: FC<DeleteNotSelfButtonProps> = (props: any) => {
|
const DeleteNotSelfButton: FC<DeleteNotSelfButtonProps> = (props) => {
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
return (
|
return (
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
@ -27,7 +27,7 @@ const DeleteNotSelfButton: FC<DeleteNotSelfButtonProps> = (props: any) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AccountList = (props: ListProps) => (
|
export const AccountList: FC<ListProps> = (props) => (
|
||||||
<List {...props} exporter={false}>
|
<List {...props} exporter={false}>
|
||||||
<Datagrid rowClick="edit">
|
<Datagrid rowClick="edit">
|
||||||
<ReferenceField source="userId" reference="users">
|
<ReferenceField source="userId" reference="users">
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,19 @@ const CustomUserMenu = (props: any) => (
|
||||||
const CustomAppBar = (props: any) => {
|
const CustomAppBar = (props: any) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<AppBar {...props} elevation={1} userMenu={<CustomUserMenu />}>
|
<AppBar
|
||||||
|
{...props}
|
||||||
|
elevation={1}
|
||||||
|
userMenu={<CustomUserMenu />}
|
||||||
|
position="sticky"
|
||||||
|
sx={{ mt: -1 }}
|
||||||
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
color="inherit"
|
color="inherit"
|
||||||
className={classes.title}
|
className={classes.title}
|
||||||
id="react-admin-title"
|
id="react-admin-title"
|
||||||
/>
|
/>
|
||||||
<span className={classes.spacer} />
|
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { FC } from "react";
|
||||||
import {
|
import {
|
||||||
SimpleForm,
|
SimpleForm,
|
||||||
Create,
|
Create,
|
||||||
|
|
@ -10,7 +11,7 @@ import {
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import { validateE164Number } from "../../../_lib/phone-numbers";
|
import { validateE164Number } from "../../../_lib/phone-numbers";
|
||||||
|
|
||||||
const SignalBotCreate = (props: CreateProps) => {
|
const SignalBotCreate:FC<CreateProps> = (props) => {
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { FC } from "react";
|
||||||
import { SimpleForm, Edit, TextInput, required, EditProps } from "react-admin";
|
import { SimpleForm, Edit, TextInput, required, EditProps } from "react-admin";
|
||||||
|
|
||||||
const SignalBotEdit = (props: EditProps) => (
|
const SignalBotEdit: FC<EditProps> = (props) => (
|
||||||
<Edit {...props} title="Edit Bot">
|
<Edit {...props} title="Edit Bot">
|
||||||
<SimpleForm>
|
<SimpleForm>
|
||||||
<TextInput disabled source="phoneNumber" validate={[required()]} />
|
<TextInput disabled source="phoneNumber" validate={[required()]} />
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { FC } from "react";
|
||||||
import {
|
import {
|
||||||
List,
|
List,
|
||||||
Datagrid,
|
Datagrid,
|
||||||
|
|
@ -9,7 +10,7 @@ import {
|
||||||
ListProps,
|
ListProps,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
|
|
||||||
const SignalBotList = (props: ListProps) => (
|
const SignalBotList: FC<ListProps> = (props) => (
|
||||||
<List {...props} exporter={false}>
|
<List {...props} exporter={false}>
|
||||||
<Datagrid rowClick="show">
|
<Datagrid rowClick="show">
|
||||||
<TextField source="phoneNumber" />
|
<TextField source="phoneNumber" />
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import { FC, useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Show,
|
Show,
|
||||||
SimpleShowLayout,
|
SimpleShowLayout,
|
||||||
|
|
@ -175,7 +175,7 @@ const VerificationCodeRequest = ({
|
||||||
onSuccess,
|
onSuccess,
|
||||||
onError,
|
onError,
|
||||||
}: any) => {
|
}: any) => {
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
await handleRequestCode({
|
await handleRequestCode({
|
||||||
verifyMode,
|
verifyMode,
|
||||||
|
|
@ -209,8 +209,8 @@ const VerificationCaptcha = ({
|
||||||
onError,
|
onError,
|
||||||
handleClose,
|
handleClose,
|
||||||
}: any) => {
|
}: any) => {
|
||||||
const [code, setCode] = React.useState(undefined);
|
const [code, setCode] = useState(undefined);
|
||||||
const [isSubmitting, setSubmitting] = React.useState(false);
|
const [isSubmitting, setSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmitVerification = async () => {
|
const handleSubmitVerification = async () => {
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
@ -271,10 +271,10 @@ const VerificationCodeInput = ({
|
||||||
handleRestartVerification,
|
handleRestartVerification,
|
||||||
confirmVerification,
|
confirmVerification,
|
||||||
}: any) => {
|
}: any) => {
|
||||||
const [code, setValue] = React.useState("");
|
const [code, setValue] = useState("");
|
||||||
const [isSubmitting, setSubmitting] = React.useState(false);
|
const [isSubmitting, setSubmitting] = useState(false);
|
||||||
const [isValid, setValid] = React.useState(false);
|
const [isValid, setValid] = useState(false);
|
||||||
const [submissionError, setSubmissionError] = React.useState(undefined);
|
const [submissionError, setSubmissionError] = useState(undefined);
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
|
|
||||||
const validator = (v: any) => v.trim().length === 6;
|
const validator = (v: any) => v.trim().length === 6;
|
||||||
|
|
@ -361,7 +361,7 @@ const VerificationCodeInput = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const VerificationCodeDialog = (props: any) => {
|
const VerificationCodeDialog = (props: any) => {
|
||||||
const [stage, setStage] = React.useState("request");
|
const [stage, setStage] = useState("request");
|
||||||
const onRequestSuccess = () => setStage("verify");
|
const onRequestSuccess = () => setStage("verify");
|
||||||
const onRestartVerification = () => setStage("request");
|
const onRestartVerification = () => setStage("request");
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|
@ -412,8 +412,8 @@ const VerificationCodeDialog = (props: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const SignalBotShowActions = ({ data }: any) => {
|
const SignalBotShowActions = ({ data }: any) => {
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [verifyMode, setVerifyMode] = React.useState("");
|
const [verifyMode, setVerifyMode] = useState("");
|
||||||
const refresh = useRefresh();
|
const refresh = useRefresh();
|
||||||
|
|
||||||
const handleOpenSMS = () => {
|
const handleOpenSMS = () => {
|
||||||
|
|
@ -458,7 +458,7 @@ const SignalBotShowActions = ({ data }: any) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const SignalBotShow = (props: ShowProps) => (
|
const SignalBotShow: FC<ShowProps> = (props) => (
|
||||||
<Show
|
<Show
|
||||||
actions={<SignalBotShowActions />}
|
actions={<SignalBotShowActions />}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { FC } from "react";
|
||||||
/* eslint-disable react/display-name */
|
/* eslint-disable react/display-name */
|
||||||
import {
|
import {
|
||||||
SelectInput,
|
SelectInput,
|
||||||
|
|
@ -9,21 +10,25 @@ import {
|
||||||
TextField,
|
TextField,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
|
|
||||||
export const SignalBotSelectInput = (source: string) => () =>
|
export const SignalBotSelectInput =
|
||||||
(
|
(source: string): FC =>
|
||||||
<ReferenceInput
|
() =>
|
||||||
label="Signal Bot"
|
(
|
||||||
source={source}
|
<ReferenceInput
|
||||||
reference="signalBots"
|
label="Signal Bot"
|
||||||
validate={[required()]}
|
source={source}
|
||||||
>
|
reference="signalBots"
|
||||||
<SelectInput optionText="phoneNumber" />
|
validate={[required()]}
|
||||||
</ReferenceInput>
|
>
|
||||||
);
|
<SelectInput optionText="phoneNumber" />
|
||||||
|
</ReferenceInput>
|
||||||
|
);
|
||||||
|
|
||||||
export const SignalBotField = (source: string) => () =>
|
export const SignalBotField =
|
||||||
(
|
(source: string): FC =>
|
||||||
<ReferenceField label="Signal Bot" reference="signalBots" source={source}>
|
() =>
|
||||||
<TextField source="phoneNumber" />
|
(
|
||||||
</ReferenceField>
|
<ReferenceField label="Signal Bot" reference="signalBots" source={source}>
|
||||||
);
|
<TextField source="phoneNumber" />
|
||||||
|
</ReferenceField>
|
||||||
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue