Skip to content

Commit

Permalink
Remove all css files related with GTEx component.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjcyxky committed Apr 5, 2024
1 parent d588534 commit 9ee8430
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 28 deletions.
3 changes: 2 additions & 1 deletion studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
"axios": "^1.1.2",
"biominer-components": "0.3.20",
"biomsa": "^0.3.3",
"bootstrap": "^5.3.3",
"classnames": "^2.3.0",
"file-saver": "^2.0.5",
"gtex-d3": "yjcyxky/gtex-viz#58b6493a",
"gtex-d3": "yjcyxky/gtex-viz#09dc0705",
"handlebars": "^4.7.7",
"handsontable": "^12.1.3",
"jwt-decode": "^3.1.2",
Expand Down
25 changes: 13 additions & 12 deletions studio/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ export default (api: IApi) => {
// For GTEx Components
api.addHTMLLinks(() => {
return [
{
rel: "stylesheet",
href: "https://gtexportal.org/external/bootstrap/3.3.7/bootstrap.min.css"
},
{
rel: "stylesheet",
href: "https://gtexportal.org/external/jquery-ui-1.11.4.custom/jquery-ui.css"
},
{
rel: "stylesheet",
href: "https://use.fontawesome.com/releases/v5.5.0/css/all.css"
}
// We don't like the default bootstrap style which messes up our site.
// {
// rel: "stylesheet",
// href: "https://gtexportal.org/external/bootstrap/3.3.7/bootstrap.min.css"
// },
// {
// rel: "stylesheet",
// href: "https://gtexportal.org/external/jquery-ui-1.11.4.custom/jquery-ui.css"
// },
// {
// rel: "stylesheet",
// href: "https://use.fontawesome.com/releases/v5.5.0/css/all.css"
// }
]
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
width: 100%;
}

.btn-group ~ div {
.btn-group~div {
display: flex;

div {
Expand All @@ -28,4 +28,4 @@

.modal-backdrop {
display: none;
}
}
41 changes: 41 additions & 0 deletions studio/src/NodeInfoPanel/Components/GTexViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ type GTexViewerProps = {
description?: string,
}

const links = [
{
rel: "stylesheet",
href: "https://gtexportal.org/external/bootstrap/3.3.7/bootstrap.min.css"
},
{
rel: "stylesheet",
href: "https://gtexportal.org/external/jquery-ui-1.11.4.custom/jquery-ui.css"
},
{
rel: "stylesheet",
href: "https://use.fontawesome.com/releases/v5.5.0/css/all.css"
}
]

const loadStyles = (links: any) => {
links.forEach((link: any) => {
if (!document.querySelector(`link[href="${link.href}"]`)) {
const linkElement = document.createElement('link');
linkElement.rel = link.rel;
linkElement.href = link.href;
document.head.appendChild(linkElement);
}
});
}

const unloadStyles = (links: any) => {
links.forEach((link: any) => {
const existingLinkElement = document.querySelector(`link[href="${link.href}"]`);
if (existingLinkElement) {
document.head.removeChild(existingLinkElement);
}
});
}

const GTexViewer: React.FC<GTexViewerProps> = (props) => {
const [rootId, setRootId] = useState<string>("");
const [versionedEnsemblId, setVersionedEnsemblId] = useState<string>("");
Expand All @@ -32,6 +67,12 @@ const GTexViewer: React.FC<GTexViewerProps> = (props) => {
} else {
setRootId(props.rootId)
}

loadStyles(links);

return () => {
unloadStyles(links);
};
}, []);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion studio/src/NodeInfoPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const NodeInfoPanel: React.FC<{ node?: GraphNode, hiddenItems?: string[] }> = ({
}, [compoundInfo]);

return <Tabs
className="plugins4kg tabs-nav-right"
className="plugins4kg tabs-nav-right" destroyInactiveTabPane
items={items && items.length > 0 ? items : defaultItems}
/>
}
Expand Down
2 changes: 1 addition & 1 deletion studio/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getJwtAccessToken, logoutWithRedirect } from '@/components/util';
import { useAuth0 } from "@auth0/auth0-react";
import type { MenuProps } from 'antd';
import { history } from 'umi';
import { jwtDecode } from "jwt-decode";
import jwtDecode from "jwt-decode";

import styles from './index.less';
import './extra.less'
Expand Down
14 changes: 3 additions & 11 deletions studio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9922,9 +9922,9 @@ grid-index@^1.1.0:
resolved "https://registry.yarnpkg.com/grid-index/-/grid-index-1.1.0.tgz#97f8221edec1026c8377b86446a7c71e79522ea7"
integrity sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==

gtex-d3@yjcyxky/gtex-viz#58b6493a:
version "0.1.1"
resolved "https://codeload.github.com/yjcyxky/gtex-viz/tar.gz/58b6493a801d0f18847a168d0a62c32e4f069030"
gtex-d3@yjcyxky/gtex-viz#09dc0705:
version "0.1.2"
resolved "https://codeload.github.com/yjcyxky/gtex-viz/tar.gz/09dc070591ad5497a48503da13a7f6f3b2e7cf3a"
dependencies:
bootstrap "^5.3.3"
d3 "^5.0.0"
Expand All @@ -9933,14 +9933,6 @@ gtex-d3@yjcyxky/gtex-viz#58b6493a:
jquery-ui "^1.13.2"
popper.js "^1.14.7"

gtex-d3@yjcyxky/gtex-viz#master:
version "0.1.0"
resolved "https://codeload.github.com/yjcyxky/gtex-viz/tar.gz/573dfa134ade75e1af9d6255f1e73f36530bedfb"
dependencies:
d3 "^5"
file-saver "^2.0.5"
jquery "^3.7.1"

gzip-size@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit 9ee8430

Please sign in to comment.