Skip to content

Commit

Permalink
Update tooltip for setup re-run
Browse files Browse the repository at this point in the history
  • Loading branch information
ioedeveloper committed Jul 30, 2024
1 parent 6e94321 commit fc6aa87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion apps/circuit-compiler/src/app/components/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ export function Container () {
<CompilerFeedback feedback={circuitApp.appState.compilerFeedback} filePathToId={circuitApp.appState.filePathToId} openErrorLocation={handleOpenErrorLocation} hideWarnings={circuitApp.appState.hideWarnings} askGPT={askGPT} />
</RenderIf>
<RenderIf condition={circuitApp.appState.signalInputs.length > 0}>
<Toggler title='circuit.setupExports' dataId='setup_exports_toggler' show={!circuitApp.appState.setupExportStatus} icon={ circuitApp.appState.setupExportStatus === 'done' ? 'fas fa-check-circle text-success' : circuitApp.appState.setupExportStatus === 'update' ? 'fas fa-exclamation-triangle text-warning' : null }>
<Toggler
title='circuit.setupExports'
dataId='setup_exports_toggler'
show={!circuitApp.appState.setupExportStatus}
icon={ circuitApp.appState.setupExportStatus === 'done' ? 'fas fa-check-circle text-success' : circuitApp.appState.setupExportStatus === 'update' ? 'fas fa-exclamation-triangle text-warning' : null }
iconTooltip={ circuitApp.appState.setupExportStatus === 'update' ? 'Circom file content changed. Please compile and re-run setup to update exported keys.' : null }
>
<>
<SetupExports />
<RenderIf condition={circuitApp.appState.status !== 'exporting'}>
Expand Down
15 changes: 12 additions & 3 deletions apps/circuit-compiler/src/app/components/toggler.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from "react"
import { FormattedMessage } from "react-intl"
import { RenderIf, RenderIfNot } from "@remix-ui/helper"
import { CustomTooltip, RenderIf, RenderIfNot } from "@remix-ui/helper"

export function Toggler ({ children, title, dataId, show = false, icon }: { children: JSX.Element, title: string, dataId: string, show?: boolean, icon?: string }) {
export function Toggler ({ children, title, dataId, show = false, icon, iconTooltip }: { children: JSX.Element, title: string, dataId: string, show?: boolean, icon?: string, iconTooltip?: string }) {
const [toggleExpander, setToggleExpander] = useState<boolean>(show)

useEffect(() => {
Expand All @@ -19,7 +19,16 @@ export function Toggler ({ children, title, dataId, show = false, icon }: { chil
<div className="d-flex">
<label className="mt-1 circuit_config_section">
<FormattedMessage id={title} />
{ icon && <span className={`${icon} border-0 p-0 ml-2`} aria-hidden="true"></span> }
{ icon ? iconTooltip ? (
<CustomTooltip
placement="auto"
tooltipId="rerunSetupWarningTooltip"
tooltipClasses="text-nowrap"
tooltipText={iconTooltip}
>
<span className={`${icon} border-0 p-0 ml-2`} aria-hidden="true"></span>
</CustomTooltip>) :
<span className={`${icon} border-0 p-0 ml-2`} aria-hidden="true"></span> : null }
</label>
</div>
<div>
Expand Down

0 comments on commit fc6aa87

Please sign in to comment.