Skip to content

Commit

Permalink
Merge pull request #604 from C2DH/develop
Browse files Browse the repository at this point in the history
v4.4.1
  • Loading branch information
eliselavy authored Jan 23, 2024
2 parents 2463eef + 6d18f64 commit db14345
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdh",
"version": "4.4.0",
"version": "4.4.1",
"private": true,
"dependencies": {
"@auth0/auth0-react": "^1.1.0",
Expand Down
15 changes: 14 additions & 1 deletion src/components/Article/ArticleCellDataTable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import {
ChevronLeft,
ChevronsLeft,
Expand Down Expand Up @@ -78,6 +78,7 @@ const ArticleCellDataTable = ({
htmlContent = '',
allowFilterColumn = false,
allowSorting = true,
initialPageSize = -1,
}) => {
const { t } = useTranslation()
const [columnFilters, setColumnFilters] = React.useState([])
Expand Down Expand Up @@ -179,6 +180,18 @@ const ArticleCellDataTable = ({
)

console.debug('[ArticleCellDataTable] rendered \n - cellIdx:', cellIdx)
useEffect(() => {
if (initialPageSize === -1) return
console.debug(
'[ArticleCellDataTable] @useEffect \n - cellIdx:',
cellIdx,
'\n - initialPageSize:',
initialPageSize,
)
// get number out of page-size-10
table.setPageSize(Number(initialPageSize.match(/\d+/)[0]))
}, [initialPageSize])

return (
<div className="ArticleCellDataTable">
{/* Pagination */}
Expand Down
16 changes: 12 additions & 4 deletions src/components/Article/ArticleCellFigure.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ const ArticleCellFigure = ({
// captions,
// )

const isDataTable = figure.refPrefix === DataTableRefPrefix && cellType === 'markdown'
const isDataTable =
(tags.includes('data-table') || figure.refPrefix === DataTableRefPrefix) &&
cellType === 'markdown'
let dataTableContent = ''
if (isDataTable) {
columnLayout = { md: 10, lg: 11 }
columnLayout = { md: 10, xxl: 11 }

if (htmlOutputs.length > 0) {
dataTableContent = htmlOutputs[0].data['text/html'].join('\n')
Expand All @@ -137,7 +139,7 @@ const ArticleCellFigure = ({
<Container className={containerClassName} fluid={isFluidContainer}>
<Row>
<Col {...columnLayout}>
{otherOutputs.length > 0 && (
{!isDataTable && otherOutputs.length > 0 ? (
<figure>
<div className="anchor" id={figure.ref} />
<ArticleCellOutputs
Expand All @@ -151,7 +153,7 @@ const ArticleCellFigure = ({
height={parseInt(figureHeight)}
/>
</figure>
)}
) : null}
{pictures.map(({ base64 }, i) => (
<figure
key={i}
Expand Down Expand Up @@ -191,6 +193,12 @@ const ArticleCellFigure = ({
<ArticleCellDataTable
cellType={cellType}
cellIdx={figure.idx}
initialPageSize={
tags.find((d) => {
const m = d.match(/^page-size-(\d+)$/)
return m ? m[1] : false
}) || -1
}
htmlContent={dataTableContent}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/components/ArticleV2/ArticleToC.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ArticleToC = ({
})
}
// availble height for the toc
const toCHeight = height - 200
const toCHeight = hasBibliography ? height - 150 : height - 100
// mapping of cells using cell index
const cellsIndex = paragraphs.reduce((acc, cell) => {
acc[cell.idx] = cell
Expand Down Expand Up @@ -156,7 +156,7 @@ const ArticleToC = ({
isSectionEnd
selected
active={false}
className=""
className="mt-2"
onClick={(e) => onSectionClickHandler(e, DisplayLayerSectionBibliography)}
></ToCStep>
)}
Expand Down
6 changes: 5 additions & 1 deletion src/components/ArticleV2/ArticleToCSteps.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.ArticleToCSteps {
overflow: hidden;
overflow-y: auto;
border-top: 1px solid;
border-bottom: 1px solid;

pointer-events: all;
}
.ArticleToCSteps,
.ArticleToCSteps ul,
Expand Down Expand Up @@ -30,7 +35,6 @@
width: 17px;
border: 1px solid transparent;
padding: 0;
pointer-events: all;
}

.ArticleToCSteps__nested__toggleCollapsed button > span {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleV2/ArticleToCSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const ArticleToCSteps = ({
)

return (
<ol style={style} className={`ArticleToCSteps ${className}`}>
<ol style={style} className={`ArticleToCSteps py-3 ${className}`}>
{props.map(({ height, backgroundColor, rotation }, i) => {
const nestedSteps = steps[i]
return (
Expand Down
23 changes: 10 additions & 13 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@ const apiPath = process.env.REACT_APP_API_ROOT || '/api'

fs.appendFile(
'./setupProxy.log',
`${(new Date()).toISOString()} target=${target} apiPath=${apiPath}\n`,
(err) => console.error(err)
);
`${new Date().toISOString()} target=${target} apiPath=${apiPath}\n`,
(err) => console.error(err),
)

module.exports = function(app) {
module.exports = function (app) {
app.use(
apiPath,
createProxyMiddleware({
target,
changeOrigin: true,
})
);
}),
)
app.use(
'/proxy-githubusercontent',
createProxyMiddleware({
target: 'https://raw.githubusercontent.com',
target,
changeOrigin: true,
pathRewrite: {
'^/proxy-githubusercontent': '/', // rewrite path
},
})
);
};
}),
)
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16467,9 +16467,9 @@ typescript@^3.9.7:
integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==

ua-parser-js@^0.7.24:
version "0.7.32"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211"
integrity sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==
version "0.7.33"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532"
integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==

uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.6"
Expand Down

0 comments on commit db14345

Please sign in to comment.