Merge branch 'dev' into image-upload-management

This commit is contained in:
MTG2000
2022-09-15 13:03:16 +03:00
2 changed files with 37 additions and 30 deletions

View File

@@ -22,39 +22,41 @@ export default function CreatePostPage() {
{postType === 'bounty' && <title>Create Bounty</title>}
{postType === 'question' && <title>Create Question</title>}
</Helmet>
<div
className="page-container grid gap-24 grid-cols-1 lg:grid-cols-[1fr_4fr]"
// style={{ gridTemplateColumns: "326px 1fr" }}
>
<div className="">
{/* <PostTypeList selectionChanged={setPostType} /> */}
<button className={`
<div className="page-container">
<div
className="grid gap-24 grid-cols-1 lg:grid-cols-[1fr_4fr]"
// style={{ gridTemplateColumns: "326px 1fr" }}
>
<div className="">
{/* <PostTypeList selectionChanged={setPostType} /> */}
<button className={`
w-48 aspect-square bg-white rounded-12 border-2 border-gray-200 justify-around items-center text-gray-900 hover:bg-gray-50 active:bg-gray-100
`}
onClick={() => navigate(-1)}
>
<FiArrowLeft className={"text-body3"} />
</button>
</div>
<div >
{postType === 'story' && <>
{/* <h2 className="text-h2 font-bolder text-gray-800 mb-32">
onClick={() => navigate(-1)}
>
<FiArrowLeft className={"text-body3"} />
</button>
</div>
<div >
{postType === 'story' && <>
{/* <h2 className="text-h2 font-bolder text-gray-800 mb-32">
Write a Story
</h2> */}
<CreateStoryPage />
</>}
{postType === 'bounty' && <>
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
Write a Bounty
</h2>
<BountyForm />
</>}
{postType === 'question' && <>
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
Write a Question
</h2>
<QuestionForm />
</>}
<CreateStoryPage />
</>}
{postType === 'bounty' && <>
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
Write a Bounty
</h2>
<BountyForm />
</>}
{postType === 'question' && <>
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
Write a Question
</h2>
<QuestionForm />
</>}
</div>
</div>
</div>
</>

View File

@@ -1,7 +1,9 @@
import { yupResolver } from "@hookform/resolvers/yup";
import { useRef, useState } from "react";
import { ErrorBoundary, withErrorBoundary } from "react-error-boundary";
import { FormProvider, NestedValue, Resolver, useForm } from "react-hook-form";
import ErrorPage from "src/Components/Errors/ErrorPage/ErrorPage";
import { CreateStoryMutationVariables, Post_Type } from "src/graphql";
import { StorageService } from "src/services";
import { useAppSelector } from "src/utils/hooks";
@@ -43,7 +45,7 @@ export type CreateStoryType = Override<IStoryFormInputs, {
const storageService = new StorageService<CreateStoryType>('story-edit');
export default function CreateStoryPage() {
function CreateStoryPage() {
const { story } = useAppSelector(state => ({
@@ -91,3 +93,6 @@ export default function CreateStoryPage() {
</FormProvider>
)
}
// TODO: change the default cover_image on error
export default withErrorBoundary(CreateStoryPage, { FallbackComponent: ErrorPage, onError: () => { storageService.set({ ...storageService.get()!, cover_image: null as any }) } })