-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add events and event detail pages
- Loading branch information
1 parent
5667662
commit bbdfa13
Showing
11 changed files
with
1,493 additions
and
213 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,34 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
|
||
export default { | ||
gql: gql` | ||
query ($organization: String!, $repository: String!, $number: Int!) { | ||
repository(owner: $organization, name: $repository) { | ||
issue(number: $number) { | ||
id | ||
number | ||
title | ||
url | ||
body | ||
reactions(first: 100) { | ||
nodes { | ||
content | ||
} | ||
} | ||
comments(first: 100) { | ||
nodes { | ||
id | ||
author { | ||
login | ||
} | ||
body | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
vars: { | ||
organization: process.env.GH_ORG | ||
} | ||
} |
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,152 @@ | ||
import graphql from '~/lib/graphql.server.js' | ||
import issueQuery from '~/graphql/issue.query.js' | ||
import { useParams, useRouteData } from 'solid-start' | ||
import { Container } from '~/components/Container' | ||
import { Match, Show, Switch, createMemo, createResource } from 'solid-js' | ||
import bodyParser from '@zentered/issue-forms-body-parser' | ||
import { SolidMarkdown } from 'solid-markdown' | ||
import { Prose } from '~/components/Prose' | ||
import { formatDate } from '~/lib/formatDate' | ||
import fileQuery from '~/graphql/file.query.js' | ||
import { A } from '@solidjs/router' | ||
|
||
export function routeData() { | ||
const params = useParams() | ||
const [data] = graphql(issueQuery.gql, { | ||
...issueQuery.vars, | ||
repository: 'events', | ||
number: parseInt(params.id) | ||
}) | ||
|
||
const [locationsFile] = graphql(fileQuery.gql('locations.json'), { | ||
...fileQuery.vars, | ||
repository: 'events' | ||
}) | ||
|
||
const [issueData] = createResource(data, async () => { | ||
const issue = await bodyParser(data()?.repository.issue.body) | ||
return issue | ||
}) | ||
|
||
const locations = createMemo(() => { | ||
if (locationsFile()) { | ||
return JSON.parse(locationsFile().repository.object.text) | ||
} | ||
}) | ||
|
||
const location = locations()?.find((l) => l.id === issueData()?.location.text) | ||
|
||
return { | ||
data, | ||
issueData, | ||
location | ||
} | ||
} | ||
|
||
export default function Event() { | ||
const { data, issueData, location } = useRouteData() | ||
|
||
return ( | ||
<Container class="mt-16 sm:mt-32"> | ||
<div class="grid grid-cols-1 gap-y-16 lg:grid-cols-2 lg:grid-rows-[auto_1fr] lg:gap-y-12"> | ||
<div class="lg:pl-20"> | ||
<div class="max-w-xs px-2.5 lg:max-w-none"> | ||
<Switch> | ||
<Match when={issueData()?.['featured-image']?.images?.[0]}> | ||
<img | ||
src={issueData()['featured-image']?.images?.[0]?.src} | ||
alt={issueData()['featured-image']?.images?.[0]?.alt} | ||
sizes="(min-width: 1024px) 32rem, 20rem" | ||
class="aspect-square rotate-3 rounded-2xl bg-zinc-100 object-cover dark:bg-zinc-800" | ||
/> | ||
</Match> | ||
<Match when={!issueData()?.['featured-image']?.images}> | ||
<img | ||
src="/assets/cdc-logo.svg" | ||
alt="CDC logo" | ||
sizes="(min-width: 1024px) 32rem, 20rem" | ||
class="aspect-square rotate-3 rounded-2xl object-cover" | ||
/> | ||
</Match> | ||
</Switch> | ||
</div> | ||
</div> | ||
<div class="lg:pl-20"> | ||
<dl class="w-64 space-y-8 xl:w-80"> | ||
<Show when={location}> | ||
<div class="flex flex-col-reverse gap-y-4"> | ||
<dt class="text-base leading-7 text-gray-600"> | ||
{location.name}, {location.city} | ||
<br /> | ||
<Show when={location.what3words}> | ||
<A | ||
href={`https://w3w.co/${location.what3words.replace( | ||
'///', | ||
'' | ||
)}`} | ||
target="_blank" | ||
> | ||
{location.what3words} | ||
</A> | ||
</Show> | ||
</dt> | ||
<dd class="text-5xl font-semibold tracking-tight text-gray-900"> | ||
Where | ||
</dd> | ||
</div> | ||
</Show> | ||
</dl> | ||
<dl class="w-64 space-y-8 xl:w-80"> | ||
<div class="flex flex-col-reverse gap-y-4"> | ||
<dt class="text-base leading-7 text-gray-600"> | ||
{formatDate(issueData()?.['date'].date)} -{' '} | ||
{issueData()?.['time'].time} | ||
<br /> | ||
Duration: {issueData()?.['duration'].text} | ||
</dt> | ||
<dd class="text-5xl font-semibold tracking-tight text-gray-900"> | ||
When | ||
</dd> | ||
</div> | ||
</dl> | ||
<dl class="w-64 space-y-8 xl:w-80"> | ||
<Show when={issueData()?.['code-of-conduct']}> | ||
<div class="flex flex-col-reverse gap-y-4"> | ||
<dt class="text-base leading-7 text-gray-600"> | ||
<SolidMarkdown> | ||
{issueData()['code-of-conduct'].list[0].text} | ||
</SolidMarkdown> | ||
</dt> | ||
<dd class="text-5xl font-semibold tracking-tight text-gray-900"> | ||
Code of Conduct | ||
</dd> | ||
</div> | ||
</Show> | ||
</dl> | ||
</div> | ||
<Show when={issueData()?.['date']}> | ||
<div class="lg:order-first lg:row-span-2"> | ||
<time | ||
class={ | ||
'relative z-10 order-first mb-3 flex items-center text-sm text-zinc-800 dark:text-zinc-500 pl-3.5' | ||
} | ||
> | ||
{formatDate(issueData()?.['date'].date)} -{' '} | ||
{issueData()['time'].time} | ||
</time> | ||
<h1 class="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl"> | ||
{data()?.repository.issue.title} | ||
</h1> | ||
<div class="mt-6 space-y-7 text-base text-zinc-600 dark:text-zinc-400"> | ||
<Prose> | ||
<SolidMarkdown> | ||
{issueData()?.['event-description'].text} | ||
</SolidMarkdown> | ||
</Prose> | ||
</div> | ||
</div> | ||
</Show> | ||
</div> | ||
</Container> | ||
) | ||
} |
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
Oops, something went wrong.