Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

Commit

Permalink
Minor app tweaks (#1697)
Browse files Browse the repository at this point in the history
* don't show audio if it isn't there

* support new line tags

* better handle speakers

* eslint and build bump
  • Loading branch information
James Baxley authored Jan 3, 2017
1 parent f4999d3 commit 8dfd6fc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 18 deletions.
24 changes: 13 additions & 11 deletions imports/pages/series/series.SingleVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,19 @@ class SeriesSingleVideoWithoutData extends Component {
return (
<div className="background--light-primary">
<SingleVideoPlayer ooyalaId={currentSermon.content.ooyalaId} />
<div
className="soft-sides background--light-secondary text-dark-secondary"
style={{ paddingTop: "15px", paddingBottom: "15px" }}
onClick={this.playAudio}
>
<h7 style={{ verticalAlign: "middle" }}>Listen To Audio</h7>
<i
className="icon-category-audio float-right"
style={{ marginTop: "-2px" }}
/>
</div>
{currentSermon.content.audio.length > 0 && (
<div
className="soft-sides background--light-secondary text-dark-secondary"
style={{ paddingTop: "15px", paddingBottom: "15px" }}
onClick={this.playAudio}
>
<h7 style={{ verticalAlign: "middle" }}>Listen To Audio</h7>
<i
className="icon-category-audio float-right"
style={{ marginTop: "-2px" }}
/>
</div>
)}
<div className="soft soft-double@palm-wide-and-up push-top">
<h2 className="push-half-bottom">{currentSermon.title}</h2>
<h4>{contentHelpers.speakers(currentSermon)}</h4>
Expand Down
16 changes: 14 additions & 2 deletions imports/util/content/__tests__/content.speakers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@ it("returns single speaker with no comma captilized", () => {
expect(result).toBe("Jim Bob");
});

it("returns mutliple speakers comman separated and captilized", () => {
it("returns mutliple speakers comma separated and captilized", () => {
const result = speakers({
content: {
speaker: "jim bob,jimmy jam,jolly jake",
speaker: "jim bob, jimmy jam, jolly jake",
},
});
expect(result).toBe("Jim Bob, Jimmy Jam, Jolly Jake");
});
it("returns mutliple speakers not csv comma separated and captilized", () => {
const result = speakers({
content: {
speaker: `
jim bob
jimmy jam
jolly jake
`,
},
});
expect(result).toBe("Jim Bob, Jimmy Jam, Jolly Jake");
Expand Down
12 changes: 9 additions & 3 deletions imports/util/content/content.speakers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@

function speakers(contentItem) {
const contentSpeakers = contentItem.content.speaker.split(",");
let contentSpeakers = [];

return contentSpeakers.map((speaker) => {
const words = speaker.split(" ");
if (contentItem.content.speaker.indexOf(",") > -1) {
contentSpeakers = contentItem.content.speaker.split(",");
} else {
contentSpeakers = contentItem.content.speaker.split("\n");
}

return contentSpeakers.filter((x) => x.trim()).map((speaker) => {
const words = speaker.trim().split(" ");
return words.map((word) => (
word.charAt(0).toUpperCase() +
word.substr(1, word.length - 1)
Expand Down
4 changes: 2 additions & 2 deletions mobile-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ App.info({
author: "NewSpring Church",
email: "[email protected]",
website: "https://newspring.cc",
version: "5.0.12",
buildNumber: "187",
version: "5.0.13",
buildNumber: "188",
});

App.icons({
Expand Down

0 comments on commit 8dfd6fc

Please sign in to comment.