-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSubmitTranscriptAlert.tsx
More file actions
142 lines (132 loc) · 3.72 KB
/
SubmitTranscriptAlert.tsx
File metadata and controls
142 lines (132 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import { TranscriptSubmitOptions } from "@/components/menus/SubmitTranscriptMenu";
import {
AlertDialog,
AlertDialogBody,
AlertDialogContent,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogOverlay,
Button,
Flex,
Heading,
ListItem,
Text,
UnorderedList,
} from "@chakra-ui/react";
import { forwardRef, useRef } from "react";
type Props = {
isOpen: boolean;
onCancel: () => void;
onSubmit: () => void;
prRepo: TranscriptSubmitOptions;
};
type PromptTwoProps = Omit<Props, "isOpen">;
type PromptOneProps = Omit<PromptTwoProps, "prRepo" | "onSubmit">;
const SubmitTranscriptAlert = ({
isOpen,
onCancel,
onSubmit,
prRepo,
}: Props) => {
const cancelRef = useRef<HTMLButtonElement>(null);
const handleClose = () => {
onCancel();
};
return (
<AlertDialog
size={'xl'}
isOpen={isOpen}
leastDestructiveRef={cancelRef}
onClose={handleClose}
>
<AlertDialogOverlay>
<AlertDialogContent>
<PromptStepOne onCancel={onCancel} ref={cancelRef} />
<PromptStepTwo
prRepo={prRepo}
onSubmit={onSubmit}
onCancel={handleClose}
ref={cancelRef}
/>
</AlertDialogContent>
</AlertDialogOverlay>
</AlertDialog>
);
};
export default SubmitTranscriptAlert;
const PromptStepOne = forwardRef<HTMLButtonElement, PromptOneProps>(
({ onCancel }, ref) => {
return (
<>
<AlertDialogHeader fontSize="xl">
Let's review your edits
</AlertDialogHeader>
<AlertDialogBody>
<Heading size="sm" pb={2}>
Did you make sure the following are accurate?
</Heading>
<UnorderedList color="gray.700" fontSize="14px">
<ListItem>
<Text>Title</Text>
</ListItem>
<ListItem>
<Text>Speaker(s)</Text>
</ListItem>
<ListItem>
<Text>Date of original presentation</Text>
</ListItem>
<ListItem>
<Text>Tags for the main topics of discussion</Text>
</ListItem>
</UnorderedList>
<Flex my={4} direction="column" gap={3}>
<Text size="sm" pb={2}>
<Text fontWeight="bold">Did you follow the Review Guidelines?</Text>
Please confirm you have corrected AI errors, adopted a clean
verbatim transcription style, maintained structure and organized
chapters effectively, attributed speakers accurately, and
conducted a final coherence check to ensure the transcript
is not only accurate but also readable.
</Text>
<Button size="sm" mx="auto" ref={ref} onClick={onCancel}>
Let me check a few things
</Button>
</Flex>
</AlertDialogBody>
</>
);
}
);
PromptStepOne.displayName = "PromptStepOne";
const PromptStepTwo = forwardRef<HTMLButtonElement, PromptTwoProps>(
({ onCancel, prRepo, onSubmit }, ref) => {
return (
<>
<AlertDialogBody>
By hitting submit, this would create a PR on{" "}
<b>
{prRepo === "btc transcript"
? "the Bitcoin Transcript repo"
: "your repo"}
</b>{" "}
</AlertDialogBody>
<AlertDialogFooter gap={3}>
<Button
ref={ref}
display="block"
size="sm"
mx="auto"
colorScheme="blue"
onClick={() => {
onCancel();
onSubmit();
}}
>
Ready to ship! <span>🚢</span>
</Button>
</AlertDialogFooter>
</>
);
}
);
PromptStepTwo.displayName = "PromptStepTwo";