Skip to content

Commit

Permalink
submit to parent
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed Jan 23, 2025
1 parent c983b5f commit 386e6d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@fi-sci/figurl-interface": ">=0.1.2 <0.2.0",
"@fi-sci/figurl-interface": ">=0.1.3 <0.2.0",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { randomAlphaString } from '../../core-utils';
import { Hyperlink } from '../../core-views';
import { getFileData, storeFileData, storeGithubFileData, useSignedIn } from "@fi-sci/figurl-interface";
import { getFileData, postMessageToParent, storeFileData, storeGithubFileData, useSignedIn } from "@fi-sci/figurl-interface";
import { Button } from "@material-ui/core";
import { FunctionComponent, useCallback, useEffect, useMemo, useRef, useState } from "react";
import EditGithubUriControl from './EditGithubUriControl';
Expand Down Expand Up @@ -154,15 +154,15 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
}).catch((err2: Error) => {
console.warn('Problem getting state 2')
console.warn(err2)
setErrorString(`Error getting ${fallbackUri}`)
setErrorString(`Error getting ${fallbackUri}`)
})
}
else {
console.warn('Problem getting state')
console.warn(err)
setErrorString(`Error getting ${uri}`)
}

})
}
first.current = false
Expand Down Expand Up @@ -224,6 +224,10 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object

const [editingGithubUri, setEditingGithubUri] = useState(false)

const handleSubmitToParent = useCallback(() => {
postMessageToParent({type: 'submit-curation', curation: object})
}, [object])

return (
<div>
<div>
Expand Down Expand Up @@ -261,6 +265,7 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
</span>
)
} */}
<Button style={buttonStyle} onClick={handleSubmitToParent}>Submit to parent</Button>
{
!editingGithubUri ? (
<span>
Expand Down Expand Up @@ -289,7 +294,7 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
<div style={{paddingLeft: 8, fontSize: 12}}>
URI: <FormatUri uri={uri} />
</div>

</div>
{errorString && <div style={{color: 'red'}}>{errorString}</div>}
</div>
Expand All @@ -309,12 +314,12 @@ function downloadTextFile(filename: string, text: string) {
const element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);

element.style.display = 'none';
document.body.appendChild(element);

element.click();

document.body.removeChild(element);
}

Expand Down
18 changes: 9 additions & 9 deletions gui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1680,17 +1680,17 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.53.0.tgz#bea56f2ed2b5baea164348ff4d5a879f6f81f20d"
integrity sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==

"@fi-sci/figurl-interface@>=0.1.2 <0.2.0":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@fi-sci/figurl-interface/-/figurl-interface-0.1.2.tgz#927771870c8c834150961ad711caf3e2a92baf23"
integrity sha512-+y/d3PFKt4aZQ2cKOqEV/FuEJlc9VB2396739wmut8ksrZ6g9I8SmtHSmNfb0WcAhLiJ3tlRQDI3qQnNCk/sXQ==
"@fi-sci/figurl-interface@>=0.1.3 <0.2.0":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@fi-sci/figurl-interface/-/figurl-interface-0.1.3.tgz#9d89680a4befd83f3fabd64bd172b09a0880e46a"
integrity sha512-b9WLXQgzlO0mcapYcuzjf4fsddeDozTVdtafigEOEdED7P4y2Za70QfMuvBX/O+X4a3N0m92hG7vkEorttJIVQ==
dependencies:
"@fi-sci/misc" "~0.0.9"
"@fi-sci/misc" "~0.0.10"

"@fi-sci/misc@~0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@fi-sci/misc/-/misc-0.0.9.tgz#6bc1d3b7e7b791f1dc817a079ecb5fed8c264e05"
integrity sha512-Aauk3JbZQH00ITh7ltL84lhasdti4lZQ/v7uEYJJWSAXH3rzo2JUxC2uc9ifjiS0CyW7gfq8ymHM9OkiRZfVrQ==
"@fi-sci/misc@~0.0.10":
version "0.0.10"
resolved "https://registry.yarnpkg.com/@fi-sci/misc/-/misc-0.0.10.tgz#2d4dfa0e400c7f52f25a22581e1c556f8012ffc6"
integrity sha512-Q4S6GCgwvLdZoVRlzIebY1uoPs4nSTObMx48CUpd6qJfIifiXLg8CNdR5ECaYm/+xWBQxUKRENiRkOR+LTmBfw==

"@floating-ui/core@^1.4.2":
version "1.5.0"
Expand Down

0 comments on commit 386e6d7

Please sign in to comment.