Skip to content

Commit 43c7991

Browse files
authored
Merge pull request #16 from tutorcruncher/location-search
Location search fixes
2 parents 5d9ab78 + 38142e4 commit 43c7991

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

config-overrides.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ module.exports = function override (config, env) {
1919
{
2020
loader: 'sass-loader',
2121
options: {
22-
outputStyle: 'compressed'
22+
outputStyle: 'compressed',
23+
includePaths: [path.resolve(__dirname, 'node_modules')],
2324
}
2425
}
2526
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tutorcruncher-socket",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "TutorCruncher socket",
55
"author": "Samuel Colvin <samuel@tutorcruncher.com>",
66
"private": false,

public/simple/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
var api_root = null // 'https://socket-beta.tutorcruncher.com' 'http://localhost:8000'
3737
window.socket = socket(public_key, {
3838
api_root: api_root,
39-
// subject_filter: false,
40-
// location_input: false
4139
})
4240
</script>
4341
</html>

src/components/contractors/Contractors.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,28 @@ class Contractors extends Component {
117117
}
118118

119119
render () {
120-
let description = ''
121120
const con_count = this.state.contractor_response && this.state.contractor_response.count
122-
if (con_count && this.state.selected_subject) {
123-
const msg_id_suffix = con_count === 1 ? 'single' : 'plural'
124-
description = this.props.root.get_text('subject_filter_summary_' + msg_id_suffix, {
125-
count: con_count,
126-
subject: this.state.selected_subject.name,
127-
})
121+
const location_pretty = (
122+
this.state.contractor_response &&
123+
this.state.contractor_response.location &&
124+
this.state.contractor_response.location.pretty
125+
)
126+
127+
let description = ''
128+
if (con_count) {
129+
const description_prefix = []
130+
if (location_pretty) {
131+
description_prefix.push(location_pretty)
132+
}
133+
if (this.state.selected_subject) {
134+
description_prefix.push(this.state.selected_subject.name)
135+
}
136+
if (description_prefix.length > 0) {
137+
description = this.props.root.get_text('filter_summary_' + (con_count === 1 ? 'single' : 'plural'), {
138+
count: con_count,
139+
prefix: description_prefix.join('; '),
140+
})
141+
}
128142
}
129143
const DisplayComponent = this.props.config.mode === 'grid' ? Grid : List
130144
return (
@@ -152,7 +166,9 @@ class Contractors extends Component {
152166
root={this.props.root}/>
153167
<If v={this.state.contractor_response && this.state.contractor_response.count === 0}>
154168
<div className="tcs-no-contractors">
155-
{this.props.root.get_text(this.state.location_str === null ? 'no_tutors_found' : 'no_tutors_found_loc')}
169+
{this.props.root.get_text(
170+
this.state.location_str === null ? 'no_tutors_found' : 'no_tutors_found_loc', {location_pretty}
171+
)}
156172
</div>
157173
</If>
158174

src/components/contractors/Filters.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
22
import Select from 'react-select'
3-
import 'react-select/dist/react-select.css'
43
import {If} from '../shared/Tools'
54

65
export const SubjectSelect = ({get_text, show, subjects, selected_subject, subject_change}) => {

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ const STRINGS = {
3535
grecaptcha_missing: 'This captcha is required',
3636
required: ' (Required)',
3737
subject_filter_placeholder: 'Select a subject...',
38-
subject_filter_summary_single: '{subject}: showing 1 result',
39-
subject_filter_summary_plural: '{subject}: showing {count} results',
38+
filter_summary_single: '{prefix}: showing 1 result',
39+
filter_summary_plural: '{prefix}: showing {count} results',
4040
location_input_placeholder: 'Enter your address or zip/postal code...',
4141
view_profile: 'View Profile',
4242
review_hours: '({hours} hours)',
4343
previous: 'Previous',
4444
next: 'Next',
4545
no_tutors_found: 'No more tutors found',
46-
no_tutors_found_loc: 'No more tutors found near this location',
46+
no_tutors_found_loc: 'No more tutors found near "{location_pretty}"',
4747
distance_away: '{distance}km away',
4848
}
4949

src/styles/contractor-filters.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@import './vue-multiselect/dist/vue-multiselect.min';
1+
@import 'react-select/dist/react-select.min';
22
@import '../conf';
33

44
.multiselect__select {
@@ -41,6 +41,7 @@
4141
padding: 8px;
4242
font-size: 16px;
4343
outline: none !important;
44+
line-height: 1;
4445
&::placeholder {
4546
color: #aaa;
4647
}

0 commit comments

Comments
 (0)