import * as React from "react" import "../styles/general.scss" import { content_pl } from "../content/kamil" import { content_en } from "../content/kamil" import { loadCaptchaEnginge, LoadCanvasTemplate, validateCaptcha } from 'react-simple-captcha' const SimpleCaptchaWrapper = ({ onVerified, language }) => { const [error, setError] = React.useState(null); let content = { "pl": { "initial_information": "Wprowadź kod z obrazka aby wyświetlić informacje kontaktowe.", "captcha_console_initialization": "Błąd inicjalizacji captcha:", "captcha_ui_initialization": "Nie można załadować captcha", "captcha_console_reload": "Błąd przeładowania captcha:", "captcha_reload_button": "Odśwież kod", "captcha": "Wprowadź kod z obrazka", "button": "Potwierdź", "error": "Nieprawidłowy kod. Spróbuj ponownie.", }, "en": { "initial_information": "Please enter the code from the image for display contact information.", "captcha_console_initialization": "Captcha initialization error:", "captcha_ui_initialization": "Cannot load captcha", "captcha_console_reload": "Captcha reload error:", "captcha_reload_button": "Reload code", "captcha": "Enter the code from the image", "button": "Confirm", "error": "Invalid code. Try again.", } } React.useEffect(() => { try { loadCaptchaEnginge(6, '#242424', '#a6a6a6'); } catch (err) { console.error(content[language].captcha_console_initialization, err); setError(content[language].captcha_ui_initialization); } }, []); const handleSubmit = (e) => { e.preventDefault(); const userCaptchaValue = document.getElementById('user_captcha_input').value; if (validateCaptcha(userCaptchaValue)) { onVerified(true); setError(null); } else { setError(content[language].error); document.getElementById('user_captcha_input').value = ""; // Przeładowanie captcha try { loadCaptchaEnginge(6, '#242424', '#a6a6a6'); } catch (err) { console.error(content[language].captcha_console_reload, err); } } }; return (

{content[language].initial_information}

{error && (
{error}
)}
); }; const MiniWorkImage = ({ image }) => { return (
) } const SegmentTitle = ({ segment }) => { return (
{ segment.title }
) } const SegmentListNormal = ({ segment, tabs }) => { return (
) } const SegmentListWork = ({ segment, tabs }) => { return (
{ segment.image != "" ? : "" }
{ segment.content.length > 0 ? segment.title + ":" : segment.lastElement === true ? segment.title + "." : segment.noElements === true ? segment.title + "," : segment.title + ":" }
{ segment.content.length > 0 ?
    { segment.content.map( (item, index) => { return (
  • { item + "," }
  • ) } ) }
: <> }
) } const SegmentCreateBranch = ({ segment, tabs }) => { return (
x
) } const SegmentMergeBranch = ({ segment, tabs }) => { return (
x
) } const SegmentGeneral = ({ segment }) => { const [isVerified, setIsVerified] = React.useState(false); return (
{segment.title}
{segment.title}
{!isVerified ? ( ) : (
{typeof segment.content === "object" ? ( Object.keys(segment.content).map((key) => (
{key + ": "}
{segment.content[key].includes("git.") ? ( {segment.content[key]} ) : ( segment.content[key] )}
)) ) : ( "lol" )}
)}
); }; const SegmentRODO = ({ segment }) => { return (
{ segment.content }
) } const Segment = ({ index, segment }) => { const segment_index = "segment_" + index; return (
{ segment.type === "generalTitleSegment" ? : segment.type === "titleSegment" ? : segment.type === "subSegment" ? : segment.type === "workSubSegment" ? : segment.type === "createBranchSegment" ? : segment.type === "mergeBranchSegment" ? : segment.type === "RODOSegment" ? : null }
) } const IndexPage = () => { let eng_ = "🇬🇧" let pol_ = "🇵🇱" const [content_swapper, set_content_swap] = React.useState(pol_); const [content, set_content] = React.useState(content_en); const swap_content = (event) => { event.preventDefault() if (content_swapper === eng_) { set_content_swap(pol_) set_content(content_en) } else if (content_swapper === pol_) { set_content_swap(eng_) set_content(content_pl) } } return ( <>
Curriculum Vitae
swap_content(e)}> {content_swapper}
{ content.map((value, index) => ( )) }
) } export default IndexPage