Move metamigo assets to metamigo-add

This commit is contained in:
Darren Clarke 2023-08-25 11:04:38 +02:00
parent aab5b7f5d5
commit 28f7f0f47b
71 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1,33 @@
"use client";
import {
SimpleForm,
TextInput,
Create,
PasswordInput,
CreateProps,
} from "react-admin";
import { ProviderKindInput } from "./shared";
// import TextField from "@mui/material/TextField";
/* const TwilioCredentialsInput = () => (
<span>
<TextField name="accountSid" label="Account Sid" />
<TextField name="authToken" label="Auth Token" />
</span>
); */
const ProviderCreate = (props: CreateProps) => (
<Create {...props} title="Create Providers">
<SimpleForm>
<ProviderKindInput />
<TextInput source="name" />
<TextInput source="credentials.accountSid" />
<TextInput source="credentials.apiKeySid" />
<PasswordInput source="credentials.apiKeySecret" />
</SimpleForm>
</Create>
);
export default ProviderCreate;

View file

@ -0,0 +1,31 @@
"use client";
import {
SimpleForm,
TextInput,
PasswordInput,
Edit,
EditProps,
} from "react-admin";
import { ProviderKindInput } from "./shared";
const ProviderTitle = ({ record }: { record?: any }) => {
let title = "";
if (record) title = record.name ?? record.email;
return <span>Provider {title}</span>;
};
const ProviderEdit = (props: EditProps) => (
<Edit title={<ProviderTitle />} {...props}>
<SimpleForm>
<TextInput disabled source="id" />
<ProviderKindInput disabled />
<TextInput source="name" />
<TextInput source="credentials.accountSid" />
<TextInput source="credentials.apiKeySid" />
<PasswordInput source="credentials.apiKeySecret" />
</SimpleForm>
</Edit>
);
export default ProviderEdit;

View file

@ -0,0 +1,16 @@
"use client";
import { List, Datagrid, DateField, TextField, ListProps } from "react-admin";
const ProviderList = (props: ListProps) => (
<List {...props} exporter={false}>
<Datagrid rowClick="edit">
<TextField source="kind" />
<TextField source="name" />
<DateField source="createdAt" />
<DateField source="updatedAt" />
</Datagrid>
</List>
);
export default ProviderList;

View file

@ -0,0 +1,14 @@
"use client";
/* eslint-disable import/no-anonymous-default-export */
import ProviderIcon from "@mui/icons-material/Business";
import ProviderList from "./ProviderList";
import ProviderEdit from "./ProviderEdit";
import ProviderCreate from "./ProviderCreate";
export default {
list: ProviderList,
create: ProviderCreate,
edit: ProviderEdit,
icon: ProviderIcon,
};

View file

@ -0,0 +1,11 @@
"use client";
import { SelectInput } from "react-admin";
export const ProviderKindInput = (props: any) => (
<SelectInput
source="kind"
choices={[{ id: "TWILIO", name: "Twilio" }]}
{...props}
/>
);