Skip to content

Commit

Permalink
Merge pull request #325 from ProteinsWebTeam/dev
Browse files Browse the repository at this point in the history
structural model into master
  • Loading branch information
gustavo-salazar authored Feb 25, 2021
2 parents c6e6684 + 3b015c2 commit 7e8abaa
Show file tree
Hide file tree
Showing 28 changed files with 4,067 additions and 1,743 deletions.
3,850 changes: 2,819 additions & 1,031 deletions package-lock.json

Large diffs are not rendered by default.

71 changes: 37 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@
"clanviewer": "0.2.5",
"clipboard": "2.0.6",
"color-hash": "1.0.3",
"core-js": "3.8.2",
"core-js": "3.9.0",
"d3": "5.16.0",
"details-element-polyfill": "2.4.0",
"dompurify": "2.2.6",
"draft-js": "0.11.7",
"ebi-framework": "ebiwd/EBI-Framework#v1.4",
"fast-xml-parser": "3.17.6",
"fast-xml-parser": "3.18.0",
"filesize": "6.1.0",
"foundation-sites": "6.6.3",
"history": "4.10.1",
Expand All @@ -102,17 +102,18 @@
"lodash-es": "4.17.20",
"ngl": "2.0.0-dev.37",
"popper.js": "1.16.1",
"postcss": "8.2.4",
"postcss": "8.2.6",
"prop-types": "15.7.2",
"protvista-coloured-sequence": "3.0.0",
"protvista-interpro-track": "3.2.0",
"protvista-interpro-track": "3.2.1",
"protvista-links": "3.2.2-alpha.2",
"protvista-manager": "3.0.0",
"protvista-msa": "3.2.0",
"protvista-navigation": "3.0.0",
"protvista-overlay": "3.0.0",
"protvista-saver": "3.1.2",
"protvista-sequence": "3.0.0",
"protvista-track": "3.2.0",
"protvista-track": "3.2.1",
"protvista-zoom-tool": "3.1.2",
"protvista-zoomable": "3.0.0",
"react": "17.0.1",
Expand All @@ -122,9 +123,9 @@
"react-helmet-async": "1.0.7",
"react-html-parser": "^2.0.2",
"react-redux": "7.2.2",
"react-select": "4.0.2",
"react-select": "4.1.0",
"react-syntax-highlighter": "15.4.3",
"react-to-print": "2.11.0",
"react-to-print": "2.12.3",
"redux": "4.0.5",
"regenerator-runtime": "0.13.7",
"reselect": "4.0.0",
Expand All @@ -138,23 +139,23 @@
"timing-functions": "2.0.1",
"tippy.js": "6.2.7",
"url": "0.11.0",
"wicg-inert": "3.1.0"
"wicg-inert": "3.1.1"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-proposal-optional-chaining": "7.12.7",
"@babel/core": "7.12.17",
"@babel/plugin-proposal-class-properties": "7.12.13",
"@babel/plugin-proposal-optional-chaining": "7.12.17",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/preset-env": "7.12.11",
"@babel/preset-react": "7.12.10",
"@babel/register": "7.12.10",
"@storybook/addon-actions": "6.1.14",
"@storybook/addon-knobs": "6.1.14",
"@storybook/addon-links": "6.1.14",
"@storybook/addon-storysource": "6.1.14",
"@storybook/addons": "6.1.14",
"@storybook/react": "6.1.14",
"@storybook/theming": "6.1.14",
"@babel/preset-env": "7.12.17",
"@babel/preset-react": "7.12.13",
"@babel/register": "7.12.13",
"@storybook/addon-actions": "6.1.18",
"@storybook/addon-knobs": "6.1.18",
"@storybook/addon-links": "6.1.18",
"@storybook/addon-storysource": "6.1.18",
"@storybook/addons": "6.1.18",
"@storybook/react": "6.1.18",
"@storybook/theming": "6.1.18",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
Expand All @@ -169,29 +170,29 @@
"classnames": "2.2.6",
"compression-webpack-plugin": "6.1.0",
"coveralls": "3.1.0",
"css-loader": "5.0.1",
"css-loader": "5.0.2",
"cssnano": "4.1.10",
"empty": "0.10.1",
"eslint": "7.17.0",
"eslint-config-prettier": "7.1.0",
"eslint": "7.20.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-react-hooks": "4.2.0",
"express": "4.17.1",
"file-loader": "6.2.0",
"flow-bin": "0.142.0",
"flow-bin": "0.144.0",
"flow-coverage-report": "0.8.0",
"html-webpack-plugin": "4.5.1",
"husky": "4.3.7",
"html-webpack-plugin": "4.5.2",
"husky": "4.3.8",
"identity-obj-proxy": "3.0.0",
"iltorb": "2.4.5",
"img-loader": "3.0.2",
"jest": "26.6.3",
"js-yaml": "4.0.0",
"json-loader": "0.5.7",
"lighthouse": "6.5.0",
"lint-staged": "10.5.3",
"mini-css-extract-plugin": "1.3.3",
"lint-staged": "10.5.4",
"mini-css-extract-plugin": "1.3.8",
"mkdirp": "1.0.4",
"node-sass": "5.0.0",
"node-zopfli-es": "1.0.7",
Expand All @@ -201,20 +202,22 @@
"postcss-loader": "4.1.0",
"postcss-preset-env": "^6.7.0",
"prettier": "2.2.1",
"puppeteer": "5.5.0",
"puppeteer": "7.1.0",
"raw-loader": "4.0.2",
"react-test-renderer": "17.0.1",
"rimraf": "3.0.2",
"sass-loader": "10.1.1",
"source-map": "0.7.3",
"style-loader": "2.0.0",
"to-string-loader": "1.1.6",
"ts-loader": "^8.0.15",
"typescript": "^4.1.3",
"url-loader": "4.1.1",
"webapp-webpack-plugin": "2.7.1",
"webpack": "4.44.2",
"webpack-cli": "4.3.1",
"webpack-dev-server": "3.11.1",
"worker-loader": "3.0.7",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"worker-loader": "3.0.8",
"yaml-loader": "0.6.0"
}
}
}
8 changes: 5 additions & 3 deletions src/components/Help/Publication/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ const pubTypes = {
}),
]),
imageClass: T.string,
dark: T.bool,
};
Publication.propTypes = pubTypes;
const PreviousPublication = (
Expand All @@ -393,15 +394,16 @@ const PreviousPublication = (
);
PreviousPublication.propTypes = pubTypes;

const PrintedPublication = (
export const PrintedPublication = (
{
title,
authors,
source,
url,
} /*: { title: string, authors: string, source: string , url: string }*/,
dark = false,
} /*: { title: string, authors: string, source: string , url: string, dark?: boolean }*/,
) => (
<blockquote className={f('quote')}>
<blockquote className={f('quote', { dark })}>
{authors}{' '}
<Link href={url} target="_blank">
{title}
Expand Down
8 changes: 8 additions & 0 deletions src/components/Help/Publication/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
no-repeat 50% 90%;
background-size: 100%;
}

.dark {
color: white;
& a {
color: skyblue;
font-weight: bold;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ const FullScreenButton = (
return () => document.removeEventListener('fullscreenchange', onFullscreen);
}, []);
if (!element) return null;
const elementInDOM =
typeof element === 'string' ? document.getElementById(element) : element;
const _handleFullScreen = () => {
if (isFull) {
exitFullScreen();
onExitFullScreenHook();
} else {
requestFullScreen(element);
requestFullScreen(elementInDOM);
onFullScreenHook();
}
setFull(!isFull);
Expand Down
101 changes: 101 additions & 0 deletions src/components/SimpleCommonComponents/PictureInPicturePanel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// @flow
import React, { useState, useEffect, useRef } from 'react';
import T from 'prop-types';

import { intersectionObserver as intersectionObserverPolyfill } from 'utils/polyfills';

import { foundationPartial } from 'styles/foundation';
import style from './style.css';
import fonts from 'EBI-Icon-fonts/fonts.css';

const f = foundationPartial(style, fonts);

const NUMBER_OF_CHECKS = 10;
const optionsForObserver = {
root: null,
rootMargin: '0px',
/* eslint-disable-next-line prefer-spread */
threshold: Array.apply(null, { length: NUMBER_OF_CHECKS }).map(
// $FlowFixMe
Number.call,
(n) => (n + 1) / NUMBER_OF_CHECKS,
),
};

const PictureInPicturePanel = ({
className,
testId,
hideBar = false,
OtherControls = null,
OtherButtons = null,
onChangingMode = () => null,
children,
}) => {
const [isStuck, setStuck] = useState(false);
const [isMinimized, setMinimized] = useState(false);
const wrapperRef /*: { current: null | HTMLElement } */ = useRef(null);
let observer = null;
const threshold = 0.4;
useEffect(() => {
const asynLoadPolyfill = async () => await intersectionObserverPolyfill();
asynLoadPolyfill();
}, []);
useEffect(() => {
if (wrapperRef?.current) {
observer = new IntersectionObserver((entries) => {
setStuck(
((wrapperRef?.current?.getBoundingClientRect() /*: any */)?.y || 0) <
0 && entries[0].intersectionRatio < threshold,
);
onChangingMode();
}, optionsForObserver);
observer.observe(wrapperRef.current);
}
return () => {
if (observer) observer.disconnect();
};
}, [wrapperRef]);
return (
<div ref={wrapperRef} className={f('wrapper')}>
<div
className={f(className, 'content', {
'is-stuck': isStuck,
'is-minimized': isMinimized,
})}
data-testid={testId}
>
{children}
<div
className={f('control-bar', {
hide: hideBar,
})}
>
{OtherControls}
<div className={f('controls')}>
{OtherButtons}
{isStuck && (
<button
data-icon={isMinimized ? '\uF2D0' : '\uF2D1'}
title={'Minimize'}
onClick={() => setMinimized(!isMinimized)}
className={f('control-icon', 'icon', 'icon-common')}
/>
)}
</div>
</div>
</div>
</div>
);
};

PictureInPicturePanel.propTypes = {
className: T.string,
testId: T.string,
hideBar: T.bool,
OtherControls: T.any,
OtherButtons: T.any,
onChangingMode: T.func,
children: T.any,
};

export default PictureInPicturePanel;
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@import '../../../styles/timing.css';
@import '../../../styles/colors.css';
@import '../../../styles/z-index.css';

:root {
--height-viewer: 50vh;
--height-bar: 2.3em;
}

.wrapper {
height: var(--height-viewer);
width: 100%;
& .content {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
transition: height var(--timing-really-fast) ease-in-out;
}

& .control-bar {
width: auto;
height: var(--height-bar);
margin-top: calc(0 - var(--height-bar));
display: flex;
justify-content: space-between;
background: white;

& .controls {
white-space: nowrap;
overflow: visible;
flex-grow: 1;
display: flex;
justify-content: flex-end;
align-items: center;
& button {
font-size: 1.5em;
margin: 4px;
}
}
}
& .is-stuck {
position: fixed;
z-index: var(--z-index-over-main);
right: 10px;
top: auto;
bottom: 10px;
-webkit-transform: none;
-ms-transform: none;
transform: none;
border-radius: 0;
display: block;
-webkit-box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.3);
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.3);
width: 40%;
height: calc(var(--height-viewer) - var(--height-bar));

& .structure-viewer-select {
left: 1rem;
}

&.structure-icon {
font-size: 1em;
}

&.is-minimized {
height: var(--height-bar);
& .structure-viewer-ref {
display: none;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ exports[`<SummaryStructure /> should render 1`] = `
<div
className="columns"
>
<Memo(Connect(ViewerOnDemand))
<Memo(Connect(StructureView))
id="102m"
matches={
Array [
Expand Down
Loading

0 comments on commit 7e8abaa

Please sign in to comment.