Skip to content

Commit

Permalink
Merge pull request #193 from flatironinstitute/stan-editor-help-button
Browse files Browse the repository at this point in the history
Add help button to stan editor - open user guide
  • Loading branch information
WardBrian authored Aug 1, 2024
2 parents 1bdcce3 + 0707b14 commit 6fed1ea
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gui/src/app/FileEditor/StanFileEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Split } from "@geoffcox/react-splitter";
import { AutoFixHigh, Cancel, Settings } from "@mui/icons-material";
import { AutoFixHigh, Cancel, Help, Settings } from "@mui/icons-material";
import StanCompileResultWindow from "@SpComponents/StanCompileResultWindow";
import TextEditor from "@SpComponents/TextEditor";
import { ToolbarItem } from "@SpComponents/ToolBar";
Expand Down Expand Up @@ -102,6 +102,14 @@ const StanFileEditor: FunctionComponent<Props> = ({
const toolbarItems: ToolbarItem[] = useMemo(() => {
const ret: ToolbarItem[] = [];

ret.push({
type: "button",
icon: <Help />,
tooltip: "Open Stan Users Guide",
onClick: () =>
window.open("https://mc-stan.org/docs/stan-users-guide/", "_blank"),
});

// invalid syntax
if (!validSyntax && !!editedFileContent) {
ret.push({
Expand Down Expand Up @@ -181,7 +189,7 @@ const StanFileEditor: FunctionComponent<Props> = ({

const isCompiling = compileStatus === "compiling";

const window = syntaxWindowVisible ? (
const compileResultWindow = syntaxWindowVisible ? (
<StanCompileResultWindow
stancErrors={stancErrors}
onClose={() => setSyntaxWindowVisible(false)}
Expand Down Expand Up @@ -212,7 +220,7 @@ const StanFileEditor: FunctionComponent<Props> = ({
splitterSize={syntaxWindowVisible ? "7px" : "0px"}
>
{editor}
{window}
{compileResultWindow}
</Split>
);
};
Expand Down

0 comments on commit 6fed1ea

Please sign in to comment.