diff --git a/.env b/.env
index 92df7e55c..2c85a0ee9 100644
--- a/.env
+++ b/.env
@@ -1,6 +1,6 @@
NODE_ENV=development
PORT=8000
-API_URL=http://quran.com:3000
+API_URL=http://staging.quran.com:3000
ONE_QURAN_URL=http://localhost:3030
SEGMENTS_KEY=
SENTRY_KEY_CLIENT=
diff --git a/src/components/Ayah/index.js b/src/components/Ayah/index.js
index 8d8fde7cb..2e4d24e8d 100644
--- a/src/components/Ayah/index.js
+++ b/src/components/Ayah/index.js
@@ -22,6 +22,7 @@ export default class Ayah extends Component {
ayah: PropTypes.object.isRequired,
bookmarked: PropTypes.bool.isRequired,
bookmarkActions: PropTypes.object,
+ mediaActions: PropTypes.object.isRequired,
match: PropTypes.array,
isSearch: PropTypes.bool,
isPlaying: PropTypes.bool,
@@ -87,6 +88,41 @@ export default class Ayah extends Component {
});
}
+ renderMedia() {
+ const { ayah, mediaActions } = this.props;
+
+ if (!ayah.mediaContent.length) return false;
+
+ return (
+
+ {
+ ayah.mediaContent.map((content, index) => (
+
+
Media: {content.resource.name}
+
+
+ ))
+ }
+
+ );
+ }
+
renderText() {
const { ayah, audioActions: { setCurrentWord }, tooltip } = this.props;
@@ -257,6 +293,7 @@ export default class Ayah extends Component {
{this.renderText()}
{this.renderTranslations()}
+ {this.renderMedia()}
);
diff --git a/src/containers/App/index.js b/src/containers/App/index.js
index 3753570a0..033335741 100644
--- a/src/containers/App/index.js
+++ b/src/containers/App/index.js
@@ -9,6 +9,12 @@ import Helmet from 'react-helmet';
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
+import Button from 'react-bootstrap/lib/Button';
+import Modal from 'react-bootstrap/lib/Modal';
+const ModalHeader = Modal.Header;
+const ModalTitle = Modal.Title;
+const ModalBody = Modal.Body;
+const ModalFooter = Modal.Footer;
import debug from '../../helpers/debug';
import config from '../../config';
@@ -17,11 +23,15 @@ import { authConnect } from './connect';
import FontStyles from 'components/FontStyles';
+import { removeMedia } from 'redux/actions/media';
+
const styles = require('./style.scss');
class App extends Component {
static propTypes = {
- surahs: PropTypes.object,
+ surahs: PropTypes.object.isRequired,
+ media: PropTypes.object.isRequired,
+ removeMedia: PropTypes.func.isRequired,
children: PropTypes.any
};
@@ -30,7 +40,7 @@ class App extends Component {
};
render() {
- const { children } = this.props;
+ const { children, media, removeMedia } = this.props;
debug('component:APPLICATION', 'Render');
return (
@@ -103,6 +113,19 @@ class App extends Component {
+
+
+
+ {media.content && media.content.resource.name}
+
+
+
+ {
+ media.content &&
+
+ }
+
+
);
}
@@ -112,4 +135,7 @@ const metricsApp = metrics(metricsConfig)(App);
const AsyncApp = asyncConnect([{ promise: authConnect }])(metricsApp);
-export default connect(state => ({surahs: state.surahs.entities }))(AsyncApp);
+export default connect(
+ state => ({surahs: state.surahs.entities, media: state.media }),
+ { removeMedia }
+)(AsyncApp);
diff --git a/src/containers/Surah/index.js b/src/containers/Surah/index.js
index 027d91dd8..44c961486 100644
--- a/src/containers/Surah/index.js
+++ b/src/containers/Surah/index.js
@@ -42,6 +42,7 @@ import * as AudioActions from '../../redux/actions/audioplayer.js';
import * as AyahActions from '../../redux/actions/ayahs.js';
import * as BookmarkActions from '../../redux/actions/bookmarks.js';
import * as OptionsActions from '../../redux/actions/options.js';
+import * as MediaActions from '../../redux/actions/media.js';
const style = require('./style.scss');
@@ -306,6 +307,7 @@ class Surah extends Component {
tooltip={options.tooltip}
bookmarkActions={actions.bookmark}
audioActions={actions.audio}
+ mediaActions={actions.media}
isPlaying={isPlaying}
isAuthenticated={isAuthenticated}
key={`${ayah.surahId}-${ayah.ayahNum}-ayah`}
@@ -466,8 +468,9 @@ function mapDispatchToProps(dispatch) {
options: bindActionCreators(OptionsActions, dispatch),
ayah: bindActionCreators(AyahActions, dispatch),
audio: bindActionCreators(AudioActions, dispatch),
- push: bindActionCreators(push, dispatch),
- bookmark: bindActionCreators(BookmarkActions, dispatch)
+ bookmark: bindActionCreators(BookmarkActions, dispatch),
+ media: bindActionCreators(MediaActions, dispatch),
+ push: bindActionCreators(push, dispatch)
}
};
}
diff --git a/src/redux/actions/media.js b/src/redux/actions/media.js
new file mode 100644
index 000000000..27c77ff06
--- /dev/null
+++ b/src/redux/actions/media.js
@@ -0,0 +1,17 @@
+import {
+ SET_MEDIA,
+ REMOVE_MEDIA
+} from '../constants/media';
+
+export function setMedia(content) {
+ return {
+ type: SET_MEDIA,
+ content
+ };
+};
+
+export function removeMedia() {
+ return {
+ type: REMOVE_MEDIA
+ };
+};
diff --git a/src/redux/constants/media.js b/src/redux/constants/media.js
new file mode 100644
index 000000000..068a6f937
--- /dev/null
+++ b/src/redux/constants/media.js
@@ -0,0 +1,3 @@
+export const SET_MEDIA = '@@quran/auth/SET_MEDIA';
+export const SET_OPTIONS = '@@quran/auth/SET_OPTIONS';
+export const REMOVE_MEDIA = '@@quran/auth/REMOVE_MEDIA';
diff --git a/src/redux/modules/media.js b/src/redux/modules/media.js
new file mode 100644
index 000000000..c7519fb32
--- /dev/null
+++ b/src/redux/modules/media.js
@@ -0,0 +1,27 @@
+import {
+ SET_MEDIA,
+ REMOVE_MEDIA
+} from '../constants/media';
+
+const initialState = {
+ content: null
+};
+
+export default function reducer(state = initialState, action = {}) {
+ switch (action.type) {
+ case SET_MEDIA: {
+ return {
+ ...state,
+ content: action.content
+ };
+ }
+ case REMOVE_MEDIA: {
+ return {
+ ...state,
+ content: null
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/src/redux/modules/reducer.js b/src/redux/modules/reducer.js
index 4b1aa7a95..86a430c3f 100644
--- a/src/redux/modules/reducer.js
+++ b/src/redux/modules/reducer.js
@@ -11,12 +11,14 @@ import searchResults from './searchResults';
import fontFaces from './fontFaces';
import auth from './auth';
import bookmarks from './bookmarks';
+import media from './media';
export default combineReducers({
routing: routerReducer,
reduxAsyncConnect,
auth,
bookmarks,
+ media,
surahs,
ayahs,
audioplayer,