Skip to content

Commit f88b77e

Browse files
Merge pull request #1865 from KhalisFoundation/dev
Prod release 1.18.6
2 parents aaad77d + 3f2518e commit f88b77e

17 files changed

Lines changed: 400 additions & 108 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
node-version: lts/*
1616
- name: Install dependencies
1717
run: npm ci
18+
- name: Build project
19+
run: npm run build
1820
- name: Install Playwright Browsers
1921
run: npx playwright install --with-deps
2022
- name: Run Playwright tests

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sttm/web",
3-
"version": "1.18.5",
3+
"version": "1.18.6",
44
"description": "Sevadaars are currently working hard to build a newer version of SikhiToTheMax website using modern web technologies.",
55
"main": "index.js",
66
"engines": {

server/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ export default ({ url, bodyClass, title, description, language }) => marinate`
6464
<meta name="apple-mobile-web-app-capable" content="yes">
6565
<meta name="apple-mobile-web-app-status-bar-style" content="black">
6666
<meta name="apple-mobile-web-app-title" content="STTM">
67-
<link rel="apple-touch-icon" href="/assets/images/sundar-gutka-flat-icon.png">
67+
<link rel="apple-touch-icon" href="/assets/images/logo-192x192.png">
6868
6969
<!-- Windows Tile -->
7070
<meta name="msapplication-config" content="ieconfig.xml">
7171
<meta name="application-name" content="STTM">
7272
73-
<link rel="android-touch-icon" href="/assets/images/sundar-gutka-flat-icon.png">
73+
<link rel="android-touch-icon" href="/assets/images/logo-192x192.png">
7474
${stylesheetsHTML}
7575
7676
<script type="application/ld+json">

src/js/components/Autocomplete.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class Autocomplete extends Component {
177177
<ul
178178
className={`search-result ${isHome ? 'search-result-home' : ''}`}
179179
id="suggestions"
180+
aria-label="Search Suggestions"
180181
ref={this.wrapperRef}
181182
onKeyDown={this.onKeyDown} >
182183
{filteredSuggestions.map((suggestion, index) => {

src/js/components/Header.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,23 @@ class Header extends React.PureComponent {
9393

9494
onFormSubmit =
9595
({ handleSubmit, autoDetectGurmukhi, ...data }) =>
96-
(e) => {
97-
e.preventDefault();
98-
e.stopPropagation();
99-
handleSubmit();
100-
// Remove the last space in from the searched query.
101-
const isNotAngSearch = SEARCH_TYPES[data.type] !== SEARCH_TYPES.ANG;
102-
if (isNotAngSearch) {
103-
data.query = data.query.trim();
104-
}
96+
(e) => {
97+
e.preventDefault();
98+
e.stopPropagation();
99+
handleSubmit();
100+
// Remove the last space in from the searched query.
101+
const isNotAngSearch = SEARCH_TYPES[data.type] !== SEARCH_TYPES.ANG;
102+
if (isNotAngSearch) {
103+
data.query = data.query.trim();
104+
}
105105

106-
const searchParams = { ...data, autoDetectGurmukhi };
107-
if (data.type === SEARCH_TYPES.AUTO_DETECT && autoDetectGurmukhi) {
108-
searchParams.isGurmukhi = true;
109-
}
106+
const searchParams = { ...data, autoDetectGurmukhi };
107+
if (data.type === SEARCH_TYPES.AUTO_DETECT && autoDetectGurmukhi) {
108+
searchParams.isGurmukhi = true;
109+
}
110110

111-
this.handleFormSubmit(searchParams);
112-
};
111+
this.handleFormSubmit(searchParams);
112+
};
113113

114114
handleFormSubmit = (data) => {
115115
this.props.history.push(toSearchURL(data));
@@ -146,10 +146,10 @@ class Header extends React.PureComponent {
146146
type: defaultType = isAng ? SEARCH_TYPES.ANG.toString() : null,
147147
writer: defaultWriter = DEFAULT_SEARCH_WRITER,
148148
autoDetectGurmukhi:
149-
defaultAutoDetectGurmukhi = getBooleanFromLocalStorage(
150-
LOCAL_STORAGE_KEY_FOR_AUTO_DETECT_GURMUKHI,
151-
false
152-
),
149+
defaultAutoDetectGurmukhi = getBooleanFromLocalStorage(
150+
LOCAL_STORAGE_KEY_FOR_AUTO_DETECT_GURMUKHI,
151+
false
152+
),
153153
} = getQueryParams(location.search);
154154

155155
const isAskGurbaniBotSearchType =
@@ -195,22 +195,21 @@ class Header extends React.PureComponent {
195195
}
196196
defaultSource={
197197
isAskGurbaniBotSearchType
198-
? localStorage.getItem(LOCAL_STORAGE_KEY_FOR_SEARCH_SOURCE) ||
199-
DEFAULT_SEARCH_SOURCE
198+
? DEFAULT_SEARCH_SOURCE
200199
: defaultSource
201200
}
202201
defaultType={
203202
isAskGurbaniBotSearchType
204203
? getNumberFromLocalStorage(
205-
LOCAL_STORAGE_KEY_FOR_SEARCH_TYPE,
206-
DEFAULT_SEARCH_TYPE
207-
)
204+
LOCAL_STORAGE_KEY_FOR_SEARCH_TYPE,
205+
DEFAULT_SEARCH_TYPE
206+
)
208207
: Number(defaultType)
209208
}
210209
defaultWriter={
211210
isAskGurbaniBotSearchType
212211
? localStorage.getItem(LOCAL_STORAGE_KEY_FOR_SEARCH_WRITER) ||
213-
DEFAULT_SEARCH_WRITER
212+
DEFAULT_SEARCH_WRITER
214213
: Number(defaultWriter)
215214
}
216215
defaultAutoDetectGurmukhi={defaultAutoDetectGurmukhi}
@@ -457,7 +456,7 @@ class Header extends React.PureComponent {
457456
writer,
458457
isGurmukhi:
459458
parseInt(type) ===
460-
SEARCH_TYPES.AUTO_DETECT &&
459+
SEARCH_TYPES.AUTO_DETECT &&
461460
autoDetectGurmukhi,
462461
}}
463462
value={query}
@@ -483,6 +482,7 @@ class Header extends React.PureComponent {
483482
id="search-type"
484483
value={type.toString()}
485484
onChange={handleSearchTypeChange}
485+
aria-label="Search Type"
486486
>
487487
{reformatSearchTypes(TYPES).map(({ type, value }) => (
488488
<option key={value} value={value}>
@@ -536,13 +536,13 @@ class Header extends React.PureComponent {
536536
?.filter((e) =>
537537
source === 'G' || source === 'A'
538538
? !SOURCE_WRITER_FILTER[source].includes(
539-
e.writerID
540-
)
539+
e.writerID
540+
)
541541
: source !== 'all'
542-
? SOURCE_WRITER_FILTER[source].includes(
542+
? SOURCE_WRITER_FILTER[source].includes(
543543
e.writerID
544544
)
545-
: true
545+
: true
546546
)
547547
.map((writer) => (
548548
<option

src/js/components/Modals/AskGurbaniBotQuestionModal.tsx

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SearchIcon from '@/components/Icons/Search';
88
import { toSearchURL } from '@/util';
99

1010
import Dialog from './Dialog';
11-
import { SEARCH_TYPES } from '@/constants';
11+
import { SEARCH_TYPES, SOURCES } from '@/constants';
1212

1313
interface Props {
1414
isModalOpen: boolean;
@@ -22,24 +22,26 @@ const AskGurbaniBotQuestionModal = (props: Props) => {
2222
({
2323
handleFormSubmit,
2424
query,
25+
source,
2526
}: {
2627
handleFormSubmit: FormEventHandler;
2728
query: string;
29+
source: string;
2830
}) =>
29-
(e: FormEvent) => {
30-
e.preventDefault();
31-
typeof handleFormSubmit === 'function' && handleFormSubmit();
32-
history.push(
33-
toSearchURL({
34-
query,
35-
type: SEARCH_TYPES.ASK_A_QUESTION,
36-
writer: 'all',
37-
source: 'all',
38-
offset: '',
39-
})
40-
);
41-
dispatch(setModalOpen(''));
42-
};
31+
(e: FormEvent) => {
32+
e.preventDefault();
33+
typeof handleFormSubmit === 'function' && handleFormSubmit();
34+
history.push(
35+
toSearchURL({
36+
query,
37+
type: SEARCH_TYPES.ASK_A_QUESTION,
38+
writer: 'all',
39+
source,
40+
offset: '',
41+
})
42+
);
43+
dispatch(setModalOpen(''));
44+
};
4345

4446
return (
4547
<Dialog
@@ -51,8 +53,9 @@ const AskGurbaniBotQuestionModal = (props: Props) => {
5153
defaultType={SEARCH_TYPES.ASK_A_QUESTION}
5254
defaultSource="all"
5355
defaultWriter={0}
56+
isolateFromLocalStorage // helps to keep the bot search form state isolated from the main/normal search form
5457
>
55-
{({
58+
{(({
5659
pattern,
5760
disabled,
5861
title,
@@ -65,13 +68,17 @@ const AskGurbaniBotQuestionModal = (props: Props) => {
6568
handleKeyDown,
6669
handleSearchChange,
6770
handleSubmit: handleFormSubmit,
71+
source,
72+
handleSearchSourceChange,
73+
isSourceChanged,
6874
}) => (
6975
<form
7076
className="search-form"
7177
action={action}
7278
onSubmit={handleSubmit({
7379
handleFormSubmit: handleFormSubmit,
7480
query,
81+
source,
7582
})}
7683
>
7784
<div className="search-container-wrapper">
@@ -102,8 +109,24 @@ const AskGurbaniBotQuestionModal = (props: Props) => {
102109
</button>
103110
</div>
104111
</div>
112+
<div className="search-options">
113+
<div className="search-option">
114+
<select
115+
name="source"
116+
value={source}
117+
className={[isSourceChanged ? 'selected' : null]}
118+
onChange={handleSearchSourceChange}
119+
>
120+
{Object.entries(SOURCES).map(([value, children]) => (
121+
<option key={value} value={value}>
122+
{children}
123+
</option>
124+
))}
125+
</select>
126+
</div>
127+
</div>
105128
</form>
106-
)}
129+
))}
107130
</SearchForm>
108131
</div>
109132
</Dialog>

0 commit comments

Comments
 (0)