add ability to hide omf badge

This commit is contained in:
Michael Schramm 2020-06-11 17:16:15 +02:00
parent 698ba04f7e
commit 5a3e7e884f
3 changed files with 15 additions and 1 deletions

View File

@ -11,7 +11,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
- hideable omf badge
- login notes
### Changed

View File

@ -1,7 +1,15 @@
import { useQuery } from '@apollo/react-hooks'
import React from 'react'
import { SETTINGS_QUERY, SettingsQueryData } from '../graphql/query/settings.query'
import scss from './omf.module.scss'
export const Omf: React.FC = () => {
const { data, loading } = useQuery<SettingsQueryData>(SETTINGS_QUERY)
if (loading || data.hideContrib.value) {
return null
}
return (
<a className={scss.badge} href="https://ohmyform.com" target={'_blank'} rel={'noreferrer'}>
<span>OhMyForm</span>

View File

@ -7,6 +7,9 @@ export interface SettingsQueryData {
loginNote: {
value: string
}
hideContrib: {
value: string
}
}
export const SETTINGS_QUERY = gql`
@ -17,5 +20,8 @@ export const SETTINGS_QUERY = gql`
loginNote: getSetting(key: "LOGIN_NOTE") {
value
}
hideContrib: getSetting(key: "HIDE_CONTRIB") {
value: isTrue
}
}
`