Better UX for Who's Nearby feature

This commit is contained in:
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, AgeMax: ageMax,
}, pager) }, pager)
if err != nil { 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. // Who's Nearby feature, get some data.

View File

@ -60,7 +60,6 @@ func Signup() http.HandlerFunc {
} }
var token SignupToken var token SignupToken
log.Info("SignupToken: %s", tokenStr)
if tokenStr != "" { if tokenStr != "" {
// Validate it. // Validate it.
if err := redis.Get(fmt.Sprintf(config.SignupTokenRedisKey, tokenStr), &token); err != nil || token.Token != tokenStr { 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 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) { 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. // Only query for users who have locations.

View File

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

View File

@ -95,6 +95,11 @@
</a> </a>
<div class="navbar-dropdown is-active"> <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"> <a class="navbar-item" href="/about">
<span class="icon"><i class="fa fa-circle-info"></i></span> <span class="icon"><i class="fa fa-circle-info"></i></span>
<span>About {{PrettyTitle}}</span> <span>About {{PrettyTitle}}</span>