mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
feat: add warning message when md file is missing
This commit is contained in:
parent
a688c21034
commit
6bed972009
@ -1,16 +1,29 @@
|
|||||||
import React, {useEffect, useState} from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import snarkdown from "snarkdown"
|
import snarkdown from "snarkdown"
|
||||||
import {Skeleton} from "antd";
|
import {Skeleton, Typography} from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import {t} from "ttag";
|
||||||
|
|
||||||
export default function TextPage({resource}: { resource: string }) {
|
export default function TextPage({resource}: { resource: string }) {
|
||||||
const [markdown, setMarkdown] = useState<string>()
|
const [loading, setLoading] = useState<boolean>(false)
|
||||||
|
const [markdown, setMarkdown] = useState<string | undefined>(undefined)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
axios.get('/content/' + resource).then(res => setMarkdown(res.data))
|
setLoading(true)
|
||||||
|
axios.get('/content/' + resource)
|
||||||
|
.then(res => setMarkdown(res.data))
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err)
|
||||||
|
setMarkdown(undefined)
|
||||||
|
})
|
||||||
|
.finally(() => setLoading(false))
|
||||||
}, [resource])
|
}, [resource])
|
||||||
|
|
||||||
return <Skeleton loading={markdown === undefined} active>
|
return <Skeleton loading={loading} active>
|
||||||
{markdown !== undefined && <div dangerouslySetInnerHTML={{__html: snarkdown(markdown)}}></div>}
|
{markdown !== undefined ? <div
|
||||||
|
dangerouslySetInnerHTML={{__html: snarkdown(markdown)}}></div> :
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t`📝 Please create /public/content/${resource} file.`}
|
||||||
|
</Typography.Text>}
|
||||||
</Skeleton>
|
</Skeleton>
|
||||||
}
|
}
|
||||||
@ -528,6 +528,11 @@ msgstr ""
|
|||||||
msgid "Roles"
|
msgid "Roles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: assets/pages/TextPage.tsx:26
|
||||||
|
#, javascript-format
|
||||||
|
msgid "📝 Please create /public/content/${ resource } file."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: assets/utils/functions/rdapTranslation.ts:7
|
#: assets/utils/functions/rdapTranslation.ts:7
|
||||||
msgid "Registrant"
|
msgid "Registrant"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user