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

Commit

Permalink
Quick links to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahalwy committed Apr 6, 2016
1 parent 6cf1f97 commit a1189aa
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"json-loader": "~0.5.1",
"jsx-loader": "^0.13.2",
"loopstacks": "0.0.3",
"moment": "^2.12.0",
"morgan": "^1.6.1",
"node-sass": "^3.2.0",
"normalizr": "^2.0.0",
Expand Down
61 changes: 60 additions & 1 deletion src/containers/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import IndexHeader from 'components/header/IndexHeader';
import { Link } from 'react-router';
import { asyncConnect } from 'redux-async-connect'
import { connect } from 'react-redux';
import moment from 'moment';

import debug from 'utils/Debug';

import { isAllLoaded, loadAll } from '../../redux/modules/surahs';
Expand Down Expand Up @@ -90,6 +92,60 @@ class Home extends React.Component {
return null;
}

renderQuickLinks() {
return (
<span className="pull-right">
<ul className="list-inline">
<li>Quick links:</li>
{
moment().isSame(moment().day('Friday')) &&
<li>
<Link
to="/18"
data-metrics-event-name="QuickLinks:Click"
data-metrics-surah-id="18">
Surah Al-Kahf
</Link>
{' '}|
</li>
}
<li>
<Link
to="/36"
data-metrics-event-name="QuickLinks:Click"
data-metrics-surah-id="36">
Surah Yasin (Yaseen)
</Link>{' '}|
</li>
<li>
<Link
to="/55"
data-metrics-event-name="QuickLinks:Click"
data-metrics-surah-id="55">
Surah Ar-Rahman
</Link>{' '}|
</li>
<li>
<Link
to="/67"
data-metrics-event-name="QuickLinks:Click"
data-metrics-surah-id="67">
Surah Al-Mulk
</Link>{' '}|
</li>
<li>
<Link
to="/2/255"
data-metrics-event-name="QuickLinks:Click"
data-metrics-surah-id="2/255">
Ayat Al-Kursi
</Link>
</li>
</ul>
</span>
);
}

render() {
debug('component:Index', 'Render');

Expand All @@ -101,7 +157,10 @@ class Home extends React.Component {
<div className="row">
{this.renderLastVisit()}
<div className="col-md-10 col-md-offset-1">
<h4 className={`text-muted text-center ${styles.title}`}>SURAHS (CHAPTERS)</h4>
<h4 className={`text-muted ${styles.title}`}>
SURAHS (CHAPTERS)
{this.renderQuickLinks()}
</h4>
<div className="row">
<ul className="col-md-4 list-unstyled">
{this.renderColumn(Object.values(this.props.surahs).slice(0, 38))}
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Surah/Title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const Title = ({ surah }) => {
<div className="col-md-6 col-xs-6 surah-title text-center">
{
surah &&
<img src={title} className="title" />
<img src={title} className="title" alt={`${surah.name.simple} (${surah.name.english}) - سورة ${surah.name.arabic}`} />
}
<br />
{
surah &&
<p className="navbar-text text-uppercase surah-name">
{surah.name.simple} ({surah.name.english})
{surah.name.simple} ({surah.name.english}) - سورة {surah.name.arabic}
</p>
}
</div>
Expand Down
6 changes: 5 additions & 1 deletion webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
require('dotenv').config({path: (process.env.NODE_ENV || 'production') + '.env'});
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var webpack = require('webpack');
var IsomorphicPlugin = require('webpack-isomorphic-tools/plugin')
var webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./webpack-isomorphic-tools-configuration'));

var relativeAssetsPath = './static/dist';
var assetsPath = path.join(__dirname, relativeAssetsPath);

module.exports = {
output: {
path: './build',
path: assetsPath,
publicPath: process.env.USE_LOCAL_ASSETS ? '/public/' : '//assets-1f14.kxcdn.com/',
filename: '[name]-[hash].js'
},
Expand Down

0 comments on commit a1189aa

Please sign in to comment.