{"version":3,"sources":["../node_modules/babel-preset-react-app/node_modules/@babel/runtime/regenerator/index.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","pagetypes/Feedback.tsx"],"names":["module","exports","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","this","args","arguments","apply","err","undefined","Feedback","props","t","useTranslation","setPageTitle","useDDHPageContext","useEffect","useState","feedbackText","setFeedbackText","feedbackSentMessage","setFeedbackSentMessage","usernameText","setUsernameText","emailAddressText","setEmailAddressText","onSubmit","useCallback","event","a","preventDefault","body","feedback","username","emailAddress","fetch","method","JSON","stringify","headers","result","text","console","disabled","id","source","type","name","onChange","e","target","style","width","display","alignContent","minHeight","justifyContent","String"],"mappings":"qFAAAA,EAAOC,QAAU,EAAQ,M,iCCAzB,SAASC,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQC,EAAKC,GACpE,IACE,IAAIC,EAAOP,EAAIK,GAAKC,GAChBE,EAAQD,EAAKC,MACjB,MAAOC,GAEP,YADAP,EAAOO,GAILF,EAAKG,KACPT,EAAQO,GAERG,QAAQV,QAAQO,GAAOI,KAAKT,EAAOC,GAIxB,SAASS,EAAkBC,GACxC,OAAO,WACL,IAAIC,EAAOC,KACPC,EAAOC,UACX,OAAO,IAAIP,SAAQ,SAAUV,EAASC,GACpC,IAAIF,EAAMc,EAAGK,MAAMJ,EAAME,GAEzB,SAASd,EAAMK,GACbT,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,OAAQI,GAGlE,SAASJ,EAAOgB,GACdrB,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,QAASgB,GAGnEjB,OAAMkB,OA/BZ,mC,iKCOO,SAASC,EAASC,GACrB,IAAQC,EAAMC,cAAND,EAEAE,EAAiBC,cAAjBD,aAERE,qBAAU,WACNF,EAAaF,EAAE,YAAa,MAC7B,CAACE,EAAcF,IAElB,MAAwCK,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MAAO,OAAQG,UAAW,SACnCZ,SAAUA,MAGlB,uBACA,sBACIQ,MAAO,CACHC,MAAO,OACPC,QAAS,OACTG,eAAgB,iBAJxB,UAOI,+BAAOpC,IACP,uBACI0B,KAAK,SACLlD,MAAO6D,OAAO7C,EAAE,mBAChB+B,SAAUA,aAQnBjC","file":"static/js/9.a061f22c.chunk.js","sourcesContent":["module.exports = require(\"regenerator-runtime\");\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","import React, { useCallback, useEffect, useState } from \"react\";\r\nimport { useTranslation } from \"react-i18next\";\r\nimport ContentMarkdown from \"../components/ContentMarkdown\";\r\nimport { useDDHPageContext } from \"../components/DDHPageContext\";\r\n\r\nexport interface FeedbackProps {}\r\n\r\nexport function Feedback(props: FeedbackProps) {\r\n const { t } = useTranslation();\r\n\r\n const { setPageTitle } = useDDHPageContext();\r\n\r\n useEffect(() => {\r\n setPageTitle(t(\"Feedback\"), \"\");\r\n }, [setPageTitle, t]);\r\n\r\n const [feedbackText, setFeedbackText] = useState<string>(\"\");\r\n const [feedbackSentMessage, setFeedbackSentMessage] = useState<\r\n string | null\r\n >(null);\r\n const [usernameText, setUsernameText] = useState<string>(\"\");\r\n const [emailAddressText, setEmailAddressText] = useState<string>(\"\");\r\n\r\n const onSubmit = useCallback(\r\n async (event: React.SyntheticEvent) => {\r\n event.preventDefault();\r\n\r\n const body = {\r\n feedback: feedbackText,\r\n username: usernameText,\r\n emailAddress: emailAddressText,\r\n };\r\n\r\n try {\r\n const result = await fetch(\"/api/feedback\", {\r\n method: \"POST\",\r\n body: JSON.stringify(body),\r\n headers: {\r\n \"content-type\": \"application/json\",\r\n },\r\n });\r\n setFeedbackSentMessage(await result.text());\r\n } catch (error) {\r\n console.error(error);\r\n setFeedbackSentMessage(`${error}`);\r\n }\r\n },\r\n [feedbackText, usernameText, emailAddressText]\r\n );\r\n\r\n const disabled = feedbackSentMessage !== null;\r\n\r\n return (\r\n <div id=\"content\">\r\n\r\n <ContentMarkdown source={t(\"FeedbackDescription\")} />\r\n\r\n <form onSubmit={onSubmit}>\r\n <div>\r\n <p>{t(\"UserName\")}</p>\r\n <input\r\n type=\"text\"\r\n name=\"username\"\r\n id=\"username\"\r\n value={usernameText}\r\n onChange={(e) => setUsernameText(e.target.value)}\r\n />\r\n </div>\r\n <br />\r\n <div>\r\n <p>{t(\"UserEmailAddress\")}</p>\r\n <input\r\n type=\"text\"\r\n name=\"emailaddress\"\r\n id=\"emailaddress\"\r\n value={emailAddressText}\r\n onChange={(e) => setEmailAddressText(e.target.value)}\r\n />\r\n </div>\r\n <br />\r\n <br />\r\n <div\r\n style={{\r\n width: \"100%\",\r\n display: \"flex\",\r\n alignContent: \"end\",\r\n }}\r\n >\r\n <textarea\r\n name=\"feedback\"\r\n id=\"feedback\"\r\n value={feedbackText}\r\n onChange={(e) => setFeedbackText(e.target.value)}\r\n style={{ width: \"100%\", minHeight: \"200px\" }}\r\n disabled={disabled}\r\n ></textarea>\r\n </div>\r\n <br />\r\n <div\r\n style={{\r\n width: \"100%\",\r\n display: \"flex\",\r\n justifyContent: \"space-between\",\r\n }}\r\n >\r\n <span>{feedbackSentMessage}</span>\r\n <input\r\n type=\"submit\"\r\n value={String(t(\"SubmitFeedback\"))}\r\n disabled={disabled}\r\n />\r\n </div>\r\n </form>\r\n </div>\r\n );\r\n}\r\n\r\nexport default Feedback;\r\n"],"sourceRoot":""}