Skip to content

Commit

Permalink
-feat: add open in chromoscope link button
Browse files Browse the repository at this point in the history
-fix: typo
  • Loading branch information
crfmc committed May 8, 2024
1 parent 49395f3 commit 2c35c23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,30 @@ function App(props: RouteComponentProps) {
isMinimalMode ? (
<div className="external-links">
<nav className="external-links-nav">
<a className="open-in-chromoscope-link" href="">
<button
className="open-in-chromoscope-link"
tabIndex={0}
onClick={e => {
e.preventDefault();
const { xDomain } = gosRef.current.hgApi.api.getLocation(
`${demo.id}-mid-ideogram`
);
if (xDomain) {
// urlParams.set('demoIndex', demoIndex.current + '');
// urlParams.set('domain', xDomain.join('-'));
let newUrl =
window.location.origin + window.location.pathname + '?';
newUrl += `demoIndex=${demoIndex.current}`;
newUrl += `&domain=${xDomain.join('-')}`;
if (externalDemoUrl.current) {
newUrl += `&external=${externalDemoUrl.current}`;
} else if (externalUrl) {
newUrl += `&external=${externalUrl}`;
}
window.open(newUrl, '_blank');
}
}}
>
<div className="link-group">
<span>Open in Chromoscope</span>
<svg
Expand All @@ -1102,7 +1125,7 @@ function App(props: RouteComponentProps) {
/>
</svg>
</div>
</a>
</button>
<div className="export-links">
<ExportDropdown gosRef={gosRef} currentSpec={currentSpec} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ExportDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ExportDropdown = ({ gosRef, currentSpec }: ExportDropdownProps) =>
<button className="export-button">
<span className="export-title">Export</span>
<svg className="button triangle-down" viewBox={ICONS.TRIANGLE_DOWN.viewBox}>
<title>Triange Down</title>
<title>Triangle Down</title>
{ICONS.TRIANGLE_DOWN.path.map(p => (
<path fill="currentColor" key={p} d={p} />
))}
Expand Down

0 comments on commit 2c35c23

Please sign in to comment.