1
0
mirror of https://github.com/XFox111/my-website.git synced 2026-04-22 07:28:01 +03:00

feat: customized Clarity analytics

This commit is contained in:
2024-08-21 00:23:50 +00:00
parent 67222999a9
commit 416e862959
3 changed files with 26 additions and 8 deletions
+3 -3
View File
@@ -34,17 +34,17 @@ const ContactSection: React.FC = () =>
<form className={ cls.container } action={ formAction }> <form className={ cls.container } action={ formAction }>
<FormStatusTracker onPendingChanged={ setPending } /> <FormStatusTracker onPendingChanged={ setPending } />
<input name="email" type="email" { ...sharedProps } <input name="email" type="email" { ...sharedProps } data-clarity-mask
autoComplete="email" spellCheck="false" autoComplete="email" spellCheck="false"
maxLength={ 60 } maxLength={ 60 }
placeholder="Email" /> placeholder="Email" />
<input name="subject" type="text" { ...sharedProps } <input name="subject" type="text" { ...sharedProps } data-clarity-mask
autoComplete="off" spellCheck="true" autoComplete="off" spellCheck="true"
maxLength={ 120 } maxLength={ 120 }
placeholder="Subject" /> placeholder="Subject" />
<textarea name="message" { ...sharedProps } className={ cls.textarea } <textarea name="message" { ...sharedProps } className={ cls.textarea } data-clarity-mask
autoComplete="off" spellCheck="true" autoComplete="off" spellCheck="true"
minLength={ 100 } maxLength={ 2000 } minLength={ 100 } maxLength={ 2000 }
placeholder="Message (min 100 characters)" /> placeholder="Message (min 100 characters)" />
+8 -2
View File
@@ -7,7 +7,7 @@ import projects from "@/_data/projects";
import shared from "@/_styles/gallery.module.scss"; import shared from "@/_styles/gallery.module.scss";
import { ArrowRight24Regular } from "@fluentui/react-icons"; import { ArrowRight24Regular } from "@fluentui/react-icons";
import Image from "next/image"; import Image from "next/image";
import React, { useState } from "react"; import React, { useCallback, useState } from "react";
import { networkFor } from "react-social-icons"; import { networkFor } from "react-social-icons";
import cls from "./ProjectsSection.module.scss"; import cls from "./ProjectsSection.module.scss";
@@ -15,6 +15,12 @@ const ProjectsSection: React.FC = () =>
{ {
const [selection, setSelection] = useState<number | undefined>(undefined); const [selection, setSelection] = useState<number | undefined>(undefined);
const select = useCallback((index: number | undefined) =>
{
setSelection(index);
window.clarity?.("set", "checked", "projects");
}, []);
return ( return (
<section id="projects" className={ cls.section }> <section id="projects" className={ cls.section }>
<div className={ shared.list }> <div className={ shared.list }>
@@ -25,7 +31,7 @@ const ProjectsSection: React.FC = () =>
className={ `${shared.listItem} ${cls.listItem}` } className={ `${shared.listItem} ${cls.listItem}` }
appearance={ selection === index ? "primary" : "secondary" } appearance={ selection === index ? "primary" : "secondary" }
data-selected={ selection === index } data-selected={ selection === index }
onClick={ () => setSelection(selection == index ? undefined : index) } onClick={ () => select(selection == index ? undefined : index) }
aria-label={ `"${project.title}". ${project.subtitle}` }> aria-label={ `"${project.title}". ${project.subtitle}` }>
<div className={ shared.content }> <div className={ shared.content }>
+15 -3
View File
@@ -5,7 +5,7 @@ import skills from "@/_data/skills";
import shared from "@/_styles/gallery.module.scss"; import shared from "@/_styles/gallery.module.scss";
import { ArrowDownload24Regular } from "@fluentui/react-icons"; import { ArrowDownload24Regular } from "@fluentui/react-icons";
import Image from "next/image"; import Image from "next/image";
import React, { useId, useState } from "react"; import React, { useCallback, useId, useState } from "react";
import cls from "./SkillsSection.module.scss"; import cls from "./SkillsSection.module.scss";
import links from "@/_data/links"; import links from "@/_data/links";
@@ -14,6 +14,12 @@ const SkillsSection: React.FC = () =>
const [selection, setSelection] = useState<number>(0); const [selection, setSelection] = useState<number>(0);
const illustrations = useId(); const illustrations = useId();
const select = useCallback((index: number) =>
{
setSelection(index);
window.clarity?.("set", "checked", "skills");
}, []);
return ( return (
<section id="skills" className={ cls.section }> <section id="skills" className={ cls.section }>
<div id={ illustrations } className={ cls.illustrations } aria-live="polite" aria-atomic> <div id={ illustrations } className={ cls.illustrations } aria-live="polite" aria-atomic>
@@ -25,7 +31,13 @@ const SkillsSection: React.FC = () =>
{ selection === 4 && { selection === 4 &&
// [SPECIAL] It's a surprize tool that will help us later // [SPECIAL] It's a surprize tool that will help us later
<div role="button" aria-label="Click me" className={ cls.whatsThis } onClick={ () => window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ") } /> <div role="button" aria-label="Click me"
className={ cls.whatsThis }
onClick={ () =>
{
window.clarity?.("event", "ngguu");
window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
} } />
} }
</div> </div>
<div className={ `${shared.list} ${cls.list}` }> <div className={ `${shared.list} ${cls.list}` }>
@@ -35,7 +47,7 @@ const SkillsSection: React.FC = () =>
<Button key={ index } type="button" aria-current={ selection === index } aria-controls={ illustrations } <Button key={ index } type="button" aria-current={ selection === index } aria-controls={ illustrations }
className={ shared.listItem } appearance={ selection === index ? "primary" : "secondary" } className={ shared.listItem } appearance={ selection === index ? "primary" : "secondary" }
data-selected={ selection === index } data-selected={ selection === index }
onClick={ () => setSelection(index) } onClick={ () => select(index) }
aria-label={ `${skill.title} skills. Associated stack: ${skill.description}` } aria-label={ `${skill.title} skills. Associated stack: ${skill.description}` }
icon={ <skill.icon /> } > icon={ <skill.icon /> } >