Add button to create note if not found (#2173)

* feat: add CreateNonExistentNote component

This component asks the user if they want to create the note that was request, but is not there.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-07-03 20:34:14 +02:00 committed by GitHub
parent cfab287200
commit 85a1c694b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 297 additions and 33 deletions

View file

@ -4,10 +4,11 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import type { PropsWithChildren } from 'react'
import React from 'react'
import { LandingLayout } from '../landing-layout/landing-layout'
import { useTranslation } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import { ShowIf } from '../common/show-if/show-if'
export interface CommonErrorPageProps {
titleI18nKey: string
@ -26,17 +27,20 @@ export const CommonErrorPage: React.FC<PropsWithChildren<CommonErrorPageProps>>
descriptionI18nKey,
children
}) => {
const { t } = useTranslation()
useTranslation()
return (
<LandingLayout>
<div className='text-light d-flex align-items-center justify-content-center my-5'>
<div>
<h1>{t(titleI18nKey)}</h1>
<br />
{descriptionI18nKey ? t(descriptionI18nKey) : null}
{children}
</div>
<div className='text-light d-flex flex-column align-items-center justify-content-center my-5'>
<h1>
<Trans i18nKey={titleI18nKey} />
</h1>
<ShowIf condition={!!descriptionI18nKey}>
<h3>
<Trans i18nKey={descriptionI18nKey} />
</h3>
</ShowIf>
{children}
</div>
</LandingLayout>
)