Skip to content

Commit

Permalink
v5.0.1
Browse files Browse the repository at this point in the history
v5.0.1
  • Loading branch information
eliselavy authored Oct 31, 2024
2 parents 5faa1a0 + 80de13e commit ff95906
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 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": "5.0.0",
"version": "5.0.1",
"private": true,
"dependencies": {
"@auth0/auth0-react": "^1.1.0",
Expand Down
5 changes: 5 additions & 0 deletions src/components/ArticleV3/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const Article = ({
console.info('[Article] onCellClickHandler', dataHref)
setSelectedDataHref(dataHref)
}

if (e.target.hasAttribute('data-idx')) {
e.preventDefault();
setSelectedCellIdx(e.target.getAttribute('data-idx'));
}
}

return (
Expand Down
42 changes: 32 additions & 10 deletions src/components/ArticleV3/ArticleCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ArticleCell = ({
const isolationMode = outputs.some(
(d) => typeof d.metadata === 'object' && d.metadata['text/html']?.isolated,
)
const renderUsingThebe = true //tags.includes('data');
const renderUsingThebe = type === CellTypeCode && !figure?.isSound; //tags.includes('data');

// const ref = useCallback(
// (node) => {
Expand Down Expand Up @@ -137,15 +137,37 @@ const ArticleCell = ({
{type === CellTypeMarkdown && content && (
<Row>
<Col {...cellBootstrapColumnLayout}>
<ArticleCellContent
headingLevel={headingLevel}
onNumClick={onNumClick}
hideNum={hideNum}
layer={layer}
content={content}
idx={idx}
num={num}
/>

{figure ? (
<ArticleCellFigure
metadata={metadata}
figure={figure}
active={active}
cellType={type}
>
<ArticleCellContent
headingLevel={headingLevel}
onNumClick={onNumClick}
hideNum={hideNum}
layer={layer}
content={content}
idx={idx}
num={num}
/>
</ArticleCellFigure>

) : (

<ArticleCellContent
headingLevel={headingLevel}
onNumClick={onNumClick}
hideNum={hideNum}
layer={layer}
content={content}
idx={idx}
num={num}
/>
)}
</Col>
</Row>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleV3/ArticleCellFigure.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ArticleCellFigure = ({
const aspectRatio = getFigureRatio(tags);
const figureHeight = useFigureHeight(tags, !aspectRatio, figure.isCover);
const containerWidth = useContainerWidth(pictureRef);
const shouldUseFixedHeight = figureHeight && (!figure.isCover || !aspectRatio) && (figureHeight * aspectRatio) <= containerWidth;
const shouldUseFixedHeight = figureHeight && (!figure.isCover || !aspectRatio) && (figureHeight / aspectRatio) <= containerWidth;

const { height: windowHeight } = useWindowSize();

Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleV3/ArticleScrollTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ArticleScrollTo = () => {
}
}
useEffect(() => {
if(selectedCellIdxFromStore !== -1 && selectedCellIdx !== -1 && selectedCellIdxFromStore !== selectedCellIdx) {
if(selectedCellIdxFromStore !== -1 && selectedCellIdxFromStore !== selectedCellIdx) {
moveTo(selectedCellIdxFromStore)
setQuery({ [DisplayLayerCellIdxQueryParam]: selectedCellIdxFromStore })
}
Expand Down
3 changes: 2 additions & 1 deletion src/models/ArticleFigure.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CoverRefPrefix, FigureRefPrefix } from '../constants'
import { CoverRefPrefix, FigureRefPrefix, SoundRefPrefix } from '../constants'

export default class ArticleFigure {
constructor({
Expand All @@ -17,6 +17,7 @@ export default class ArticleFigure {
this.ref = ref
this.isTable = isTable
this.isCover = refPrefix === CoverRefPrefix
this.isSound = refPrefix === SoundRefPrefix;
this.tNLabel = this.isCover
? 'cover'
: `numbers.${refPrefix.substring(0, refPrefix.length - 1)}`
Expand Down

0 comments on commit ff95906

Please sign in to comment.