Commit d614440b authored by Stefan Probst's avatar Stefan Probst
Browse files

feat: add submit success screen

parent a2b0b6d2
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { DatasetCore, DatasetDto } from '@/api/sshoc'
import { useCreateDataset, useGetLoggedInUser } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { DateFormSection } from '@/components/item/DateFormSection/DateFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
......@@ -71,12 +71,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { DatasetCore, DatasetDto } from '@/api/sshoc'
import { useGetLoggedInUser, useUpdateDataset } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { DateFormSection } from '@/components/item/DateFormSection/DateFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
......@@ -73,12 +73,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { PublicationCore, PublicationDto } from '@/api/sshoc'
import { useCreatePublication, useGetLoggedInUser } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { DateFormSection } from '@/components/item/DateFormSection/DateFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
......@@ -71,12 +71,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { PublicationCore, PublicationDto } from '@/api/sshoc'
import { useGetLoggedInUser, useUpdatePublication } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { DateFormSection } from '@/components/item/DateFormSection/DateFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
......@@ -73,12 +73,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { ToolCore, ToolDto } from '@/api/sshoc'
import { useCreateTool, useGetLoggedInUser } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -69,12 +69,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { ToolCore, ToolDto } from '@/api/sshoc'
import { useGetLoggedInUser, useUpdateTool } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -71,12 +71,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { TrainingMaterialCore, TrainingMaterialDto } from '@/api/sshoc'
import { useCreateTrainingMaterial, useGetLoggedInUser } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -69,12 +69,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -3,7 +3,7 @@ import { useQueryClient } from 'react-query'
import type { TrainingMaterialCore, TrainingMaterialDto } from '@/api/sshoc'
import { useGetLoggedInUser, useUpdateTrainingMaterial } from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -71,12 +71,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
},
onError() {
......
......@@ -12,7 +12,7 @@ import {
useCreateWorkflow,
useGetLoggedInUser,
} from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -103,13 +103,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
}
......
......@@ -13,7 +13,7 @@ import {
useUpdateStep,
useUpdateWorkflow,
} from '@/api/sshoc'
import type { ItemCategory, ItemSearchQuery } from '@/api/sshoc/types'
import type { ItemCategory } from '@/api/sshoc/types'
import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFormSection'
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
......@@ -113,12 +113,7 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else {
// TODO: redirect to separate page explaining that the submmited item is in moderation queue
const query: ItemSearchQuery = {
categories: [data.category!],
order: ['label'],
}
router.push({ pathname: '/search', query })
router.push({ pathname: '/success' })
}
}
......
import SuccessScreen from '@/screens/item/ItemSubmitSuccessScreen'
/**
* Success page after item created/edited.
*/
export default function SuccessPage(): JSX.Element {
return <SuccessScreen />
}
......@@ -11,7 +11,6 @@ import { Button } from '@/elements/Button/Button'
import { useAuth } from '@/modules/auth/AuthContext'
import { FormTextField } from '@/modules/form/components/FormTextField/FormTextField'
import { Form } from '@/modules/form/Form'
import { isEmail } from '@/modules/form/validate'
import ContentColumn from '@/modules/layout/ContentColumn'
import GridLayout from '@/modules/layout/GridLayout'
import HStack from '@/modules/layout/HStack'
......
import Image from 'next/image'
import { useRouter } from 'next/router'
import { Fragment, useEffect, useRef } from 'react'
import { Fragment, useRef } from 'react'
import ReCaptcha from 'react-google-recaptcha'
import { toast } from 'react-toastify'
......
import { useRouter } from 'next/router'
import { Fragment } from 'react'
import { Button } from '@/elements/Button/Button'
import ContentColumn from '@/modules/layout/ContentColumn'
import GridLayout from '@/modules/layout/GridLayout'
import Metadata from '@/modules/metadata/Metadata'
import { Title } from '@/modules/ui/typography/Title'
export default function ItemSubmitSuccessScreen(): JSX.Element {
const router = useRouter()
return (
<Fragment>
<Metadata title="Success" nofollow noindex />
<GridLayout style={{ gridTemplateRows: '1fr' }}>
<ContentColumn style={{ gridColumn: '4 / span 6' }}>
<div className="relative flex flex-col max-w-xl px-12 py-16 my-12 space-y-10 bg-white rounded-md shadow-md">
<div>
<Title className="font-bold">Successfully submitted!</Title>
<p>A moderator has been notified (well, not yet, but soon)</p>
</div>
<hr />
<p>
Thanks! Your changes have been successfully submitted and sent to
a moderator for review. After approval, the changes will be
visible on the SSHOC Marketplace.
</p>
<hr />
<div className="self-end">
<Button
onPress={() => {
router.push({ pathname: '/' })
}}
variant="gradient"
>
Back to homepage
</Button>
</div>
</div>
</ContentColumn>
</GridLayout>
<style jsx global>{`
body {
background: linear-gradient(41deg, #e7f5ff, transparent 85%);
}
`}</style>
</Fragment>
)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment