From 38cadd23f83621ec2ae5d4c855bb9cbb2889b4e4 Mon Sep 17 00:00:00 2001 From: Michael Schramm Date: Thu, 11 Jun 2020 10:36:36 +0200 Subject: [PATCH] add LOGIN_NOTE env variables https://github.com/ohmyform/ohmyform/issues/30 and fix lint problems --- CHANGELOG.md | 1 + components/auth/layout.tsx | 2 +- components/form/admin/types/yes_no.type.tsx | 3 +- graphql/query/settings.query.ts | 6 ++++ locales/en/login.json | 1 + pages/form/[id]/index.tsx | 2 +- pages/index.tsx | 2 +- pages/login/confirm/[code].tsx | 2 +- pages/login/index.tsx | 33 ++++++++++++++++----- pages/login/recover.tsx | 2 +- pages/register.tsx | 2 +- 11 files changed, 40 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2fa879..90e604a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - mobile improvements for lists and home page - markdown support for page paragraphs and field description - omf badge +- login notes ### Changed ### Fixed diff --git a/components/auth/layout.tsx b/components/auth/layout.tsx index 2e6d30f..40e6011 100644 --- a/components/auth/layout.tsx +++ b/components/auth/layout.tsx @@ -7,7 +7,7 @@ interface Props { export const AuthLayout: React.FC = (props) => { return ( - + { return ( diff --git a/pages/login/index.tsx b/pages/login/index.tsx index b6f12cb..320c068 100644 --- a/pages/login/index.tsx +++ b/pages/login/index.tsx @@ -1,5 +1,5 @@ -import { useMutation } from '@apollo/react-hooks' -import { Button, Form, Input, message } from 'antd' +import { useMutation, useQuery } from '@apollo/react-hooks' +import { Alert, Button, Form, Input, message } from 'antd' import { useForm } from 'antd/lib/form/Form' import { AuthFooter } from 'components/auth/footer' import { AuthLayout } from 'components/auth/layout' @@ -14,7 +14,9 @@ import Link from 'next/link' import { useRouter } from 'next/router' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' -import {Omf} from '../../components/omf' +import ReactMarkdown from 'react-markdown' +import { Omf } from '../../components/omf' +import { SETTINGS_QUERY, SettingsQueryData } from '../../graphql/query/settings.query' import scss from './index.module.scss' const Index: NextPage = () => { @@ -23,6 +25,7 @@ const Index: NextPage = () => { const router = useRouter() const [loading, setLoading] = useState(false) const [login] = useMutation(LOGIN_MUTATION) + const { data } = useQuery(SETTINGS_QUERY) const finish = async (data: LoginMutationVariables) => { setLoading(true) @@ -73,6 +76,18 @@ const Index: NextPage = () => { }} /> + {data && ( + } + style={{ + marginBottom: 24, + }} + /> + )} + { - - - + {(!data || !data.disabledSignUp.value) && ( + + + + )}