Skip to content

Commit 0bce477

Browse files
authored
Merge pull request #126 from ScienceCommons/staging
merge full-screen mode optimizations & other minor improvements into production
2 parents 4d56e4b + 28f83a5 commit 0bce477

9 files changed

Lines changed: 201 additions & 149 deletions

File tree

.gitignore

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
#backup
22
backup.bak
33

4-
# more ignores
5-
bin/
6-
share/
7-
package-lock.json
8-
curate_science/settings.py
9-
package.json
10-
curate/migrations/0057_auto_20200305_1956.py
11-
curate_science/google_cloud_credentials.json.enc
12-
pyvenv.cfg
13-
lib64
14-
media/
15-
16-
174
# Byte-compiled / optimized / DLL files
185
__pycache__/
196
*.py[cod]
@@ -175,5 +162,3 @@ node_modules/
175162

176163
# images
177164
media/key_figures/*.*
178-
179-

dist/js/bundle.js

Lines changed: 91 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 89 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ textarea {
5656
}
5757
}
5858

59+
.TopBar.EmbeddedViewerVisible {
60+
width: 100%;
61+
position: relative;
62+
}
63+
5964
.AppContent.EmbeddedViewerVisible {
60-
width: 50%;
65+
width: 40%;
6166
margin: 0;
6267
max-height: calc(100vh - 56px);
6368
overflow-y: scroll;

src/components/ArticleContent.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,13 @@ class ArticleContent extends React.PureComponent {
324324

325325
<div id="details" hidden={!is_expanded} style={{ paddingBottom: '0.75rem' }}>
326326
<Typography className={classes.abstract} variant="body2">
327-
{ is_article_page ?
327+
{ (is_article_page) ?
328328
<span>{article.abstract}</span>
329-
:
330-
<TruncatedText text={article.abstract} maxLength={540} fontSize={12} />
329+
:
330+
(article.abstract == null || article.abstract.length == 0) ?
331+
null
332+
:
333+
<TruncatedText text={article.abstract} maxLength={540} fontSize={12} />
331334
}
332335
</Typography>
333336
<ArticleKeywords keywords={article.keywords} />

src/components/EmbeddedViewer.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default withRouter(function EmbeddedViewer({ history }) {
4040
const view_url = ViewURL.useContainer()
4141
const viewer_visible = !(view_url.url === null)
4242

43-
const width = viewer_visible ? '50%' : 0
43+
const width = viewer_visible ? '60%' : 0
4444
const visibility = viewer_visible ? 'visible' : 'hidden'
4545

4646
const style = {
@@ -63,6 +63,7 @@ export default withRouter(function EmbeddedViewer({ history }) {
6363
// .AppContent to be rerendered when the viewer is shown (clearing any filters etc.)
6464
// There's probably a better way to do this...
6565
const app_content_el = document.querySelector('.AppContent')
66+
const top_bar_ev = document.querySelector('.TopBar')
6667
const viewer_visible_class = 'EmbeddedViewerVisible'
6768

6869
if (app_content_el) {
@@ -72,12 +73,14 @@ export default withRouter(function EmbeddedViewer({ history }) {
7273
const scroll_position = window.scrollY
7374
// add class
7475
app_content_el.classList.add(viewer_visible_class)
76+
top_bar_ev.classList.add(viewer_visible_class)
7577
app_content_el.scrollTop = scroll_position
7678
} else if (!viewer_visible) {
7779
// Store AppContent scroll position to be applied to window
7880
const scroll_position = app_content_el.scrollTop
7981
// remove class
8082
app_content_el.classList.remove(viewer_visible_class)
83+
top_bar_ev.classList.remove(viewer_visible_class)
8184
window.scrollTo(0, scroll_position)
8285
}
8386
}

src/components/SortArticlesButton.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class SortBy extends React.PureComponent {
8585
style={{color: "#999"}}
8686
>
8787
<Icon className={classes.leftIcon}>sort</Icon>
88-
Sort by { sorted_by ? <span>: { sorted_by }</span> : null }
88+
Sort by
8989
</Button>
9090
{ menu_open ? (
9191
<Paper className={classes.menu}>

src/components/ViewEmbeddedContentButton.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ function pdf_url_is_valid(url) {
4040

4141

4242
function html_url_is_valid(url) {
43+
const valid_urls = ['github.io', 'distill.pub']
4344
if (includes(url, 'frontiersin.org/articles') && endsWith(url, 'full')) return true
44-
if (includes(url, 'github.io')) return true
45+
if (url_contains(url, valid_urls)) return true
4546
return endsWith(url, '.html')
4647
}
4748

@@ -87,7 +88,7 @@ export default function ViewEmbeddedContentButton({ iconStyle, mediaType, style,
8788
}
8889

8990
// If the screen size is less than the XL breakpoint, don't show the embedded content button
90-
const lessThanXl = useMediaQuery(theme => theme.breakpoints.down('lg'))
91+
const lessThanXl = useMediaQuery('(max-width:1499px)')
9192
if (lessThanXl) return null
9293

9394
if (!url_is_valid(url, mediaType)) return null

src/pages/Recent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Home extends React.PureComponent {
2525
articles_loading: true,
2626
content_filters: [],
2727
transparency_filters: ['open_code', 'open_data', 'open_materials'],
28-
sort_by: 'created',
28+
sort_by: null,
2929
more_articles: true,
3030
current_page: 1,
3131
};

0 commit comments

Comments
 (0)