Skip to content

Commit b5dbe41

Browse files
💄 feat(components/pages/talks): flag workshops
1 parent dfe7ffc commit b5dbe41

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

‎src/components/pages/talks/all-talks-section.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type AllTalksSectionProps = {
1818
items: Array<{
1919
talkSlug: string;
2020
talkTitle: string;
21+
talkCategory: string;
2122
_description: string;
2223
_events: string;
2324
_tags: string;
@@ -61,13 +62,14 @@ const AllTalksSection: FunctionComponent<
6162
/>
6263
)}
6364
{items.map((item, index) => {
64-
const { talkTitle, talkSlug } = item;
65+
const { talkTitle, talkSlug, talkCategory } = item;
6566
return (
6667
<OrderedListItem
6768
key={talkSlug}
6869
label={talkTitle}
6970
index={reversedIndexOf(items.length, index)}
7071
href={`/${Routes.talks}/${talkSlug}`}
72+
prefix={talkCategory === 'workshop' ? 'workshop' : null}
7173
/>
7274
);
7375
})}

‎src/components/shared/ordered-list-item.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FunctionComponent, PropsWithChildren } from 'react';
22

33
import { Routes } from 'config/constants';
44

5+
import Chip from 'components/shared/chip';
56
import Link from 'components/shared/link';
67

78
/*~
@@ -12,6 +13,7 @@ export type OrderedListItemProps = {
1213
href: string;
1314
label: string;
1415
index: number;
16+
prefix?: string | null;
1517
};
1618

1719
/*~
@@ -21,7 +23,7 @@ export type OrderedListItemProps = {
2123
const OrderedListItem: FunctionComponent<
2224
PropsWithChildren<OrderedListItemProps>
2325
> = (props) => {
24-
const { label, href, index } = props;
26+
const { label, href, index, prefix } = props;
2527

2628
return (
2729
<Link href={href} className="w-full" aria-label={label}>
@@ -31,6 +33,7 @@ const OrderedListItem: FunctionComponent<
3133
<div className="mr-6 text-left text-gray-300 dark:text-gray-400">
3234
{index}
3335
</div>
36+
{prefix && <Chip>{prefix}</Chip>}
3437
<h3 className="w-full text-base font-medium text-gray-800 dark:text-gray-100 sm:text-lg">
3538
{label}
3639
</h3>

‎src/graphql/GetAllTalks.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ query GetAllTalks($limit: Int) {
22
talkCollection(order: lastRelevant_DESC, limit: $limit) {
33
items {
44
title
5+
category
56
abstract {
67
json
78
}

‎src/graphql/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ export type GetAllTalksQueryVariables = Exact<{
21232123
}>;
21242124

21252125

2126-
export type GetAllTalksQuery = { __typename?: 'Query', talkCollection?: { __typename?: 'TalkCollection', items: Array<{ __typename?: 'Talk', title?: string | null, slug?: string | null, abstract?: { __typename?: 'TalkAbstract', json: any } | null, sessionsCollection?: { __typename?: 'TalkSessionsCollection', items: Array<{ __typename?: 'Session', event?: { __typename?: 'Event', name?: string | null, city?: { __typename?: 'City', name?: string | null, country?: { __typename?: 'Country', name?: string | null } | null } | null } | null } | null> } | null, contentfulMetadata: { __typename?: 'ContentfulMetadata', tags: Array<{ __typename?: 'ContentfulTag', id?: string | null, name?: string | null } | null> } } | null> } | null };
2126+
export type GetAllTalksQuery = { __typename?: 'Query', talkCollection?: { __typename?: 'TalkCollection', items: Array<{ __typename?: 'Talk', title?: string | null, category?: string | null, slug?: string | null, abstract?: { __typename?: 'TalkAbstract', json: any } | null, sessionsCollection?: { __typename?: 'TalkSessionsCollection', items: Array<{ __typename?: 'Session', event?: { __typename?: 'Event', name?: string | null, city?: { __typename?: 'City', name?: string | null, country?: { __typename?: 'Country', name?: string | null } | null } | null } | null } | null> } | null, contentfulMetadata: { __typename?: 'ContentfulMetadata', tags: Array<{ __typename?: 'ContentfulTag', id?: string | null, name?: string | null } | null> } } | null> } | null };
21272127

21282128
export type GetFeaturedTalksQueryVariables = Exact<{ [key: string]: never; }>;
21292129

@@ -2241,6 +2241,7 @@ export const GetAllTalksDocument = gql`
22412241
talkCollection(order: lastRelevant_DESC, limit: $limit) {
22422242
items {
22432243
title
2244+
category
22442245
abstract {
22452246
json
22462247
}

‎src/services/talks-content-service.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,19 @@ const allTransformer = (result: GetAllTalksQuery) => {
116116
.items;
117117

118118
return items.map((item) => {
119-
const { title, abstract, slug, sessionsCollection, contentfulMetadata } =
120-
item;
119+
const {
120+
title,
121+
category,
122+
abstract,
123+
slug,
124+
sessionsCollection,
125+
contentfulMetadata,
126+
} = item;
121127

122128
return {
123129
talkTitle: title,
124130
talkSlug: slug,
131+
talkCategory: category,
125132
// Indexable search metadata
126133
_description: JSON.stringify(abstract.json),
127134
_events: toIndexableCollection(

0 commit comments

Comments
 (0)