|
|
|
@ -1,9 +1,31 @@ |
|
|
|
|
import { CustomTooltip } from '@remix-ui/helper' |
|
|
|
|
import React, { useState } from 'react' |
|
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
|
import { FormattedMessage } from 'react-intl' |
|
|
|
|
import { RunTab } from '../types/run-tab' |
|
|
|
|
|
|
|
|
|
export function LowLevelInteractionIcon () { |
|
|
|
|
const [version, _] = useState(window.location.href.split('=')[5].split('+')[0].split('-')[1]) |
|
|
|
|
export type LowLevelInteractionIconProps = { |
|
|
|
|
plugin: RunTab |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function LowLevelInteractionIcon (props: LowLevelInteractionIconProps) { |
|
|
|
|
const getVersion = () => window.location.href.split('=')[5].split('+')[0].split('-')[1] |
|
|
|
|
const [version, setVersion] = useState(() => getVersion()) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
const listenForCompileFinished = async () => { |
|
|
|
|
props.plugin.on('solidity', 'compilationFinished', |
|
|
|
|
(file: string, source, languageVersion, data, input, version) => { |
|
|
|
|
const versionUpdate = `v${version.split('+')[0]}` // remove commit hash
|
|
|
|
|
console.log(versionUpdate) |
|
|
|
|
setVersion(versionUpdate) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
listenForCompileFinished() |
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
|
props.plugin.off('solidity', 'compilationFinished') |
|
|
|
|
} |
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|