Skip to content

Commit 386e6d7

Browse files
committed
submit to parent
1 parent c983b5f commit 386e6d7

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

gui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"@emotion/react": "^11.10.5",
1414
"@emotion/styled": "^11.10.5",
15-
"@fi-sci/figurl-interface": ">=0.1.2 <0.2.0",
15+
"@fi-sci/figurl-interface": ">=0.1.3 <0.2.0",
1616
"@fortawesome/fontawesome-svg-core": "^6.1.1",
1717
"@fortawesome/free-regular-svg-icons": "^6.1.2",
1818
"@fortawesome/free-solid-svg-icons": "^6.1.1",

gui/src/libraries/spike-sorting-views/view-sorting-curation-2/SaveControl.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { randomAlphaString } from '../../core-utils';
22
import { Hyperlink } from '../../core-views';
3-
import { getFileData, storeFileData, storeGithubFileData, useSignedIn } from "@fi-sci/figurl-interface";
3+
import { getFileData, postMessageToParent, storeFileData, storeGithubFileData, useSignedIn } from "@fi-sci/figurl-interface";
44
import { Button } from "@material-ui/core";
55
import { FunctionComponent, useCallback, useEffect, useMemo, useRef, useState } from "react";
66
import EditGithubUriControl from './EditGithubUriControl';
@@ -154,15 +154,15 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
154154
}).catch((err2: Error) => {
155155
console.warn('Problem getting state 2')
156156
console.warn(err2)
157-
setErrorString(`Error getting ${fallbackUri}`)
157+
setErrorString(`Error getting ${fallbackUri}`)
158158
})
159159
}
160160
else {
161161
console.warn('Problem getting state')
162162
console.warn(err)
163163
setErrorString(`Error getting ${uri}`)
164164
}
165-
165+
166166
})
167167
}
168168
first.current = false
@@ -224,6 +224,10 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
224224

225225
const [editingGithubUri, setEditingGithubUri] = useState(false)
226226

227+
const handleSubmitToParent = useCallback(() => {
228+
postMessageToParent({type: 'submit-curation', curation: object})
229+
}, [object])
230+
227231
return (
228232
<div>
229233
<div>
@@ -261,6 +265,7 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
261265
</span>
262266
)
263267
} */}
268+
<Button style={buttonStyle} onClick={handleSubmitToParent}>Submit to parent</Button>
264269
{
265270
!editingGithubUri ? (
266271
<span>
@@ -289,7 +294,7 @@ const SaveControl: FunctionComponent<Props> = ({fallbackUri, uri, setUri, object
289294
<div style={{paddingLeft: 8, fontSize: 12}}>
290295
URI: <FormatUri uri={uri} />
291296
</div>
292-
297+
293298
</div>
294299
{errorString && <div style={{color: 'red'}}>{errorString}</div>}
295300
</div>
@@ -309,12 +314,12 @@ function downloadTextFile(filename: string, text: string) {
309314
const element = document.createElement('a');
310315
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
311316
element.setAttribute('download', filename);
312-
317+
313318
element.style.display = 'none';
314319
document.body.appendChild(element);
315-
320+
316321
element.click();
317-
322+
318323
document.body.removeChild(element);
319324
}
320325

gui/yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,17 +1680,17 @@
16801680
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.53.0.tgz#bea56f2ed2b5baea164348ff4d5a879f6f81f20d"
16811681
integrity sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==
16821682

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

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

16951695
"@floating-ui/core@^1.4.2":
16961696
version "1.5.0"

0 commit comments

Comments
 (0)