-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redireccionar URL de acuerdo al lenguaje
- Loading branch information
1 parent
1c77c95
commit cc07b8d
Showing
7 changed files
with
177 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import { notFound } from 'next/navigation'; | ||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
import speakerslist from '@/data/speakers.json'; | ||
import talksList from '@/data/talks.json'; | ||
import Avatar from '@/app/[lang]/speakers/images/avatar.jpeg'; | ||
|
||
export async function generateStaticParams() { | ||
return speakerslist.map((p) => ({ | ||
uniquepage: p.id.toString() | ||
})); | ||
} | ||
|
||
const Speaker = ({ params: { uniquepage, lang } }) => { | ||
const speaker = speakerslist.find((p) => p.id.toString() === uniquepage); | ||
let talks = []; | ||
|
||
if (!speaker) { | ||
console.info('speaker not found'); | ||
notFound(); | ||
} else { | ||
talks = talksList.filter((talk) => talk.speakers.includes(speaker.id)); | ||
} | ||
|
||
return ( | ||
<> | ||
<Image src={Avatar} width={200} height={200} placeholder="blur" alt="Picture of the author" /> | ||
<h1> | ||
{speaker.first_name} {speaker.last_name} | ||
</h1> | ||
<h2>{speaker.affiliation}</h2> | ||
<h3>{speaker.country_residence}</h3> | ||
<ul> | ||
<li> | ||
<Link href={speaker.facebook} target="_blank"> | ||
{speaker.facebook} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href={speaker.twitter} target="_blank"> | ||
{speaker.twitter} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href={speaker.linkedin} target="_blank"> | ||
{speaker.linkedin} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href={speaker.github} target="_blank"> | ||
{speaker.github} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href={speaker.website} target="_blank"> | ||
{speaker.website} | ||
</Link> | ||
</li> | ||
</ul> | ||
{speaker.biography ? <p>{speaker.biography[lang]}</p> : null} | ||
<h3>Talks</h3> | ||
{talks.map((talk) => ( | ||
<Link key={talk.id} href={`/talks/${talk.id}`} locale={lang}> | ||
<h1>{talk.title[lang]}</h1> | ||
</Link> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
Speaker.propTypes = { | ||
params: propTypes.shape({ | ||
uniquepage: propTypes.string, | ||
lang: propTypes.string | ||
}) | ||
}; | ||
|
||
export default Speaker; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import Row from 'react-bootstrap/Row'; | ||
import Col from 'react-bootstrap/Col'; | ||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
import speakerslist from '@/data/speakers.json'; | ||
|
||
import Avatar from '@/app/[lang]/speakers/images/avatar.jpeg'; | ||
|
||
const Speakers = ({ params: { lang } }) => { | ||
return ( | ||
<> | ||
{speakerslist.map( | ||
(speaker) => | ||
speaker.type === 'keynote' && ( | ||
<Row key={speaker.id}> | ||
<Col md={4}> | ||
<Link href={`/keynotes/${speaker.id}`} locale={lang}> | ||
<Image src={Avatar} width={200} height={200} alt="Picture of the author" /> | ||
</Link> | ||
</Col> | ||
<Col md={8}> | ||
<Link href={`/keynotes/${speaker.id}`} locale={lang}> | ||
<h1> | ||
{speaker.first_name} {speaker.last_name} | ||
</h1> | ||
<h2>{speaker.affiliation}</h2> | ||
</Link> | ||
<Link href={`https://twitter.com/${speaker.twitter}`} target="_blank"> | ||
<span>{speaker.twitter}</span> | ||
</Link> | ||
</Col> | ||
</Row> | ||
) | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
Speakers.propTypes = { | ||
params: propTypes.shape({ | ||
lang: propTypes.string.isRequired | ||
}).isRequired | ||
}; | ||
|
||
export default Speakers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[ | ||
{ | ||
"id": "john-doe", | ||
"type": "speaker", | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"email": "[email protected]", | ||
|
@@ -20,6 +21,7 @@ | |
}, | ||
{ | ||
"id": "jane-doe", | ||
"type": "keynote", | ||
"first_name": "Jane", | ||
"last_name": "Doe", | ||
"email": "[email protected]", | ||
|