diff --git a/src/lib/funcs/leaf.ts b/src/lib/funcs/leaf.ts index 7064a43..d11b66f 100644 --- a/src/lib/funcs/leaf.ts +++ b/src/lib/funcs/leaf.ts @@ -1,7 +1,4 @@ import * as d3 from 'd3'; -import { curveStep } from 'd3'; -import titleCase from './titleCase'; -import { colorizer, familyNames } from './treeUtilities'; const roundLeaf = [ { x: -2, y: 0 }, diff --git a/src/lib/funcs/treeify.ts b/src/lib/funcs/treeify.ts index 93c939e..ad0a1f2 100644 --- a/src/lib/funcs/treeify.ts +++ b/src/lib/funcs/treeify.ts @@ -1,5 +1,4 @@ import * as d3 from 'd3'; -import { curveStep } from 'd3'; import { catastropheLeaf, extinctionLeaf, goodLeaf } from './leaf'; import titleCase from './titleCase'; import { colorizer, familyNames } from './treeUtilities'; diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..189f71e --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1 @@ +export const prerender = true; diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 56d0969..8182443 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -1,11 +1,16 @@ +import { METACULUS_KEY } from '$env/static/private'; + async function metaculusFetch(question: number): Promise { if (process.env.NODE_ENV === 'production') { - const res = await fetch(`https://www.metaculus.com/api2/questions/${question}`); + console.log('fetching metaculus'); + const res = await fetch(`https://www.metaculus.com/api2/questions/${question}`, { + headers: { Authorization: `Token ${METACULUS_KEY}` } + }); const bod = await res.json(); - const avg = - bod.prediction_timeseries[bod.prediction_timeseries.length - 1].community_prediction; - return avg; + + const latestAVG = bod.simplified_history.community_prediction.at(-1).raw; + return latestAVG; } else { return 0.3; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 68a663f..a5c39d8 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -112,7 +112,7 @@

But we are not doomed. Like gardeners, we can prune the branches of our future. We can reduce - our existential risks until every path leads to survival or even flourishing. + our existential risks until every path leads to survival or flourishing.

This tree is built from the prediction platform Metaculus's