diff --git a/assets/pages/TextPage.tsx b/assets/pages/TextPage.tsx index 0b54b72..d8d2978 100644 --- a/assets/pages/TextPage.tsx +++ b/assets/pages/TextPage.tsx @@ -1,16 +1,29 @@ import React, {useEffect, useState} from "react"; import snarkdown from "snarkdown" -import {Skeleton} from "antd"; +import {Skeleton, Typography} from "antd"; import axios from "axios"; +import {t} from "ttag"; export default function TextPage({resource}: { resource: string }) { - const [markdown, setMarkdown] = useState() + const [loading, setLoading] = useState(false) + const [markdown, setMarkdown] = useState(undefined) 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]) - return - {markdown !== undefined &&
} + return + {markdown !== undefined ?
: + + {t`📝 Please create /public/content/${resource} file.`} + }
} \ No newline at end of file diff --git a/translations/translations.pot b/translations/translations.pot index 02ba31a..e89df50 100644 --- a/translations/translations.pot +++ b/translations/translations.pot @@ -528,6 +528,11 @@ msgstr "" msgid "Roles" msgstr "" +#: assets/pages/TextPage.tsx:26 +#, javascript-format +msgid "📝 Please create /public/content/${ resource } file." +msgstr "" + #: assets/utils/functions/rdapTranslation.ts:7 msgid "Registrant" msgstr ""