Skip to content

Commit

Permalink
Merge pull request #477 from geeksforsocialchange/add-instagram-url
Browse files Browse the repository at this point in the history
fix: Show Instagram URL under Partner contact details
  • Loading branch information
james-collapse authored Dec 16, 2024
2 parents 2d82f3c + 464a096 commit 64fcdcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Data/PlaceCal/Partners.elm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type alias Partner =
, summary : String
, description : String
, maybeUrl : Maybe String
, maybeInstagramUrl : Maybe String
, maybeContactDetails : Maybe Contact
, maybeAddress : Maybe Address
, areasServed : List ServiceArea
Expand Down Expand Up @@ -61,6 +62,7 @@ emptyPartner =
, summary = ""
, description = ""
, maybeUrl = Nothing
, maybeInstagramUrl = Nothing
, maybeContactDetails = Nothing
, maybeAddress = Nothing
, areasServed = []
Expand Down Expand Up @@ -168,6 +170,7 @@ allPartnersQuery partnershipTag =
summary
contact { email, telephone }
url
instagramUrl
address { streetAddress, postalCode, addressRegion, geo { latitude, longitude } }
areasServed { name abbreviatedName }
logo
Expand All @@ -193,6 +196,7 @@ decodePartner partnershipTagInt =
|> Json.Decode.Pipeline.optional "summary" Json.Decode.string ""
|> Json.Decode.Pipeline.optional "description" Json.Decode.string ""
|> Json.Decode.Pipeline.optional "url" (Json.Decode.map Just Json.Decode.string) Nothing
|> Json.Decode.Pipeline.optional "instagramUrl" (Json.Decode.map Just Json.Decode.string) Nothing
|> Json.Decode.Pipeline.optional "contact" (Json.Decode.map Just contactDecoder) Nothing
|> Json.Decode.Pipeline.optional "address" (Json.Decode.map Just addressDecoder) Nothing
|> Json.Decode.Pipeline.required "areasServed" (Json.Decode.list serviceAreaDecoder)
Expand Down
14 changes: 10 additions & 4 deletions src/Theme/Page/Partner.elm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ viewInfo localModel { partner, events } =
, section [ css [ contactWrapperStyle ] ]
[ div [ css [ contactSectionStyle ] ]
[ h3 [ css [ contactHeadingStyle, Theme.Global.smallInlineTitleStyle ] ] [ text (t PartnerContactsHeading) ]
, viewContactDetails partner.maybeUrl partner.maybeContactDetails
, viewContactDetails partner.maybeUrl partner.maybeContactDetails partner.maybeInstagramUrl
]
, div [ css [ contactSectionStyle ] ]
[ h3 [ css [ contactHeadingStyle, Theme.Global.smallInlineTitleStyle ] ] [ text (t PartnerAddressHeading) ]
Expand Down Expand Up @@ -110,9 +110,9 @@ viewPartnerEvents events localModel partner =
)


viewContactDetails : Maybe String -> Maybe Data.PlaceCal.Partners.Contact -> Html msg
viewContactDetails maybeUrl maybeContactDetails =
if maybeUrl == Nothing && maybeContactDetails == Nothing then
viewContactDetails : Maybe String -> Maybe Data.PlaceCal.Partners.Contact -> Maybe String -> Html msg
viewContactDetails maybeUrl maybeContactDetails maybeInstagramUrl =
if maybeUrl == Nothing && maybeContactDetails == Nothing && maybeInstagramUrl == Nothing then
p [ css [ contactItemStyle ] ] [ text (t PartnerContactsEmptyText) ]

else
Expand Down Expand Up @@ -146,6 +146,12 @@ viewContactDetails maybeUrl maybeContactDetails =
Just url ->
p [ css [ contactItemStyle ] ] [ a [ href url, target "_blank", css [ linkStyle ] ] [ text (Copy.Text.urlToDisplay url) ] ]

Nothing ->
text ""
, case maybeInstagramUrl of
Just url ->
p [ css [ contactItemStyle ] ] [ a [ href url, target "_blank", css [ linkStyle ] ] [ text (Copy.Text.urlToDisplay url) ] ]

Nothing ->
text ""
]
Expand Down

0 comments on commit 64fcdcf

Please sign in to comment.