From 8f6749d421cd2007968b51bff8b6473d97f44434 Mon Sep 17 00:00:00 2001 From: Patrick Heneise Date: Sat, 11 Nov 2023 18:35:33 -0500 Subject: [PATCH] wip: speaker profiles --- src/components/Speaker.jsx | 65 +++++++++++++++++++++++++++++ src/graphql/speaker.query.js | 26 ++++++++++++ src/graphql/talks.query.js | 29 +++++++++++++ src/routes/speakers/index.jsx | 77 ++++++----------------------------- vite.config.js | 4 +- 5 files changed, 135 insertions(+), 66 deletions(-) create mode 100644 src/components/Speaker.jsx create mode 100644 src/graphql/speaker.query.js create mode 100644 src/graphql/talks.query.js diff --git a/src/components/Speaker.jsx b/src/components/Speaker.jsx new file mode 100644 index 0000000..342962e --- /dev/null +++ b/src/components/Speaker.jsx @@ -0,0 +1,65 @@ +import speakerQuery from '~/graphql/speaker.query' +import graphql from '~/lib/graphql.server' + +export default function Speaker(props) { + const [data] = graphql(speakerQuery.gql, { + login: props.person + }) + console.log(data()) + + const { person } = props + return ( + <> + +
+

+ {person.name} +

+

{person.role}

+

{person.bio}

+ +
+ + ) +} diff --git a/src/graphql/speaker.query.js b/src/graphql/speaker.query.js new file mode 100644 index 0000000..a66c0f8 --- /dev/null +++ b/src/graphql/speaker.query.js @@ -0,0 +1,26 @@ +import { gql } from '@solid-primitives/graphql' + +export default { + gql: gql` + query ($login: String!) { + user(login: $login) { + login + avatarUrl + status { + message + emoji + } + bio + repository(name: $login) { + id + name + object(expression: "main:README.md") { + ... on Blob { + text + } + } + } + } + } + ` +} diff --git a/src/graphql/talks.query.js b/src/graphql/talks.query.js new file mode 100644 index 0000000..0039b62 --- /dev/null +++ b/src/graphql/talks.query.js @@ -0,0 +1,29 @@ +import { gql } from '@solid-primitives/graphql' + +export default { + gql: gql` + query ($organization: String!, $repository: String!) { + repository(owner: $organization, name: $repository) { + issues( + first: 100 + orderBy: { field: CREATED_AT, direction: DESC } + labels: "Approved :white_check_mark:" + ) { + nodes { + id + number + title + url + author { + login + } + } + } + } + } + `, + vars: { + organization: process.env.GH_ORG, + repository: 'talks' + } +} diff --git a/src/routes/speakers/index.jsx b/src/routes/speakers/index.jsx index 22e67ae..6284d60 100644 --- a/src/routes/speakers/index.jsx +++ b/src/routes/speakers/index.jsx @@ -1,81 +1,30 @@ import { For } from 'solid-js' +import { useRouteData } from 'solid-start' import { SimpleLayout } from '~/components/SimpleLayout' +import Speaker from '~/components/Speaker' +import talksQuery from '~/graphql/talks.query' +import graphql from '~/lib/graphql.server' -const people = [ - { - name: 'Leslie Alexander', - role: 'Co-Founder / CEO', - imageUrl: - 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=1024&h=1024&q=80', - bio: 'Ultricies massa malesuada viverra cras lobortis. Tempor orci hac ligula dapibus mauris sit ut eu. Eget turpis urna maecenas cras. Nisl dictum.', - twitterUrl: '#', - linkedinUrl: '#' +export function routeData() { + const [data] = graphql(talksQuery.gql, talksQuery.vars) + const authors = data()?.repository?.issues?.nodes.map((t) => t.author.login) + return { + authors } - // More people... -] +} export default function Speakers() { + const data = useRouteData() return (