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

Search v3 #702

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Translation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class Translation extends Component {

return (
<div id={index} className={`${styles.translation} ${isArabic && 'arabic'} translation`}>
<h4 className="montserrat">{translation.resourceName}</h4>
<h4 className="montserrat">{translation.resourceName || translation.author}</h4>
<h2 className={`${isArabic ? 'text-right' : 'text-left'} text-translation times-new`}>
<small
dangerouslySetInnerHTML={{ __html: translation.text }}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Verse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ class Verse extends Component {
{this.renderPlayLink()}
{this.renderCopyLink()}
{this.renderBookmark()}
<Share chapter={chapter} verseKey={verse.verseKey} />
{
chapter &&
<Share chapter={chapter} verseKey={verse.verseKey} />
}
</div>
);
}
Expand Down
21 changes: 0 additions & 21 deletions src/containers/Search/Header/index.js

This file was deleted.

9 changes: 4 additions & 5 deletions src/containers/Search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import LocaleFormattedMessage from 'components/LocaleFormattedMessage';

import { verseType, optionsType } from 'types';

import Header from './Header';
import Header from 'components/IndexHeader';

const style = require('./style.scss');

Expand Down Expand Up @@ -123,7 +123,7 @@ class Search extends Component {
renderBody() {
const { location, isErrored, isLoading, results, options, verses } = this.props;

if (!location.q) {
if (!location.query.q) {
return (
<h3 className="text-center" style={{ padding: '15%' }}>
<LocaleFormattedMessage id="search.nothing" defaultMessage="No search query." />
Expand Down Expand Up @@ -153,9 +153,8 @@ class Search extends Component {

return results.map(result => (
<Verse
verse={verses[result.verse]}
match={result.match}
key={result.verse}
verse={verses[result]}
key={result}
tooltip={options.tooltip}
isSearched
/>
Expand Down
7 changes: 7 additions & 0 deletions src/containers/Search/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@
}
}
}

.logo{
padding-top: 10px;
padding-bottom: 10px;
height: auto;
width: 100%;
}
2 changes: 1 addition & 1 deletion src/redux/actions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
export function search(params) {
return {
types: [SEARCH, SEARCH_SUCCESS, SEARCH_FAIL],
schema: { results: [{ ayah: versesSchema }] },
schema: { results: [versesSchema] },
// TODO: We are doing this because of a weird obj.hasOwnProperty method missing on `params`
promise: client => client.get('/api/v3/search', { params: { q: params.q, p: params.p } }),
params
Expand Down
5 changes: 2 additions & 3 deletions src/redux/modules/fontFaces.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { LOAD_SUCCESS } from 'redux/constants/verses.js';
import { SEARCH_SUCCESS } from 'redux/constants/search.js';
// import { SEARCH_SUCCESS } from 'redux/constants/search.js';
import LOAD from 'redux/constants/fontFace.js';

export default function reducer(state = {}, action = {}) {
switch (action.type) {
case LOAD_SUCCESS:
case SEARCH_SUCCESS: {
case LOAD_SUCCESS: {
const verses = action.result.entities.verses;
const classNames = {};

Expand Down
11 changes: 5 additions & 6 deletions src/redux/modules/searchResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ export default function reducer(state = initialState, action = {}) {
loaded: true,
loading: false,
errored: false,
total: action.result.result.total,
page: action.result.result.page,
size: action.result.result.size,
from: action.result.result.from,
took: action.result.result.took,
query: action.result.result.query,
total: action.result.total,
page: action.result.page,
size: action.result.result.results.length,
took: action.result.took,
query: action.result.query,
results: action.result.result.results,
entities: Object.assign({}, state.entities, action.result.entities.verses)
};
Expand Down