From d7d8f4d7cf4c51d19dbdf774bd945b5294da956e Mon Sep 17 00:00:00 2001 From: "Alejandro E. Rendon" Date: Fri, 29 Dec 2023 06:24:11 -0500 Subject: [PATCH] Crear estructura base para Ponentes y Charlas --- src/app/[lang]/dictionaries.js | 4 +- src/app/[lang]/not-found.js | 5 ++ src/app/[lang]/page.js | 2 +- src/app/[lang]/speakers/[uniquepage]/page.js | 82 +++++++++++++++++++ src/app/[lang]/speakers/images/avatar.jpeg | Bin 0 -> 5303 bytes src/app/[lang]/speakers/page.js | 34 ++++++++ src/app/[lang]/talks/[uniquepage]/page.js | 55 +++++++++++++ src/app/[lang]/talks/page.js | 24 ++++++ src/data/speakers.json | 34 ++++++++ src/data/talks.json | 35 ++++++++ src/middleware.js | 2 - 11 files changed, 272 insertions(+), 5 deletions(-) create mode 100644 src/app/[lang]/not-found.js create mode 100644 src/app/[lang]/speakers/[uniquepage]/page.js create mode 100644 src/app/[lang]/speakers/images/avatar.jpeg create mode 100644 src/app/[lang]/speakers/page.js create mode 100644 src/app/[lang]/talks/[uniquepage]/page.js create mode 100644 src/app/[lang]/talks/page.js create mode 100644 src/data/speakers.json create mode 100644 src/data/talks.json diff --git a/src/app/[lang]/dictionaries.js b/src/app/[lang]/dictionaries.js index 69c8c55..7fc7850 100644 --- a/src/app/[lang]/dictionaries.js +++ b/src/app/[lang]/dictionaries.js @@ -1,8 +1,8 @@ import 'server-only'; const dictionaries = { - en: () => import('./dictionaries/en.json').then((module) => module.default), - es: () => import('./dictionaries/es.json').then((module) => module.default) + en: () => import('@/app/[lang]/dictionaries/en.json').then((module) => module.default), + es: () => import('@/app/[lang]/dictionaries/es.json').then((module) => module.default) }; export const getDictionary = async (locale) => { diff --git a/src/app/[lang]/not-found.js b/src/app/[lang]/not-found.js new file mode 100644 index 0000000..45b276d --- /dev/null +++ b/src/app/[lang]/not-found.js @@ -0,0 +1,5 @@ +import React from 'react'; + +export default function NotFound() { + return

404 Not Found custom

; +} diff --git a/src/app/[lang]/page.js b/src/app/[lang]/page.js index 2f3897e..3baaa7c 100644 --- a/src/app/[lang]/page.js +++ b/src/app/[lang]/page.js @@ -1,5 +1,5 @@ import React from 'react'; -import { getDictionary } from './dictionaries'; +import { getDictionary } from '@/app/[lang]/dictionaries'; export default async function Page({ params: { lang } }) { const dict = await getDictionary(lang); diff --git a/src/app/[lang]/speakers/[uniquepage]/page.js b/src/app/[lang]/speakers/[uniquepage]/page.js new file mode 100644 index 0000000..658837b --- /dev/null +++ b/src/app/[lang]/speakers/[uniquepage]/page.js @@ -0,0 +1,82 @@ +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 ( + <> + Picture of the author +

+ {speaker.first_name} {speaker.last_name} +

+

{speaker.affiliation}

+

{speaker.country_residence}

+ +

{speaker.biography}

+ +

Talks

+ + {talks.map((talk) => ( + +

{talk.title}

+ + ))} + + ); +}; + +Speaker.propTypes = { + params: propTypes.shape({ + uniquepage: propTypes.string, + lang: propTypes.string + }) +}; + +export default Speaker; diff --git a/src/app/[lang]/speakers/images/avatar.jpeg b/src/app/[lang]/speakers/images/avatar.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..00f7cda6e8d7c0a497d615c3474a03f603b8e6d9 GIT binary patch literal 5303 zcmb7oc|25Y*#9{*n8`XLGK2<0c0)v|%-9}V_Q)DS_9a_MObJ8W@2VWGojIkk8rXbX5nB(qcJ=f4lb@^ z$BrFl$QQ?zaF( z0T6&g(SpD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..353e35a --- /dev/null +++ b/src/app/[lang]/speakers/page.js @@ -0,0 +1,34 @@ +'use client'; + +import React from 'react'; +import propTypes from 'prop-types'; +import Link from 'next/link'; +import speakerslist from '@/data/speakers.json'; + +const Speakers = ({ params: { lang } }) => { + return ( +
+ {speakerslist.map((speaker) => ( +
+ +

+ {speaker.first_name} {speaker.last_name} +

+

{speaker.affiliation}

+ + + {speaker.twitter} + +
+ ))} +
+ ); +}; + +Speakers.propTypes = { + params: propTypes.shape({ + lang: propTypes.string.isRequired + }).isRequired +}; + +export default Speakers; diff --git a/src/app/[lang]/talks/[uniquepage]/page.js b/src/app/[lang]/talks/[uniquepage]/page.js new file mode 100644 index 0000000..187ecf5 --- /dev/null +++ b/src/app/[lang]/talks/[uniquepage]/page.js @@ -0,0 +1,55 @@ +import React from 'react'; +import propTypes from 'prop-types'; +import talksList from '@/data/talks.json'; +import { notFound } from 'next/navigation'; + +export async function generateStaticParams() { + return talksList.map((p) => ({ + uniquepage: p.id.toString() + })); +} + +const UniquePage = ({ params: { uniquepage } }) => { + const talk = talksList.find((p) => p.id.toString() === uniquepage); + + if (!talk) { + console.log('talk not found'); + notFound(); + } + + return ( + <> +

{talk.title}

+ + +
+ + {talk.speakers.map((speaker) => ( +

{speaker}

+ ))} +

Authors

+
    + {talk.tags.map((tag) => ( +
  • {tag}
  • + ))} +
+ +

{talk.description}

+ +

Summary

+

{talk.summary}

+ + ); +}; + +UniquePage.propTypes = { + params: propTypes.shape({ + uniquepage: propTypes.string.isRequired + }).isRequired +}; + +export default UniquePage; diff --git a/src/app/[lang]/talks/page.js b/src/app/[lang]/talks/page.js new file mode 100644 index 0000000..b357fda --- /dev/null +++ b/src/app/[lang]/talks/page.js @@ -0,0 +1,24 @@ +import React from 'react'; +import propTypes from 'prop-types'; +import talksList from '@/data/talks.json'; +import Link from 'next/link'; + +const Talks = ({ params: { lang } }) => { + return ( +
+ {talksList.map((talk) => ( + +

{talk.title}

+ + ))} +
+ ); +}; + +Talks.propTypes = { + params: propTypes.shape({ + lang: propTypes.string.isRequired + }).isRequired +}; + +export default Talks; diff --git a/src/data/speakers.json b/src/data/speakers.json new file mode 100644 index 0000000..3cd8f4c --- /dev/null +++ b/src/data/speakers.json @@ -0,0 +1,34 @@ +[ + { + "id": "john-doe", + "first_name": "John", + "last_name": "Doe", + "email": "bYQJ9@example.com", + "photo": "https://i.pravatar.cc/300", + "biography": "I am John Doe. I am an amazing speaker.", + "affiliation": "Acme Inc.", + "facebook": "https://www.facebook.com/johndoe", + "twitter": "@johndoe", + "linkedin": "https://www.linkedin.com/in/johndoe", + "github": "https://github.com/johndoe", + "website": "https://johndoe.com", + "country_origin": "USA", + "country_residence": "USA" + }, + { + "id": "jane-doe", + "first_name": "Jane", + "last_name": "Doe", + "email": "bYQJ9@example.com", + "photo": "https://i.pravatar.cc/300", + "biography": "I am Jane Doe. I am an amazing speaker.", + "affiliation": "Acme Inc.", + "facebook": "https://www.facebook.com/johndoe", + "twitter": "@johndoe", + "linkedin": "https://www.linkedin.com/in/johndoe", + "github": "https://github.com/janedenoe", + "website": "https://janedenoe.com", + "country_origin": "Colombia", + "country_residence": "Canada" + } +] diff --git a/src/data/talks.json b/src/data/talks.json new file mode 100644 index 0000000..88e1fa7 --- /dev/null +++ b/src/data/talks.json @@ -0,0 +1,35 @@ +[ + { + "id": 1, + "title": "This is the title", + "speakers": [ + "john-doe" + ], + "written_language": "English", + "spoken_language": "English", + "submission": "Talk", + "description": "This is the description", + "summary": "This is the summary", + "tags": [ + "tag1", + "tag2" + ], + "video_url": "https://www.youtube.com/watch?v=123" + }, + { + "id": 2, + "title": "This is the title", + "speakers": [ + "john-doe", + "jane-doe" + ], + "written_language": "English", + "spoken_language": "Spanish", + "submission": "Workshop", + "description": "This is the description", + "summary": "This is the summary", + "tags": [ + "tag1" + ] + } +] diff --git a/src/middleware.js b/src/middleware.js index 4853dc3..fb3dd0a 100644 --- a/src/middleware.js +++ b/src/middleware.js @@ -5,8 +5,6 @@ export function middleware(request) { // Check if there is any supported locale in the pathname const { pathname } = request.nextUrl; - console.log('pathname', pathname); - const pathnameHasLocale = locales.some( (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` );