diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
index 57a86b5..5d6a4c6 100644
--- a/src/components/Footer.tsx
+++ b/src/components/Footer.tsx
@@ -81,7 +81,6 @@ const Footer = () => {
{
- scrollToTop()
navigate("/privacy-policy")
}}>Politica de Privacidad
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 89fdd7d..504898d 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -70,7 +70,6 @@ const Header = () => {
{
- scrollToTop();
navigate('/code-of-conduct')
}}
className={cn("text-white hover:text-posadev-brightPink transition-colors duration-300 flex items-center space-x-1", isActive('/code-of-conduct') && "text-posadev-brightPink")}>
@@ -114,7 +113,6 @@ const Header = () => {
{
- scrollToTop()
navigateMenu('/code-of-conduct')
}}
className={cn("text-white hover:text-posadev-brightPink transition-colors duration-300 flex items-center space-x-1", isActive('/code-of-conduct') && "text-posadev-brightPink")}>
diff --git a/src/components/Shared.tsx b/src/components/Shared.tsx
new file mode 100644
index 0000000..f0bd648
--- /dev/null
+++ b/src/components/Shared.tsx
@@ -0,0 +1,36 @@
+import {useToast} from "@/hooks/use-toast.ts";
+import {Share2} from "lucide-react";
+import React from "react";
+
+interface SharedProps {
+ link: string,
+ speakerName: string
+}
+
+const Shared: React.FC = ({link, speakerName}) => {
+ const {toast, dismiss} = useToast();
+ const handleBrochureClick = async () => {
+ if (navigator.share) {
+ await navigator.share({
+ title: `Speaker: ${speakerName}`,
+ text: "¡Mira este speaker!",
+ url: link,
+ });
+ } else {
+ await navigator.clipboard.writeText(link);
+ toast({
+ title: `Link de speaker: ${speakerName}`,
+ description: "Copiado al portapapeles",
+ });
+ setTimeout(() => {
+ dismiss()
+ }, 2000)
+ }
+ };
+ return (
+
+ Compartir
+
+ )
+}
+export default Shared
\ No newline at end of file
diff --git a/src/components/Speaker.tsx b/src/components/Speaker.tsx
index ff1f15c..c4fe9bd 100644
--- a/src/components/Speaker.tsx
+++ b/src/components/Speaker.tsx
@@ -3,6 +3,7 @@ import {ISpeaker} from "@/types/speakers.ts";
import {Card} from "@/components/ui/card.tsx";
import SocialMedia from "@/components/SocialMedia.tsx";
import {useNavigate} from "react-router-dom";
+import {scrollToTop} from "@/lib/utils.ts";
interface SpeakerProps {
speaker: ISpeaker;
diff --git a/src/components/SpeakerInfo.tsx b/src/components/SpeakerInfo.tsx
index 9cabfcc..3b760cc 100644
--- a/src/components/SpeakerInfo.tsx
+++ b/src/components/SpeakerInfo.tsx
@@ -1,16 +1,28 @@
import {ISpeaker} from "@/types/speakers.ts";
import {Card, CardFooter} from "@/components/ui/card.tsx";
import React, {useEffect} from "react";
-import {useLocation} from "react-router-dom";
+import {useLocation, useParams} from "react-router-dom";
import SocialMedia from "@/components/SocialMedia.tsx";
import {Badge} from "@/components/ui/badge.tsx";
-import {Share2, Speech} from "lucide-react";
+import { Speech} from "lucide-react";
import Gradient from "@/components/Gradient.tsx";
+import {useAppContext} from "@/context/AppContext.tsx";
+import {findSpeaker, scrollToTop} from "@/lib/utils.ts";
+import Shared from "@/components/Shared.tsx";
const SpeakerInfo = () => {
const location = useLocation();
+ const { speakerId } = useParams();
+ const { speakers } = useAppContext();
const speaker = location.state?.speaker as ISpeaker;
const {fullName, sessions, profilePicture, tagLine, bio, links} = speaker;
+ const fullUrl = `${window.location.origin}${location.pathname}${location.search}${location.hash}`;
+
+ useEffect(() => {
+ scrollToTop()
+ if (speaker) return;
+ findSpeaker(speakers, speakerId)
+ }, []);
return (
@@ -22,12 +34,10 @@ const SpeakerInfo = () => {
{tagLine}
{bio}
- {links.map((link, index) => (
+ {links.map((link) => (
))}
-
- Compartir
-
+
diff --git a/src/index.css b/src/index.css
index f74257f..770a05c 100644
--- a/src/index.css
+++ b/src/index.css
@@ -124,6 +124,7 @@ All colors MUST be HSL.
a,
button,
[role="button"],
+ [role="link"],
input,
input[type="button"],
label {
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 6efe90a..6bcc4a3 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -23,11 +23,12 @@ export const addSessionSpeakers = (sessions: ISession[], speakers: ISpeaker[], c
return speakers.map((speaker) => {
const session = sessions.find((session) => session.speakers.includes(speaker.id));
const category = categories.find((category) => session.categoryItems.includes(category.id))
- console.log(category.name)
return {
...speaker,
sessions: session,
category: category.name
};
});
-}
\ No newline at end of file
+}
+
+export const findSpeaker = (speakers: ISpeaker[], id: string) => speakers.find((speaker) => speaker.id === id);
\ No newline at end of file
diff --git a/src/pages/CodeOfConduct.tsx b/src/pages/CodeOfConduct.tsx
index 41c777d..9e624ec 100644
--- a/src/pages/CodeOfConduct.tsx
+++ b/src/pages/CodeOfConduct.tsx
@@ -1,4 +1,11 @@
+import {useEffect} from "react";
+import {scrollToTop} from "@/lib/utils.ts";
+
const CodeOfConduct = () => {
+ useEffect(() => {
+ scrollToTop()
+ }, []);
+
return (
{
+ useEffect(() => {
+ scrollToTop()
+ }, []);
return (