Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of Events #118

Merged
merged 22 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3bb5e12
feat: added link to events page
L-Steinmacher Sep 26, 2023
9feaa2e
feat: added events-list.mjs and rendering it on pages/events.mjs
L-Steinmacher Sep 26, 2023
d30bf6d
feat: displaying data and starting html
L-Steinmacher Sep 27, 2023
1318beb
feat:events-sponsors rendered
L-Steinmacher Sep 27, 2023
0e25493
update data being fetched for route
L-Steinmacher Sep 27, 2023
0ab09c2
talks rendering now
L-Steinmacher Sep 27, 2023
1c31dae
small change
L-Steinmacher Sep 27, 2023
1c7472e
feat rendering event talks list and talks on page
L-Steinmacher Sep 27, 2023
fa77933
added anchor tag
L-Steinmacher Sep 27, 2023
f4543a2
cleaned up files
L-Steinmacher Sep 27, 2023
728d4a5
align past events with header
L-Steinmacher Sep 28, 2023
3c08ea3
removed the current/future event from the pastEvents.
L-Steinmacher Sep 28, 2023
40f2a5b
fixed dates on events.json and pastEvents sort
L-Steinmacher Sep 28, 2023
baf3871
fixed past events
L-Steinmacher Sep 29, 2023
b739284
fixed pastEvents, added closing ul and removed target
L-Steinmacher Sep 29, 2023
6a492c0
fixed data fetching for talks, displaying name from speaker
L-Steinmacher Sep 29, 2023
167e775
normalize data and expand data in api events
L-Steinmacher Sep 29, 2023
df608a8
use list-sponsors and list-talks in events/
L-Steinmacher Sep 29, 2023
6144e9d
add turnary on topic for older talks
L-Steinmacher Sep 29, 2023
215d714
removed unused element, reorganized helper functions to respective files
L-Steinmacher Oct 2, 2023
8ca401b
refactored events/ to properly use 404
L-Steinmacher Oct 2, 2023
a45771f
added additional comment for event inflation
L-Steinmacher Oct 2, 2023
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
18 changes: 16 additions & 2 deletions app/api/events/$id.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import { events } from '../events.mjs'
import events from '../../data/events.json' assert { type: 'json' }
import sponsors from '../../data/sponsors.json' assert { type: 'json' }
import talks from '../../data/talks.json' assert { type: 'json' }
import speakers from '../../data/speakers.json' assert { type: 'json' }

