From 8f2189a210705ce1be50b89aca3727b3e6d66961 Mon Sep 17 00:00:00 2001 From: Patrick Heneise Date: Sat, 11 Nov 2023 17:40:26 -0500 Subject: [PATCH] feat: upcoming and past events --- src/graphql/past-events.query.js | 34 +++++++ ...sues.query.js => upcoming-events.query.js} | 1 + src/routes/events/index.jsx | 62 ++++++++++--- src/routes/index.jsx | 2 +- src/routes/speakers/[id].jsx | 92 +++++++++++++++++++ 5 files changed, 177 insertions(+), 14 deletions(-) create mode 100644 src/graphql/past-events.query.js rename src/graphql/{issues.query.js => upcoming-events.query.js} (92%) diff --git a/src/graphql/past-events.query.js b/src/graphql/past-events.query.js new file mode 100644 index 0000000..06327f6 --- /dev/null +++ b/src/graphql/past-events.query.js @@ -0,0 +1,34 @@ +import { gql } from '@solid-primitives/graphql' + +export default { + gql: gql` + query ($organization: String!, $repository: String!) { + repository(owner: $organization, name: $repository) { + issues( + first: 100 + states: CLOSED + orderBy: { field: CREATED_AT, direction: DESC } + labels: "Approved :white_check_mark:" + ) { + nodes { + id + number + title + url + body + bodyText + bodyHTML + reactions(first: 100) { + nodes { + content + } + } + } + } + } + } + `, + vars: { + organization: process.env.GH_ORG + } +} diff --git a/src/graphql/issues.query.js b/src/graphql/upcoming-events.query.js similarity index 92% rename from src/graphql/issues.query.js rename to src/graphql/upcoming-events.query.js index 3885edc..cd6dc1e 100644 --- a/src/graphql/issues.query.js +++ b/src/graphql/upcoming-events.query.js @@ -7,6 +7,7 @@ export default { issues( first: 100 states: OPEN + orderBy: { field: CREATED_AT, direction: DESC } labels: "Approved :white_check_mark:" ) { nodes { diff --git a/src/routes/events/index.jsx b/src/routes/events/index.jsx index ec59526..a958df4 100644 --- a/src/routes/events/index.jsx +++ b/src/routes/events/index.jsx @@ -1,6 +1,7 @@ import { Card } from '~/components/Card' import { formatDate } from '~/lib/formatDate' -import issuesQuery from '~/graphql/issues.query.js' +import upcomingEventsQuery from '~/graphql/upcoming-events.query.js' +import pastEventsQuery from '~/graphql/past-events.query.js' import graphql from '~/lib/graphql.server.js' import { useRouteData } from 'solid-start' import { For, createResource } from 'solid-js' @@ -35,26 +36,61 @@ function EventLine(props) { ) } +function EventReduced(props) { + const [issueData] = createResource(async () => { + const data = await bodyParser(props.event.body) + return data + }) + + return ( +
+ + + {props.event.title} + + Event Details + + +
+ ) +} + export function routeData() { - const [data] = graphql(issuesQuery.gql, { - ...issuesQuery.vars, + const [upcoming] = graphql(upcomingEventsQuery.gql, { + ...upcomingEventsQuery.vars, + repository: 'events' + }) + const [past] = graphql(pastEventsQuery.gql, { + ...pastEventsQuery.vars, repository: 'events' }) - return data + return { + upcoming, + past + } } export default function Event() { const data = useRouteData() return ( - - - {(event) => } - - + <> + + + {(event) => } + + + + + {(event) => } + + + ) } diff --git a/src/routes/index.jsx b/src/routes/index.jsx index d4654a0..8580856 100644 --- a/src/routes/index.jsx +++ b/src/routes/index.jsx @@ -14,7 +14,7 @@ import { A } from 'solid-start' import graphql from '~/lib/graphql.server.js' import fileQuery from '~/graphql/file.query.js' import organizationQuery from '~/graphql/organization.query.js' -import issuesQuery from '~/graphql/issues.query.js' +import issuesQuery from '~/graphql/upcoming-events.query.js' import bodyParser from '@zentered/issue-forms-body-parser' import { H1, H2, H3 } from '~/components/Atomic' diff --git a/src/routes/speakers/[id].jsx b/src/routes/speakers/[id].jsx index e69de29..491cdad 100644 --- a/src/routes/speakers/[id].jsx +++ b/src/routes/speakers/[id].jsx @@ -0,0 +1,92 @@ +import { A } from 'solid-start' +import { Container } from '~/components/Container' +import Logo from '~/assets/cdc-logo.png' +import { GitHubIcon, LinkedInIcon } from '~/components/SocialIcons' +import clsx from 'clsx' +import organizationQuery from '~/graphql/organization.query.js' +import graphql from '~/lib/graphql.server.js' +import { useRouteData } from 'solid-start' + +function SocialLink(props) { + return ( +
  • + + + {props.children} + +
  • + ) +} + +function MailIcon(props) { + return ( + + ) +} + +export function routeData() { + const [data] = graphql(organizationQuery.gql, organizationQuery.vars) + return data +} + +export default function Speaker() { + const data = useRouteData() + + return ( + +
    +
    +
    + +
    +
    +
    +

    + {data()?.organization?.name} +

    +
    + {data()?.organization?.description} +
    +
    +
    +
      + + Follow on GitHub + + + Follow on LinkedIn + + + contact@cdc.cy + +
    +
    +
    +
    + ) +}