better geocalize btn + geolocation state

This commit is contained in:
Swrup 2025-05-30 05:15:53 +02:00
parent f566952613
commit bebc23bd96
4 changed files with 81 additions and 43 deletions

View file

@ -11,6 +11,7 @@ type t =
; page : Page.t
; post_form : Post_form_data.t
; map_view : float * float * int
; geolocation : geolocation_state
; (* todo: just remove rect from here *)
quickview : (rect * (post_id, post) wrap) option
; opened_image : Img_info.t option
@ -32,6 +33,7 @@ let init () =
; page = Home
; post_form = Post_form_data.empty
; map_view = Storage.init_map_view ()
; geolocation = Geo_off
; quickview = None
; opened_image = None
; error = None
@ -196,12 +198,10 @@ let do_map_action a t =
| Move_end map_view | Zoom_end map_view ->
Storage.set_map_view map_view;
{ t with map_view }
| Geoloc_start -> t
| Geoloc_pos (_pos : Brr_io.Geolocation.Pos.t) -> t
| Geoloc_err (_err : Brr_io.Geolocation.Error.t) -> t
| Click_latlng latlng -> (
match t.page with New_thread -> set_latlng t (Some latlng) | _ -> t )
| Click_marker _thread_id -> set_latlng t None
| Geolocation geolocation -> { t with geolocation }
let do_action : Client_types.action -> t -> t =
fun action t ->