diff --git a/compiler/apps/playground/components/Editor/Output.tsx b/compiler/apps/playground/components/Editor/Output.tsx index 5300392c6b..0847e044c5 100644 --- a/compiler/apps/playground/components/Editor/Output.tsx +++ b/compiler/apps/playground/components/Editor/Output.tsx @@ -187,6 +187,21 @@ function Output({ store, compilerOutput }: Props) { }); }, [store.source, compilerOutput]); + const changedPasses: Set = new Set(); + let lastResult: string = ""; + for (const [passName, results] of compilerOutput.results) { + for (const result of results) { + let currResult = ""; + if (result.kind === "hir" || result.kind === "reactive") { + currResult += `function ${result.fnName}\n\n${result.value}`; + } + if (currResult !== lastResult) { + changedPasses.add(passName); + } + lastResult = currResult; + } + } + return ( <> {compilerOutput.kind === "err" ? (
; setTabsOpen: (newTab: Set) => void; + changedPasses: Set; }): React.ReactElement { if (props.tabs.size === 0) { return ( @@ -36,6 +37,7 @@ export default function TabbedWindow(props: { tabs={props.tabs} tabsOpen={props.tabsOpen} setTabsOpen={props.setTabsOpen} + hasChanged={props.changedPasses.has(name)} /> ); })} @@ -48,11 +50,13 @@ function TabbedWindowItem({ tabs, tabsOpen, setTabsOpen, + hasChanged, }: { name: string; tabs: TabsRecord; tabsOpen: Set; setTabsOpen: (newTab: Set) => void; + hasChanged: boolean; }): React.ReactElement { const isShow = tabsOpen.has(name); @@ -74,7 +78,7 @@ function TabbedWindowItem({ title="Minimize tab" aria-label="Minimize tab" onClick={toggleTabs} - className="p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 font-medium text-secondary hover:text-link" + className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`} > - {name} @@ -87,7 +91,7 @@ function TabbedWindowItem({ aria-label={`Expand compiler tab: ${name}`} style={{ transform: "rotate(90deg) translate(-50%)" }} onClick={toggleTabs} - className="flex-grow-0 w-5 transition-colors duration-150 ease-in font-medium text-secondary hover:text-link" + className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? 'font-bold' : 'font-light'} text-secondary hover:text-link`} > {name}