github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/src/SideBar/Team.elm (about)

     1  module SideBar.Team exposing (team)
     2  
     3  import Assets
     4  import Concourse
     5  import HoverState
     6  import Message.Message exposing (DomID(..), Message(..), PipelinesSection(..))
     7  import Set exposing (Set)
     8  import SideBar.Pipeline as Pipeline
     9  import SideBar.Styles as Styles
    10  import SideBar.Views as Views
    11  
    12  
    13  type alias PipelineScoped a =
    14      { a
    15          | teamName : String
    16          , pipelineName : String
    17      }
    18  
    19  
    20  team :
    21      { a
    22          | hovered : HoverState.HoverState
    23          , pipelines : List Concourse.Pipeline
    24          , currentPipeline : Maybe (PipelineScoped b)
    25          , favoritedPipelines : Set Int
    26          , isFavoritesSection : Bool
    27      }
    28      -> { name : String, isExpanded : Bool }
    29      -> Views.Team
    30  team session t =
    31      let
    32          domID =
    33              SideBarTeam
    34                  (if session.isFavoritesSection then
    35                      FavoritesSection
    36  
    37                   else
    38                      AllPipelinesSection
    39                  )
    40                  t.name
    41  
    42          isHovered =
    43              HoverState.isHovered domID session.hovered
    44      in
    45      { icon =
    46          if isHovered then
    47              Styles.Bright
    48  
    49          else
    50              Styles.GreyedOut
    51      , collapseIcon =
    52          { opacity =
    53              Styles.Bright
    54          , asset =
    55              if t.isExpanded then
    56                  Assets.MinusIcon
    57  
    58              else
    59                  Assets.PlusIcon
    60          }
    61      , name =
    62          { text = t.name
    63          , teamColor =
    64              if isHovered then
    65                  Styles.White
    66  
    67              else
    68                  Styles.LightGrey
    69          , domID = domID
    70          }
    71      , isExpanded = t.isExpanded
    72      , pipelines = List.map (Pipeline.pipeline session) session.pipelines
    73      , background =
    74          if isHovered then
    75              Styles.Light
    76  
    77          else
    78              Styles.Invisible
    79      }