@@ -19,7 +19,8 @@ import { useFormik } from "formik";
1919import { Fragment , useCallback , useEffect , useMemo , useState } from "react" ;
2020import ReactMarkdown from "react-markdown" ;
2121import { v4 } from "uuid" ;
22- import { InferType , array , boolean , mixed , object , string } from "yup" ;
22+ import { InferType } from "yup" ;
23+ import { NewPostSchema } from "../../data/schema" ;
2324import { track } from "../../utils/analytics" ;
2425import { useUserData } from "../../utils/useUser" ;
2526import { PrimaryButton } from "../core/buttons.component" ;
@@ -31,30 +32,6 @@ import AiSuggestTitlePromptDialogComponent from "../dialogs/ai-suggest-title-pro
3132import DateTimePromptDialog from "../dialogs/date-time-prompt-dialog.component" ;
3233import SwitchComponent from "./switch.component" ;
3334
34- export const NewPostSchema = object ( ) . shape ( {
35- title : string ( )
36- . required ( "Title cannot be empty" )
37- . min ( 2 , "Title too Short!" )
38- . max ( 75 , "Title too Long!" ) ,
39- content : string ( )
40- . required ( "Content cannot be empty" )
41- . min ( 2 , "Content too Short!" )
42- . max ( 9669 , "Content too Long!" ) ,
43- tags : array ( )
44- . of ( mixed < PostType > ( ) . oneOf ( Object . values ( PostType ) ) )
45- . required ( "Enter valid tags" ) ,
46- status : mixed < PostStatus > ( )
47- . oneOf ( Object . values ( PostStatus ) )
48- . required ( "Enter valid status" ) ,
49- page_id : string ( ) ,
50- images_folder : string ( ) ,
51- publish_at : string ( ) . optional ( ) . nullable ( ) ,
52- publication_date : string ( ) . optional ( ) . nullable ( ) ,
53- allow_reactions : boolean ( ) ,
54- email_notified : boolean ( ) ,
55- notes : string ( ) . optional ( ) . nullable ( ) ,
56- } ) ;
57-
5835export type PostFormikForm = InferType < typeof NewPostSchema > ;
5936
6037export default function PostFormComponent ( {
0 commit comments