export async function get(req) {
let { id } = req.params

let event = events.find(s => s.id === id)
let eventSponsors = sponsors.filter(s => event.sponsors.includes(s.id))

let eventTalks = event.talks ?talks.filter(t => {
return event.talks.includes(t.id)
}) : []

let eventSpeakers = eventTalks ? speakers.filter(s => {
return eventTalks.map(t => t.speaker_id).includes(s.id)
}) : []

return {
json: { event }
json: { event, eventSponsors, eventTalks, eventSpeakers }
}
}
10 changes: 5 additions & 5 deletions app/data/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"id": "may-2022",
"title": "SeattleJS May 2022",
"date": "2022-10-12",
"date": "2022-05-11",
"sponsors": [
"collective-seattle"
],
Expand All @@ -13,7 +13,7 @@
{
"id": "june-2022",
"title": "SeattleJS June 2022",
"date": "2022-10-12",
"date": "2022-06-08",
"sponsors": [
"collective-seattle"
],
Expand All @@ -24,23 +24,23 @@
{
"id": "july-2022",
"title": "SeattleJS July 2022",
"date": "2022-10-12",
"date": "2022-07-13",
"sponsors": [
"collective-seattle"
]
},
{
"id": "august-2022",
"title": "SeattleJS August 2022",
"date": "2022-10-12",
"date": "2022-08-10",
"sponsors": [
"collective-seattle"
]
},
{
"id": "september-2022",
"title": "SeattleJS September 2022",
"date": "2022-10-12",
"date": "2022-09-14",
"sponsors": [
"collective-seattle"
],
Expand Down
33 changes: 33 additions & 0 deletions app/elements/event-sponsors.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export default function eventSponsors({ html, state = {} }) {
const { store = {} } = state
const { eventSponsors } = store

return html`
<style>
:host div {
padding: 16px;
}

:host img {
height: 80px;
}
@media only screen and (min-width: 768px) {
:host {
display: flex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of events looks a little funky on a desktop browser. It's not aligned with the title. Probably not a blocking issue, but is there an easy fix?
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, Carter already mentioned this here: #118 (comment)

flex-wrap: wrap;
}
}
</style>

${eventSponsors
.map(
s => html` <div>
<a target="_sponsor" href="${s.url}"
><img src="/_public/images/sponsors/${s.image}"
/></a>
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
</div>`
)
.join('')}
`

}
82 changes: 82 additions & 0 deletions app/elements/event-talk.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
export default function EventTalk({ html, state = {} }) {
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
const { store = {}, attrs } = state
let { eventTalks, eventSpeakers } = store
let { talkid, speakerid } = attrs

let talk = eventTalks.filter(t => t.id === talkid)[0]
let speaker = eventSpeakers.filter(s => s.id === speakerid)[0]
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved

let { title, type } = talk
let { name, company, photo, location } = speaker

return html`
<style>
.speaker {
margin-right: 16px;
}

.photo {
position: relative;
height: 250px;
width: 250px;
}

.photo .overlay {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: 0.5s ease;
background-color: #ee3e4a;
}

.photo:hover .overlay {
opacity: 1;
}

.photo .overlay .text {
color: white;
font-family: headline-gothic-atf-round, sans-serif;
font-weight: 500;
font-style: italic;
font-size: 24px;
line-height: 1.125em;
margin: 16px;
text-align: left;
}

.photo img {
object-fit: cover;
height: 250px;
width: 250px;
}

.info {
margin: 8px 0 16px 0;
}

.name {
font-family: headline-gothic-atf-round, sans-serif;
font-weight: 700;
font-size: 24px;
}
</style>

<div class="speaker">
<div class="photo">
<img src="/_public/images/speakers/${photo}" alt="photo of ${name}" />
<div class="overlay">
<div class="text">${type === 'lightning' ? '⚡️' : ''}${title}</div>
</div>
</div>
<div class="info">
<div class="name">${name}</div>
<div class="misc">
${ company && company }<br/>${ location && location }
</div>
</div>
</div>
`
}
17 changes: 17 additions & 0 deletions app/elements/event-talks-list.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default function EventTalk({ html, state = {} }) {
const { store } = state
let { eventTalks, eventSpeakers } = store

return html`
<ul>
${eventTalks.length > 0 ?eventTalks
.map(
t =>
/*html*/ `<event-talk talkId=${t.id} speakerId=${
eventSpeakers.find(s => s.id === t.speaker_id).id
}></event-talk>`
)
.join(''): 'No talks this month.'}
</ul>
`
}
42 changes: 42 additions & 0 deletions app/elements/events-list.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export default function EventsList({ html, state }) {
const { store } = state
const allEvents = store.data

// The last item in the array is the current event
let pastEvents = allEvents.sort((a,b) => new Date(b.date) - new Date(a.date)).slice(1)
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved

if (pastEvents.length > 0) {
return html`
<style>
@media only screen and (min-width: 768px) {
:host {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
}
ul {
margin: 0;
padding: 0;
}
li {
list-style-type: none;
}
</style>
<ul>
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
${pastEvents.map(
e => `
<li >
<a target="_self" href="/events/${e.id}">
${e.title}
</a>
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
</li>`
)
.join('')}
`
}else {
return `
<p>Wait for it...</p>
`
}
}
6 changes: 6 additions & 0 deletions app/elements/view-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { marked } from 'marked'

export default function ViewEvent({ html, state = {} }) {
const { attrs, store } = state

let { events } = store
let { id } = attrs
let event = events.find(e => e.id === id)
Expand All @@ -27,5 +28,10 @@ export default function ViewEvent({ html, state = {} }) {
></a>
</div>
<list-talks event_id="${event.id}"></list-talks>
<div class="">
<a target="_self" href="/events">
See all past events <i class="fa-solid fa-arrow-right"></i>
</a>
</div>
`
}
14 changes: 4 additions & 10 deletions app/pages/events.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
export default function ({ html, state = {} }) {
let { store = {} } = state
let { events } = store
//console.log(events)
export default function events({ html }) {

return html`
<my-layout>
<div id="page">
<div class="page-title"><h1>Our Events</h1></div>
<div class="page-body">
<ul>
${events.map(e => /*html*/ `<li>${e.title}</li>`).join('')}
</ul>
</div>
<div class=""><h1>Our Past Events</h1></div>
<events-list></events-list>
</div>
</my-layout>
`
Expand Down
15 changes: 14 additions & 1 deletion app/pages/events/$id.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { marked } from "marked"

export default function ({ html, state = {} }) {
let { store = {} } = state
let { event } = store

return html`
<page-layout title=${event.title}>
<pre>${JSON.stringify(event, null, 2)}</pre>
<h3>${event.title}</h3>
${event.description && `<p>${marked(event.description)}</p>` }

<h4>Thanks to our Sponsors ❤️</h4>
${event.sponsors.length > 0 ? html`<event-sponsors></event-sponsors>` : null}
<event-talks-list></event-talks-list>
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
<div class="">
<a target="_self" href="/events">
See all past events <i class="fa-solid fa-arrow-right"></i>
</a>
</div>
</page-layout>
`
}
8 changes: 5 additions & 3 deletions app/pages/talks.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
export default function ({ html, state = {} }) {
let { store = {} } = state
let { talks } = store
let { store } = state
let talks = [...Object.values(store)]

return html`
<my-layout>
<div id="page">
<div class="page-title"><h1>Talk List</h1></div>
<div class="page-body">
<p> past talks
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
<ul>
${talks.map(t => /*html*/ `<li>${t.title}</li>`).join('')}
${talks.map(t => /*html*/ `<li>${t.title} - Speaker: ${t.speaker_id.split('-').join(' ')}</li>`).join('')}
andrewiggins marked this conversation as resolved.
Show resolved Hide resolved
</ul>
</div>
</div>
Expand Down