Skip to content

Commit

Permalink
Merge pull request #1240 from KhalisFoundation/dev
Browse files Browse the repository at this point in the history
v1.10.1
  • Loading branch information
saintsoldierx committed Sep 2, 2020
2 parents 067387c + 0edbc3a commit be4a32f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 31 deletions.
1 change: 1 addition & 0 deletions client_id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f7864050-6ee4-4fdd-ae9a-f69fd9dc0c57
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sttm/web",
"version": "1.10.0",
"version": "1.10.1",
"description": "Sevadaars are currently working hard to build a newer version of SikhiToTheMax website using modern web technologies.",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions src/js/components/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ class Autocomplete extends Component {
}

onKeyDown = e => {
e.stopPropagation();
const { activeSuggestion, filteredSuggestions } = this.state;
const isEnterKey = e.keyCode == 13;
const isArrowDownKey = e.keyCode == 38;
const isArrowUpKey = e.keyCode == 40;
const isActiveSuggestion = activeSuggestion !== -1;

if (isEnterKey) {
if (isActiveSuggestion) e.preventDefault();

window.location = filteredSuggestions[activeSuggestion].url;
if (isActiveSuggestion)
window.location = filteredSuggestions[activeSuggestion].url;

this.setState({
activeSuggestion: -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class EnhancedGurmukhiKeyboard extends React.PureComponent {

return (
<button
type='button'
key={i}
data-value={getKeyboardKeyValue(keyboardKey, this.props.value)}
className={isCurrentKeyDefaultMatraKey ? 'matra-button' : ''}
Expand Down
8 changes: 6 additions & 2 deletions src/js/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default class Header extends React.PureComponent {

onFormSubmit = ({ handleSubmit, ...data }) => e => {
e.preventDefault();
e.stopPropagation();
handleSubmit();
this.handleFormSubmit(data);
};
Expand Down Expand Up @@ -153,6 +154,7 @@ export default class Header extends React.PureComponent {
{!isHome && (
<>
<form
noValidate="novalidate"
action={action}
id="top-bar-search-form"
onSubmit={onFormSubmit({
Expand Down Expand Up @@ -190,7 +192,7 @@ export default class Header extends React.PureComponent {
autoComplete="off"
autoCapitalize="none"
autoCorrect="off"
spellCheck="false"
spellCheck={false}
required="required"
name={name}
value={query}
Expand All @@ -205,6 +207,7 @@ export default class Header extends React.PureComponent {
/>

<button
type="button"
className="clear-search-toggle"
onClick={setQueryAs('')}
>
Expand All @@ -225,7 +228,8 @@ export default class Header extends React.PureComponent {
</button>
)}

<button type="submit">
<button
type="submit">
<SearchIcon />
</button>

Expand Down
14 changes: 8 additions & 6 deletions src/js/components/RelatedShabads/RelatedShabads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,15 @@ class RelatedShabads extends React.PureComponent<IRelatedShabadsProps, IRelatedS
</div>
{visibleShabads < totalShabads
&&
(<div className="btn btn-primary">
<button
className="btn"
onClick={this.handleShowMore(totalShabads)}>
More Related Results
(
<div className="relatedShabadShowMore">
<button
className="btn btn-primary"
onClick={this.handleShowMore(totalShabads)}>
More Related Results
</button>
</div>)}
</div>
)}
</div>
);
}}
Expand Down
14 changes: 8 additions & 6 deletions src/js/components/SearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ export default class SearchForm extends React.PureComponent {
}

_isShowKeyboard(type) {
const searchType = this.state.searchType || type;
const searchType = type || this.state.type;

return (
searchType === SEARCH_TYPES.MAIN_LETTERS ||
searchType === SEARCH_TYPES.GURMUKHI_WORD ||
searchType === SEARCH_TYPES.FIRST_LETTERS ||
searchType === SEARCH_TYPES.FIRST_LETTERS_ANYWHERE
Expand Down Expand Up @@ -262,14 +264,15 @@ export default class SearchForm extends React.PureComponent {
}
}

setQueryAs = value => () =>
this.stopPlaceholderAnimation().then(() => {
setQueryAs = value => () => {
return this.stopPlaceholderAnimation().then(() => {
return this.setState(() => ({
query: value,
shouldSubmit:
this.props.submitOnChangeOf.includes('query') && value !== '',
}))
})
}

handleKeyDown = (e) => {
const { type } = this.state;
Expand All @@ -292,11 +295,10 @@ export default class SearchForm extends React.PureComponent {
return true;
}
handleSearchChange = ({ target }) => {
const query = target.value
const query = target.value;
if (this.isQueryAllowed(query)) {
const cursorStart = target.selectionStart;
const cursorEnd = target.selectionEnd;

this.setQueryAs(query)().then(() => {
if (cursorStart !== null) {
return target.setSelectionRange(cursorStart, cursorEnd)
Expand Down Expand Up @@ -339,7 +341,7 @@ export default class SearchForm extends React.PureComponent {
const isShowKeyboard = this._isShowKeyboard(newSearchType) && displayGurmukhiKeyboard;

if (isSearchTypeToAngSearchType) {
newSourceType = Object.keys(SOURCES_WITH_ANG).includes(source) ? source : 'G'
newSourceType = Object.keys(SOURCES_WITH_ANG).includes(newSourceType) ? newSourceType : 'G'
}

this.stopPlaceholderAnimation().then(() =>
Expand Down
14 changes: 0 additions & 14 deletions src/scss/_shabad-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -486,20 +486,6 @@ blockquote {
@media screen and (max-width: 700px) {
width: 100%;
}

&Btn {
background-color: $sttm-blue;
border: none;
border-radius: 5px;
color: $sttm-white;
outline: none;
padding: 10px;
transition: 0.2s ease-in;

&:hover {
background-color: $sttm-bright-blue;
}
}
}

&Source {
Expand Down

0 comments on commit be4a32f

Please sign in to comment.