(* This file was generated by Ocsigen Start.
   Feel free to use it, modify it, and redistribute it as you wish. *)

[%%shared open Eliom_content.Html.F]

(** This module defines the drawer menu *)

let%shared item text service =
  li [a ~a:[a_class ["os-drawer-item"]] ~service [txt text] ()]

let%shared user_menu () =
  [ item
      [%i18n S.settings ~capitalize:true]
      %%%MODULE_NAME%%%_services.settings_service
  ; Eliom_content.Html.F.li
      [ Os_user_view.disconnect_link
          ~text_logout:[%i18n S.logout ~capitalize:true]
          ~a:[a_class ["os-drawer-item"]]
          () ] ]

let%shared make ?user () =
  let items = if user = None then [] else user_menu () in
  let items =
    item [%i18n S.home ~capitalize:true] Os_services.main_service
    :: item [%i18n S.about ~capitalize:true]
         %%%MODULE_NAME%%%_services.about_service
    :: Demo_tools.drawer_contents ()
    :: items
  in
  let menu = ul ~a:[a_class ["os-drawer-menu"]] items in
  let contents =
    match user with
    | None -> [menu]
    | Some user ->
        let user_box = Os_user_view.connected_user_box ~user in
        [user_box; menu]
  in
  let drawer, _, _ = Ot_drawer.drawer contents in
  drawer
