Sfoglia il codice sorgente

ArtdecoHeader "light" is now a list

jherve 1 anno fa
parent
commit
bd3e49b071

+ 2 - 2
src/LinkedIn/Profile/WorkExperience.purs

@@ -39,8 +39,8 @@ fromUI card = ado
     position,
     position,
     company: extractCompany =<< normal,
     company: extractCompany =<< normal,
     contractType: extractContractType =<< normal,
     contractType: extractContractType =<< normal,
-    timeSpan: findMap extractTimeSpan =<< light,
-    duration: findMap extractDuration =<< light,
+    timeSpan: findMap extractTimeSpan light,
+    duration: findMap extractDuration light,
     description: extractDescription =<< L.index content 0
     description: extractDescription =<< L.index content 0
   }
   }
   where
   where

+ 9 - 9
src/LinkedIn/UI/Components/ArtDeco.purs

@@ -6,13 +6,14 @@ import Data.Foldable (class Foldable, foldMap, foldlDefault, foldrDefault)
 import Data.Generic.Rep (class Generic)
 import Data.Generic.Rep (class Generic)
 import Data.Lens (Lens', Traversal', lens', traversed)
 import Data.Lens (Lens', Traversal', lens', traversed)
 import Data.Lens.Record (prop)
 import Data.Lens.Record (prop)
+import Data.List (List)
 import Data.List.NonEmpty (NonEmptyList)
 import Data.List.NonEmpty (NonEmptyList)
 import Data.Maybe (Maybe)
 import Data.Maybe (Maybe)
 import Data.Show.Generic (genericShow)
 import Data.Show.Generic (genericShow)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
 import Data.Tuple (Tuple(..))
 import Data.Tuple (Tuple(..))
 import LinkedIn.CanBeQueried (class CanBeQueried, subQueryMany, subQueryOne)
 import LinkedIn.CanBeQueried (class CanBeQueried, subQueryMany, subQueryOne)
-import LinkedIn.QueryRunner (ignoreNotFound, queryAll, queryOne)
+import LinkedIn.QueryRunner (ignoreNotFound, queryAll', queryOne)
 import LinkedIn.Queryable (class Queryable)
 import LinkedIn.Queryable (class Queryable)
 import Type.Proxy (Proxy(..))
 import Type.Proxy (Proxy(..))
 
 
@@ -30,7 +31,7 @@ data ArtDecoCenter a = ArtDecoCenter {
 data ArtDecoCenterHeader a = ArtDecoCenterHeader {
 data ArtDecoCenterHeader a = ArtDecoCenterHeader {
   bold :: a,
   bold :: a,
   normal :: Maybe a,
   normal :: Maybe a,
-  light :: Maybe (NonEmptyList a)
+  light :: List a
 }
 }
 
 
 data ArtDecoCenterContent a = ArtDecoCenterContent (NonEmptyList (ArtDecoPvsEntitySubComponent a))
 data ArtDecoCenterContent a = ArtDecoCenterContent (NonEmptyList (ArtDecoPvsEntitySubComponent a))
@@ -93,7 +94,7 @@ instance Show a => Show(ArtDecoCenterHeader a) where
 derive instance Functor ArtDecoCenterHeader
 derive instance Functor ArtDecoCenterHeader
 
 
 instance Foldable ArtDecoCenterHeader where
 instance Foldable ArtDecoCenterHeader where
-  foldMap f (ArtDecoCenterHeader {bold, normal, light}) = f bold <> foldMap f normal <> foldMap (foldMap f) light
+  foldMap f (ArtDecoCenterHeader {bold, normal, light}) = f bold <> foldMap f normal <> foldMap f light
 
 
   foldl = \x -> foldlDefault x
   foldl = \x -> foldlDefault x
   foldr = \x -> foldrDefault x
   foldr = \x -> foldrDefault x
@@ -102,7 +103,7 @@ instance Traversable ArtDecoCenterHeader where
   sequence (ArtDecoCenterHeader {bold, normal, light}) = ado
   sequence (ArtDecoCenterHeader {bold, normal, light}) = ado
     b <- bold
     b <- bold
     n <- sequence normal
     n <- sequence normal
-    l <- sequence (map sequence light)
+    l <- sequence light
   in ArtDecoCenterHeader {bold: b, normal: n, light: l}
   in ArtDecoCenterHeader {bold: b, normal: n, light: l}
 
 
   traverse = \x -> traverseDefault x
   traverse = \x -> traverseDefault x
@@ -114,8 +115,7 @@ instance Queryable q => CanBeQueried q ArtDecoCenterHeader where
       ignoreNotFound $
       ignoreNotFound $
       queryOne ":scope span.t-normal:not(t-black--light) > span[aria-hidden=true]" n
       queryOne ":scope span.t-normal:not(t-black--light) > span[aria-hidden=true]" n
     light <-
     light <-
-      ignoreNotFound $
-      queryAll ":scope span.t-black--light > span[aria-hidden=true]" n
+      queryAll' ":scope span.t-black--light > span[aria-hidden=true]" n
 
 
     pure $ ArtDecoCenterHeader {bold, normal, light}
     pure $ ArtDecoCenterHeader {bold, normal, light}
 
 
@@ -179,7 +179,7 @@ _center :: forall a. Lens' (ArtDecoCenter a) { content ∷ ArtDecoCenterContent
 _center = lens'
 _center = lens'
   \(ArtDecoCenter center) -> Tuple center \center' -> ArtDecoCenter center'
   \(ArtDecoCenter center) -> Tuple center \center' -> ArtDecoCenter center'
 
 
-_header :: forall a. Lens' (ArtDecoCenterHeader a) { bold ∷ a , light ∷ Maybe (NonEmptyList a) , normal ∷ Maybe a }
+_header :: forall a. Lens' (ArtDecoCenterHeader a) { bold ∷ a , light ∷ List a , normal ∷ Maybe a }
 _header = lens' \(ArtDecoCenterHeader h) -> Tuple h \h' -> ArtDecoCenterHeader h'
 _header = lens' \(ArtDecoCenterHeader h) -> Tuple h \h' -> ArtDecoCenterHeader h'
 
 
 _content :: forall a. Lens' (ArtDecoCenterContent a) (NonEmptyList (ArtDecoPvsEntitySubComponent a))
 _content :: forall a. Lens' (ArtDecoCenterContent a) (NonEmptyList (ArtDecoPvsEntitySubComponent a))
@@ -188,7 +188,7 @@ _content = lens' \(ArtDecoCenterContent cs) -> Tuple cs \cs' -> ArtDecoCenterCon
 _sub_component :: forall a. Lens' (ArtDecoPvsEntitySubComponent a) a
 _sub_component :: forall a. Lens' (ArtDecoPvsEntitySubComponent a) a
 _sub_component = lens' \(ArtDecoPvsEntitySubComponent s) -> Tuple s \s' -> ArtDecoPvsEntitySubComponent s'
 _sub_component = lens' \(ArtDecoPvsEntitySubComponent s) -> Tuple s \s' -> ArtDecoPvsEntitySubComponent s'
 
 
-_pvs_to_header :: forall a. Lens' (ArtDecoPvsEntity a) { bold ∷ a , light ∷ Maybe (NonEmptyList a) , normal ∷ Maybe a }
+_pvs_to_header :: forall a. Lens' (ArtDecoPvsEntity a) { bold ∷ a , light ∷ List a , normal ∷ Maybe a }
 _pvs_to_header = _pvs_entity
 _pvs_to_header = _pvs_entity
   <<< prop (Proxy :: Proxy "center")
   <<< prop (Proxy :: Proxy "center")
   <<< _center
   <<< _center
@@ -210,5 +210,5 @@ _pvs_to_header_bold = _pvs_to_header <<< prop (Proxy :: Proxy "bold")
 _pvs_to_header_normal :: forall a. Lens' (ArtDecoPvsEntity a) (Maybe a)
 _pvs_to_header_normal :: forall a. Lens' (ArtDecoPvsEntity a) (Maybe a)
 _pvs_to_header_normal = _pvs_to_header <<< prop (Proxy :: Proxy "normal")
 _pvs_to_header_normal = _pvs_to_header <<< prop (Proxy :: Proxy "normal")
 
 
-_pvs_to_header_light :: forall a. Lens' (ArtDecoPvsEntity a) (Maybe (NonEmptyList a))
+_pvs_to_header_light :: forall a. Lens' (ArtDecoPvsEntity a) (List a)
 _pvs_to_header_light = _pvs_to_header <<< prop (Proxy :: Proxy "light")
 _pvs_to_header_light = _pvs_to_header <<< prop (Proxy :: Proxy "light")

+ 1 - 2
src/LinkedIn/UI/Components/ArtDecoCard.purs

@@ -7,7 +7,6 @@ import Data.Generic.Rep (class Generic)
 import Data.Lens (Lens', lens', toListOf, view)
 import Data.Lens (Lens', lens', toListOf, view)
 import Data.Lens.Record (prop)
 import Data.Lens.Record (prop)
 import Data.List (List)
 import Data.List (List)
-import Data.List.Types (NonEmptyList)
 import Data.Maybe (Maybe)
 import Data.Maybe (Maybe)
 import Data.Show.Generic (genericShow)
 import Data.Show.Generic (genericShow)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
@@ -52,7 +51,7 @@ toHeaderBold = view $ _card_to_pvs_entity <<< _pvs_to_header_bold
 toHeaderNormal ∷ ∀ a. ArtDecoCardElement a → Maybe a
 toHeaderNormal ∷ ∀ a. ArtDecoCardElement a → Maybe a
 toHeaderNormal = view $ _card_to_pvs_entity <<< _pvs_to_header_normal
 toHeaderNormal = view $ _card_to_pvs_entity <<< _pvs_to_header_normal
 
 
-toHeaderLight ∷ ∀ a. ArtDecoCardElement a → Maybe (NonEmptyList a)
+toHeaderLight ∷ ∀ a. ArtDecoCardElement a → List a
 toHeaderLight = view $ _card_to_pvs_entity <<< _pvs_to_header_light
 toHeaderLight = view $ _card_to_pvs_entity <<< _pvs_to_header_light
 
 
 toCenterContent ∷ ∀ a. ArtDecoCardElement a → List a
 toCenterContent ∷ ∀ a. ArtDecoCardElement a → List a

+ 1 - 2
src/LinkedIn/UI/Components/ArtDecoTab.purs

@@ -7,7 +7,6 @@ import Data.Generic.Rep (class Generic)
 import Data.Lens (Lens', lens', toListOf, view)
 import Data.Lens (Lens', lens', toListOf, view)
 import Data.Lens.Record (prop)
 import Data.Lens.Record (prop)
 import Data.List (List)
 import Data.List (List)
-import Data.List.Types (NonEmptyList)
 import Data.Maybe (Maybe)
 import Data.Maybe (Maybe)
 import Data.Show.Generic (genericShow)
 import Data.Show.Generic (genericShow)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
 import Data.Traversable (class Traversable, sequence, traverseDefault)
@@ -52,7 +51,7 @@ toHeaderBold = view $ _tab_to_pvs_entity <<< _pvs_to_header_bold
 toHeaderNormal ∷ ∀ a. ArtDecoTabElement a → Maybe a
 toHeaderNormal ∷ ∀ a. ArtDecoTabElement a → Maybe a
 toHeaderNormal = view $ _tab_to_pvs_entity <<< _pvs_to_header_normal
 toHeaderNormal = view $ _tab_to_pvs_entity <<< _pvs_to_header_normal
 
 
-toHeaderLight ∷ ∀ a. ArtDecoTabElement a → Maybe (NonEmptyList a)
+toHeaderLight ∷ ∀ a. ArtDecoTabElement a → List a
 toHeaderLight = view $ _tab_to_pvs_entity <<< _pvs_to_header_light
 toHeaderLight = view $ _tab_to_pvs_entity <<< _pvs_to_header_light
 
 
 toCenterContent ∷ ∀ a. ArtDecoTabElement a → List a
 toCenterContent ∷ ∀ a. ArtDecoTabElement a → List a

+ 4 - 4
test/ArtDecoCard.purs

@@ -36,10 +36,10 @@ andrewNgWorkExperience = {
         ))),
         ))),
         header: (ArtDecoCenterHeader {
         header: (ArtDecoCenterHeader {
           bold: (DetachedElement {classes: Nil, content: "Founder", id: Nothing, tag: "SPAN" }),
           bold: (DetachedElement {classes: Nil, content: "Founder", id: Nothing, tag: "SPAN" }),
-          light: (Just (NonEmptyList (NonEmpty (
-            DetachedElement {classes: ("pvs-entity__caption-wrapper" : Nil), content: "juin 2017 - aujourd’hui · 6 ans 9 mois", id: Nothing,tag: "SPAN"})
-            ((DetachedElement {classes: Nil, content: "Palo Alto, California, United States", id: Nothing,tag: "SPAN"}) : Nil)
-          ))),
+          light:
+            DetachedElement {classes: ("pvs-entity__caption-wrapper" : Nil), content: "juin 2017 - aujourd’hui · 6 ans 9 mois", id: Nothing,tag: "SPAN"}
+            : DetachedElement {classes: Nil, content: "Palo Alto, California, United States", id: Nothing,tag: "SPAN"}
+            : Nil,
           normal: (Just (DetachedElement {classes: Nil, content: "DeepLearning.AI", id: Nothing, tag: "SPAN" }))
           normal: (Just (DetachedElement {classes: Nil, content: "DeepLearning.AI", id: Nothing, tag: "SPAN" }))
         })
         })
       }),
       }),