Update return type for Facebook verification
This commit is contained in:
parent
f6dc60eb08
commit
e22a8e8d98
7 changed files with 939 additions and 475 deletions
|
|
@ -6,6 +6,7 @@ import { useRouter } from "next/navigation";
|
|||
import { DisplayTextField, Button, Dialog, colors, typography } from "ui";
|
||||
import { Selectable } from "kysely";
|
||||
import { type Database } from "bridge-common";
|
||||
import { QRCode } from "./QRCode";
|
||||
import { generateDeleteAction } from "../lib/actions";
|
||||
import { serviceConfig } from "../config/config";
|
||||
import { FieldDescription } from "../lib/service";
|
||||
|
|
@ -70,13 +71,24 @@ export const Detail: FC<DetailProps> = ({ service, row }) => {
|
|||
<Grid container direction="row" rowSpacing={3} columnSpacing={2}>
|
||||
{fields.map((field: FieldDescription) => (
|
||||
<Grid item xs={field.size ?? 6} key={field.name}>
|
||||
<DisplayTextField
|
||||
name={field.name}
|
||||
label={field.label}
|
||||
lines={field.lines ?? 1}
|
||||
value={row[field.name] as string}
|
||||
copyable={field.copyable ?? false}
|
||||
/>
|
||||
{field.kind === "qrcode" && (
|
||||
<QRCode
|
||||
name={field.name}
|
||||
label={field.label}
|
||||
getValue={field.getValue}
|
||||
id={row["id"] as string}
|
||||
helperText={field.helperText}
|
||||
/>
|
||||
)}
|
||||
{(!field.kind || field.kind === "text") && (
|
||||
<DisplayTextField
|
||||
name={field.name}
|
||||
label={field.label}
|
||||
lines={field.lines ?? 1}
|
||||
value={row[field.name] as string}
|
||||
copyable={field.copyable ?? false}
|
||||
/>
|
||||
)}
|
||||
</Grid>
|
||||
))}
|
||||
</Grid>
|
||||
|
|
|
|||
42
packages/bridge-ui/components/QRCode.tsx
Normal file
42
packages/bridge-ui/components/QRCode.tsx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { FC, useEffect, useState } from "react";
|
||||
import QRCodeInternal from "react-qr-code";
|
||||
import { Box } from "@mui/material";
|
||||
import { colors } from "../styles/theme";
|
||||
|
||||
type QRCodeProps = {
|
||||
name: string;
|
||||
label: string;
|
||||
id: string;
|
||||
helperText?: string;
|
||||
getValue?: (id: string) => Promise<string>;
|
||||
refreshInterval?: number;
|
||||
};
|
||||
|
||||
export const QRCode: FC<QRCodeProps> = ({
|
||||
name,
|
||||
label,
|
||||
id,
|
||||
helperText,
|
||||
getValue,
|
||||
refreshInterval,
|
||||
}) => {
|
||||
const [value, setValue] = useState("");
|
||||
const { white } = colors;
|
||||
|
||||
useEffect(() => {
|
||||
if (getValue && refreshInterval) {
|
||||
const interval = setInterval(async () => {
|
||||
const result = await getValue(id);
|
||||
setValue(result);
|
||||
}, refreshInterval);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [getValue, refreshInterval]);
|
||||
|
||||
return (
|
||||
<Box sx={{ backgroundColor: white, m: 2 }}>
|
||||
<QRCodeInternal value={value} />
|
||||
<Box>{helperText}</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue