Skip to content

Commit

Permalink
Add (always checked so unuseable) button for display of different seq…
Browse files Browse the repository at this point in the history
…uences
  • Loading branch information
LunaPrau committed May 28, 2024
1 parent 8541eac commit 26a680b
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions frontend/src/Pages/Designs/DesignId_.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import Components.Title
import Date
import Effect exposing (Effect)
import Element exposing (..)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
import Element.Input as Input
import Element.Keyed as Keyed
import FeatherIcons
import Html
Expand Down Expand Up @@ -40,6 +42,7 @@ type alias Model =
{ designId : String
, design : RemoteData Http.Error ProteinDesign
, errors : List AppError
, displayUnnat : Bool
}


Expand All @@ -48,6 +51,7 @@ init designId =
( { designId = designId
, design = Loading
, errors = []
, displayUnnat = True
}
, Effect.sendCmd (getData <| Urls.designDetailsFromId designId)
)
Expand All @@ -69,6 +73,7 @@ getData url =
type Msg
= SendDesignsHttpRequest
| DesignsDataReceived (Result Http.Error ProteinDesign)
| ToggleSequence Bool


update : Msg -> Model -> ( Model, Effect Msg )
Expand Down Expand Up @@ -102,6 +107,9 @@ update msg model =
, Effect.none
)

ToggleSequence checkboxStatus ->
( { model | displayUnnat = checkboxStatus }, Effect.none )

RemoteData.Failure e ->
case msg of
_ ->
Expand All @@ -114,6 +122,9 @@ update msg model =

RemoteData.Success _ ->
case msg of
ToggleSequence checkboxStatus ->
( { model | displayUnnat = checkboxStatus }, Effect.none )

_ ->
( model, Effect.none )

Expand All @@ -139,7 +150,7 @@ view model =
}


details : Model -> Element msg
details : Model -> Element Msg
details model =
let
mDesign =
Expand Down Expand Up @@ -193,7 +204,7 @@ details model =
]


designDetailsView : ProteinDesign -> Element msg
designDetailsView : ProteinDesign -> Element Msg
designDetailsView proteinDesign =
column
([ centerX
Expand Down Expand Up @@ -315,6 +326,7 @@ designDetailsView proteinDesign =
Style.h2Font
[ text "Sequence"
]
, toggleButton
, table
[ padding 2 ]
{ data = proteinDesign.chains
Expand Down Expand Up @@ -403,7 +415,7 @@ designDetailsHeader { pdb, previousDesign, nextDesign } =
(Style.h2Font ++ [ Font.center ])
[ text "Design Details" ]
, link
[]
[ mouseOver [] ]
{ url = "/designs/" ++ nextDesign
, label =
el [ centerX ]
Expand All @@ -414,3 +426,13 @@ designDetailsHeader { pdb, previousDesign, nextDesign } =
)
}
]


toggleButton : Element Msg
toggleButton =
Input.checkbox [ paddingXY 3 10, alignTop ]
{ onChange = \checkboxStatus -> ToggleSequence checkboxStatus
, icon = Input.defaultCheckbox
, checked = True
, label = Input.labelLeft [] (paragraph Style.bodyFont <| [ text <| "Display unnatural residues." ])
}

0 comments on commit 26a680b

Please sign in to comment.