Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit fdc0a0d

Browse files
naveed-ahmadmmahalwy
authored andcommitted
use text fonts for render page mode (#715)
1 parent 8e30594 commit fdc0a0d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/components/Line/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default class Line extends React.Component {
1717
play: PropTypes.func.isRequired,
1818
setCurrentWord: PropTypes.func.isRequired,
1919
}),
20-
isPlaying: PropTypes.bool
20+
isPlaying: PropTypes.bool,
21+
useTextFont: PropTypes.bool
2122
};
2223

2324
// NOTE: this is commented out as it caused problems with 55:31 with missing text.
@@ -34,7 +35,7 @@ export default class Line extends React.Component {
3435
// }
3536

3637
renderText() {
37-
const { tooltip, currentVerse, audioActions, isPlaying, line } = this.props;
38+
const { tooltip, currentVerse, audioActions, isPlaying, line, useTextFont } = this.props;
3839

3940
const text = line.map(word => (
4041
<Word
@@ -44,6 +45,7 @@ export default class Line extends React.Component {
4445
tooltip={tooltip}
4546
isPlaying={isPlaying}
4647
audioActions={audioActions}
48+
useTextFont={useTextFont}
4749
/>
4850
));
4951

src/components/PageView/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import React, { PropTypes } from 'react';
2+
import { connect } from 'react-redux';
23

34
import Line from 'components/Line';
45
import PageBreak from 'components/PageBreak';
56

6-
const PageView = ({ lines, keys, currentVerse, options, isPlaying, audioActions }) => {
7+
const PageView = ({ lines, keys, currentVerse, options, isPlaying, audioActions, userAgent }) => {
78
const elements = keys.map((lineNum, index) => {
89
const nextNum = keys[index + 1];
910
const pageNum = lineNum.split('-')[0];
1011
const line = lines[lineNum];
12+
const renderText = userAgent.isChrome || userAgent.isOpera || userAgent.isBot;
1113

1214
if (index + 1 !== keys.length && pageNum !== nextNum.split('-')[0]) {
1315
return [
@@ -18,6 +20,7 @@ const PageView = ({ lines, keys, currentVerse, options, isPlaying, audioActions
1820
tooltip={options.tooltip}
1921
audioActions={audioActions}
2022
isPlaying={isPlaying}
23+
useTextFont={renderText}
2124
/>,
2225
<PageBreak pageNum={parseInt(pageNum, 10) + 1} />
2326
];
@@ -31,6 +34,7 @@ const PageView = ({ lines, keys, currentVerse, options, isPlaying, audioActions
3134
tooltip={options.tooltip}
3235
audioActions={audioActions}
3336
isPlaying={isPlaying}
37+
useTextFont={renderText}
3438
/>
3539
);
3640
});
@@ -47,7 +51,10 @@ PageView.propTypes = {
4751
currentVerse: PropTypes.string,
4852
bookmarks: PropTypes.object.isRequired, // eslint-disable-line
4953
options: PropTypes.object.isRequired, // eslint-disable-line
50-
isPlaying: PropTypes.bool
54+
isPlaying: PropTypes.bool,
55+
userAgent: PropTypes.func
5156
};
5257

53-
export default PageView;
58+
export default connect(state => ({
59+
userAgent: state.options.userAgent
60+
}))(PageView);

0 commit comments

Comments
 (0)