Better UX for Who's Nearby feature

main
Noah Petherbridge 2024-03-29 20:35:41 -07:00
parent d4e3aa755b
commit 2ab34a39a3
5 changed files with 25 additions and 15 deletions

View File

@ -101,7 +101,7 @@ func Search() http.HandlerFunc {
AgeMax: ageMax,
}, pager)
if err != nil {
session.FlashError(w, r, "Couldn't search users: %s", err)
session.FlashError(w, r, "An error has occurred: %s.", err)
}
// Who's Nearby feature, get some data.

View File

@ -60,7 +60,6 @@ func Signup() http.HandlerFunc {
}
var token SignupToken
log.Info("SignupToken: %s", tokenStr)
if tokenStr != "" {
// Validate it.
if err := redis.Get(fmt.Sprintf(config.SignupTokenRedisKey, tokenStr), &token); err != nil || token.Token != tokenStr {

View File

@ -267,7 +267,7 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
// If the current user doesn't have their location on file, they can't do this.
if myLocation.Source == LocationSourceNone || (myLocation.Latitude == 0 && myLocation.Longitude == 0) {
return users, errors.New("can not order by distance because your location is not known")
return users, errors.New("can not sort members by distance because your location is not known")
}
// Only query for users who have locations.

View File

@ -43,20 +43,26 @@
{{end}}
</div>
{{else}}
<div class="notification is-success is-light">
Showing you <strong>Who's Nearby.</strong>
<div class="notification is-success is-light content">
<p>
Showing you <i class="fa fa-location-dot mr-1"></i> <strong>Who's Nearby.</strong>
</p>
<!-- Show options to refresh their location -->
{{if eq .MyLocation.Source "geoip"}}
You set your location automatically by your IP address <small>(currently {{.GeoIPInsights.Short}}).</small>
<a href="/settings#location">Update settings?</a>
{{else if eq .MyLocation.Source "gps"}}
Your location was set by your GPS location.
<a href="/settings#location" id="gpsRefresh">Refresh your location now?</a>
{{else if eq .MyLocation.Source "pin"}}
You set your location by pin on a map.
<a href="/settings#location">Update your location?</a>
{{end}}
<p>
{{if eq .MyLocation.Source "geoip"}}
You had set your location to update automatically by your IP address <small>(currently {{.GeoIPInsights.Short}}).</small>
<a href="/settings#location">Change your location settings?</a>
{{else if eq .MyLocation.Source "gps"}}
You once set your location via your device's GPS coordinates.
<a href="/settings#location" id="gpsRefresh">Refresh to your current location now?</a>
{{else if eq .MyLocation.Source "pin"}}
You had set your location by dropping a pin on a map.
<a href="/settings#location">Update your location?</a>
{{else if eq .MyLocation.Source ""}}
You will need to <a href="/settings#location">set your location</a> first before we can sort people by distance from you.
{{end}}
</p>
</div>
{{end}}

View File

@ -95,6 +95,11 @@
</a>
<div class="navbar-dropdown is-active">
<a class="navbar-item" href="/members?sort=distance">
<span class="icon"><i class="fa fa-location-dot"></i></span>
<span>Who's Nearby</span>
</a>
<hr class="navbar-divider">
<a class="navbar-item" href="/about">
<span class="icon"><i class="fa fa-circle-info"></i></span>
<span>About {{PrettyTitle}}</span>