Skip to content

Commit 3ebbbd0

Browse files
committed
separate pick and guest blocks
1 parent 6a617e8 commit 3ebbbd0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

frontend/main/src/layout/PostLayout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,15 @@ export default function PostLayout({
130130
<aside className="hidden float-right ml-2 xl:inline-block">
131131
{recents()}
132132
</aside>
133+
<section className="guests">
134+
{post?.guestBlocks && renderBlocks(post.guestBlocks)}
135+
</section>
133136
<section className="content">
134137
{post?.blocks && renderBlocks(post.blocks)}
135138
</section>
139+
<section className="picks">
140+
{post?.pickBlocks && renderBlocks(post.pickBlocks)}
141+
</section>
136142
</article>
137143
</div>
138144
<div className="inline-block w-full xl:ml-2 xl:hidden">{recents()}</div>

frontend/main/src/models/post.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export interface Post {
2424
category?: string[] | null; //If null this will be auto assigned 'Unassigned'
2525
tag?: string[] | null;
2626
format?: PostFormat; //If null this will be auto assigned 'standard'
27+
guestBlocks?: NotionBlock[];
2728
blocks?: NotionBlock[];
29+
pickBlocks?: NotionBlock[];
2830
slug: string;
2931
historyId?: string;
3032
postId?: string;

frontend/main/src/services/notion.server.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,11 +818,14 @@ export const getPurrfectStreamPageBlocks = async ({
818818
queryPurrfectGuestsByStreamId(id),
819819
]);
820820

821+
let guestBlocks: NotionBlock[] = [];
821822
let blocks: NotionBlock[] = [];
823+
let pickBlocks: NotionBlock[] = [];
824+
822825
// Build the markdown for page
823826
for (const guest of purrfectGuests.results) {
824827
const b = await getBlocks(guest.id);
825-
blocks = [...blocks, ...b];
828+
guestBlocks = [...guestBlocks, ...b];
826829
}
827830
for (const page of raw.results) {
828831
blocks = [...blocks, ...(await getChildBlocks(await getBlocks(page.id)))];
@@ -866,7 +869,6 @@ export const getPurrfectStreamPageBlocks = async ({
866869
picks = [...picks, guest] as any;
867870
}
868871
}
869-
let pickBlocks: any[] = [];
870872
if (picks.length > 0) {
871873
pickBlocks = [
872874
formatBlock({ type: 'heading_2', content: 'Purrfect Picks' }),
@@ -888,11 +890,12 @@ export const getPurrfectStreamPageBlocks = async ({
888890
});
889891
});
890892
}
891-
blocks = [...blocks, ...pickBlocks];
892893

893894
return {
894895
...raw.results[0],
896+
guestBlocks,
895897
blocks,
898+
pickBlocks,
896899
};
897900
};
898901

0 commit comments

Comments
 (0)