diff --git a/src/pages/index.js b/src/pages/index.js
index 74e2830..f6fc1b2 100644
--- a/src/pages/index.js
+++ b/src/pages/index.js
@@ -6,6 +6,46 @@ import ReCAPTCHA from "react-google-recaptcha"
const RECAPTCHA_SITE_KEY = process.env.GATSBY_RECAPTCHA_SITE_KEY || "YOUR_RECAPTCHA_SITE_KEY"
+const CaptchaWrapper = ({ onVerified }) => {
+ const [error, setError] = React.useState(null);
+ const isMounted = React.useRef(true);
+
+ React.useEffect(() => {
+ return () => {
+ isMounted.current = false;
+ };
+ }, []);
+
+ const handleCaptchaChange = (value) => {
+ if (isMounted.current && value) {
+ onVerified(true);
+ setError(null);
+ }
+ };
+
+ const handleCaptchaError = () => {
+ if (isMounted.current) {
+ setError('Wystąpił błąd podczas weryfikacji CAPTCHA');
+ onVerified(false);
+ }
+ };
+
+ return (
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ );
+};
+
const MiniWorkImage = ({ image }) => {
return (
{
const SegmentGeneral = ({ segment }) => {
const [isVerified, setIsVerified] = React.useState(false);
- const handleCaptchaChange = (value) => {
- setIsVerified(!!value);
- };
-
return (
- { segment.title }
+ {segment.title}
{!isVerified ? (
-
-
-
+
) : (
- {
- typeof segment.content === "object" ?
- Object.keys(segment.content).map( (key) => {
- return (
-
-
- { key + ": " }
-
-
-
- )
- }
- )
- :
- "lol"
- }
+ {typeof segment.content === "object" ? (
+ Object.keys(segment.content).map((key) => (
+
+
+ {key + ": "}
+
+
+
+ ))
+ ) : (
+ "lol"
+ )}
)}
- )
-}
+ );
+};
const SegmentRODO = ({ segment }) => {
@@ -337,69 +364,61 @@ const SegmentRODO = ({ segment }) => {
const Segment = ({ index, segment }) => {
-
- let segment_index = "segment_" + index
+ 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
}
)
@@ -407,7 +426,6 @@ const Segment = ({ index, segment }) => {
const IndexPage = () => {
-
let eng_ = "🇬🇧"
let pol_ = "🇵🇱"
@@ -432,20 +450,18 @@ const IndexPage = () => {
Curriculum Vitae
-
swap_content(e) }>
- { content_swapper }
+
swap_content(e)}>
+ {content_swapper}
{
- content.map( (value, index) => {
- return (
-
- )
- }
- )
+ content.map((value, index) => (
+
+ ))
}
diff --git a/src/styles/general.scss b/src/styles/general.scss
index 4807b5c..f6ea1e6 100644
--- a/src/styles/general.scss
+++ b/src/styles/general.scss
@@ -210,6 +210,14 @@ body {
.captcha-container {
display: flex;
- justify-content: center;
+ flex-direction: column;
+ align-items: center;
margin: 20px 0;
+
+ .error-message {
+ color: #ff4444;
+ margin-top: 10px;
+ font-size: 14px;
+ text-align: center;
+ }
}