1+ import Navigation from "@/components/navigation" ;
12import styles from "./page.module.css" ;
23
34export default async function ThreadPage ( {
45 params,
56} : {
67 params : { threadId : string } ;
78} ) {
9+ const apiKey = process . env . PLAIN_API_KEY ;
10+ if ( ! apiKey ) {
11+ throw new Error ( "Please set the `PLAIN_API_KEY` environment variable" ) ;
12+ }
13+
814 const data = await fetch ( "https://core-api.uk.plain.com/graphql/v1" , {
915 method : "POST" ,
1016 body : JSON . stringify ( {
@@ -57,8 +63,7 @@ export default async function ThreadPage({
5763 headers : {
5864 "Content-Type" : "application/json" ,
5965 "Plain-Workspace-Id" : "w_01J28VHKDK5PV3DJSZAA01XGAN" ,
60- Authorization :
61- "Bearer GIT_HISTORY_OVERWRITTEN" ,
66+ Authorization : `Bearer ${ process . env . PLAIN_API_KEY } ` ,
6267 } ,
6368 } )
6469 . then ( ( res ) => res . json ( ) )
@@ -71,26 +76,29 @@ export default async function ThreadPage({
7176 console . log ( thread ) ;
7277
7378 return (
74- < main className = { styles . main } >
75- < h1 > { thread . title } </ h1 >
76- < div className = { styles . message } >
77- { timelineEntries . edges . map ( ( entry ) => {
78- console . log ( "ENTRY" , entry ) ;
79- return (
80- < div key = { entry . node . id } >
81- { entry . node . entry . components . map ( ( component , idx ) => {
82- if ( component . __typename === "ComponentText" ) {
83- return (
84- < div key = { `comp_${ component . text } ` } > { component . text } </ div >
85- ) ;
86- }
79+ < >
80+ < Navigation hasBackButton title = { thread . title } />
81+ < main className = { styles . main } >
82+ < div className = { styles . message } >
83+ { timelineEntries . edges . map ( ( entry ) => {
84+ console . log ( "ENTRY" , entry ) ;
85+
86+ return (
87+ < div key = { entry . node . id } >
88+ { entry . node . entry . components . map ( ( component , idx ) => {
89+ if ( component . __typename === "ComponentText" ) {
90+ return (
91+ < div key = { `comp_${ component . text } ` } > { component . text } </ div >
92+ ) ;
93+ }
8794
88- return < div key = { `comp_${ idx } ` } > TODO</ div > ;
89- } ) }
90- </ div >
91- ) ;
92- } ) }
93- </ div >
94- </ main >
95+ return < div key = { `comp_${ idx } ` } > TODO</ div > ;
96+ } ) }
97+ </ div >
98+ ) ;
99+ } ) }
100+ </ div >
101+ </ main >
102+ </ >
95103 ) ;
96104}
0 commit comments