Skip to content

Commit

Permalink
Merge pull request #2540 from quantified-uncertainty/export-page-linker
Browse files Browse the repository at this point in the history
Add linker to export pages
  • Loading branch information
OAGr authored Nov 15, 2023
2 parents 931a631 + 2c528c8 commit 3129979
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import { FC } from "react";
import { FC, useState } from "react";
import { graphql, useFragment } from "react-relay";

import { SqValuePath } from "@quri/squiggle-lang";
import { SqProject, SqValuePath } from "@quri/squiggle-lang";
import {
VersionedSquiggleChart,
useAdjustSquiggleVersion,
Expand All @@ -13,6 +13,7 @@ import { ModelExportPage_SquiggleContent$key } from "@/__generated__/ModelExport
import { extractFromGraphqlErrorUnion } from "@/lib/graphqlHelpers";
import { SerializablePreloadedQuery } from "@/relay/loadPageQuery";
import { usePageQuery } from "@/relay/usePageQuery";
import { squiggleHubLinker } from "@/squiggle/components/linker";

const SquiggleModelExportPage: FC<{
variableName: string;
Expand All @@ -31,6 +32,10 @@ const SquiggleModelExportPage: FC<{

const checkedVersion = useAdjustSquiggleVersion(content.version);

const [project] = useState(() => {
return new SqProject({ linker: squiggleHubLinker });
});

if (checkedVersion === "0.8.5" || checkedVersion === "0.8.6") {
return (
<div className="p-4 bg-red-100 text-red-900">
Expand All @@ -49,6 +54,7 @@ const SquiggleModelExportPage: FC<{
code={content.code}
showHeader={false}
rootPathOverride={rootPath}
project={project}
/>
);
};
Expand Down

1 comment on commit 3129979

@vercel
Copy link

@vercel vercel bot commented on 3129979 Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.