Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const Footer = () => {
</small>
<a className="text-sm hover:text-posadev-brightPink"
onClick={() => {
scrollToTop()
navigate("/privacy-policy")
}}>Politica de Privacidad</a>
<p className="text-posadev-lightPink text-sm flex gap-1 items-center">
Expand Down
2 changes: 0 additions & 2 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const Header = () => {
</a>
<a
onClick={() => {
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")}>
Expand Down Expand Up @@ -114,7 +113,6 @@ const Header = () => {
</a>
<a
onClick={() => {
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")}>
Expand Down
36 changes: 36 additions & 0 deletions src/components/Shared.tsx
Original file line number Diff line number Diff line change
@@ -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<SharedProps> = ({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 (
<Share2 role="link" onClick={handleBrochureClick} className="flex h-6 w-6 hover:text-primary-600">
<title>Compartir</title>
</Share2>
)
}
export default Shared
1 change: 1 addition & 0 deletions src/components/Speaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 16 additions & 6 deletions src/components/SpeakerInfo.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Gradient className="py-10 px-20" >
Expand All @@ -22,12 +34,10 @@ const SpeakerInfo = () => {
<h2 className="text-xl">{tagLine}</h2>
<p className="text-gray-700">{bio}</p>
<div className="flex items-center justify-start gap-4 text-gray-700">
{links.map((link, index) => (
{links.map((link) => (
<SocialMedia key={`link-${link.url}`} className="h-6 w-6 hover:text-primary-600" link={link} />
))}
<Share2 className="hidden h-6 w-6 hover:text-primary-600">
<title>Compartir</title>
</Share2>
<Shared link={fullUrl} speakerName={speaker.fullName} />
</div>
</div>
</Card>
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ All colors MUST be HSL.
a,
button,
[role="button"],
[role="link"],
input,
input[type="button"],
label {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
});
}
}

export const findSpeaker = (speakers: ISpeaker[], id: string) => speakers.find((speaker) => speaker.id === id);
7 changes: 7 additions & 0 deletions src/pages/CodeOfConduct.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import {useEffect} from "react";
import {scrollToTop} from "@/lib/utils.ts";

const CodeOfConduct = () => {
useEffect(() => {
scrollToTop()
}, []);

return (
<section
className="flex flex-col container gap-8 mx-auto p-4 my-8"
Expand Down
6 changes: 6 additions & 0 deletions src/pages/PrivacyPolicy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import {useEffect} from "react";
import {scrollToTop} from "@/lib/utils.ts";

const PrivacyPolicy = () => {
useEffect(() => {
scrollToTop()
}, []);
return (
<section
className="flex flex-col container gap-8 mx-auto p-4 my-8"
Expand Down