Pārlūkot izejas kodu

Add a type alias to record types used in data definition

jherve 1 gadu atpakaļ
vecāks
revīzija
fc12a0f78d

+ 2 - 1
src/LinkedIn/Jobs/JobOffer.purs

@@ -17,7 +17,7 @@ import LinkedIn.UI.Components.JobsUnifiedTopCard (JobsUnifiedTopCardElement, Top
 import LinkedIn.UI.Elements.Types (UIElement(..))
 import LinkedIn.UI.Strings.Types (UIString(..))
 
-data JobOffer = JobOffer {
+type JobOfferObject = {
   title :: String,
   companyName :: String,
   companyLink :: String,
@@ -27,6 +27,7 @@ data JobOffer = JobOffer {
   companySize :: Maybe String,
   hasSimplifiedApplicationProcess :: Boolean
 }
+data JobOffer = JobOffer JobOfferObject
 
 derive instance Eq JobOffer
 derive instance Generic JobOffer _

+ 2 - 1
src/LinkedIn/Profile/Project.purs

@@ -16,11 +16,12 @@ import LinkedIn.UI.Components.ArtDecoCard (ArtDecoCardElement, toCenterContent,
 import LinkedIn.UI.Elements.Types (UIElement(..))
 import LinkedIn.UI.Strings.Types (UIString(..))
 
-data Project = Project {
+type ProjectObject = {
   name :: String,
   timeSpan :: Maybe TimeSpan,
   description :: Maybe String
 }
+data Project = Project ProjectObject
 
 derive instance Generic Project _
 derive instance Eq Project

+ 2 - 3
src/LinkedIn/Profile/Skill.purs

@@ -12,9 +12,8 @@ import LinkedIn.UI.Components.ArtDecoTab (ArtDecoTabElement, toHeaderBold)
 import LinkedIn.UI.Elements.Types (UIElement(..))
 import LinkedIn.UI.Strings.Types (UIString(..))
 
-data Skill = Skill {
-  name :: String
-}
+type SkillObject = { name :: String }
+data Skill = Skill SkillObject
 
 derive instance Generic Skill _
 derive instance Eq Skill

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

@@ -18,7 +18,7 @@ import LinkedIn.UI.Components.ArtDecoCard (ArtDecoCardElement, toCenterContent,
 import LinkedIn.UI.Elements.Types (UIElement(..))
 import LinkedIn.UI.Strings.Types (UIString(..))
 
-data WorkExperience = WorkExperience {
+type WorkExperienceObject = {
   position :: String,
   company :: Maybe String,
   contractType :: Maybe String,
@@ -26,6 +26,7 @@ data WorkExperience = WorkExperience {
   duration :: Maybe Duration,
   description :: Maybe String
 }
+data WorkExperience = WorkExperience WorkExperienceObject
 
 derive instance Generic WorkExperience _
 derive instance Eq WorkExperience

+ 7 - 15
src/LinkedIn/UI/Components/ArtDeco.purs

@@ -17,22 +17,14 @@ import LinkedIn.QueryRunner (ignoreNotFound, queryList, queryOne)
 import LinkedIn.Queryable (class Queryable)
 import Type.Proxy (Proxy(..))
 
+type ArtDecoPvsEntityObject a = { side :: Unit, center :: ArtDecoCenter a }
+data ArtDecoPvsEntity a = ArtDecoPvsEntity (ArtDecoPvsEntityObject a)
 
-data ArtDecoPvsEntity a = ArtDecoPvsEntity {
-  side :: Unit,
-  center :: ArtDecoCenter a
-}
-
-data ArtDecoCenter a = ArtDecoCenter {
-  header :: ArtDecoCenterHeader a,
-  content :: ArtDecoCenterContent a
-}
-
-data ArtDecoCenterHeader a = ArtDecoCenterHeader {
-  bold :: a,
-  normal :: Maybe a,
-  light :: List a
-}
+type ArtDecoCenterObject a = { header :: ArtDecoCenterHeader a, content :: ArtDecoCenterContent a}
+data ArtDecoCenter a = ArtDecoCenter (ArtDecoCenterObject a)
+
+type ArtDecoCenterHeaderObject a = { bold :: a, normal :: Maybe a, light :: List a}
+data ArtDecoCenterHeader a = ArtDecoCenterHeader (ArtDecoCenterHeaderObject a)
 
 data ArtDecoCenterContent a = ArtDecoCenterContent (NonEmptyList (ArtDecoPvsEntitySubComponent a))
 

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

@@ -16,10 +16,8 @@ import LinkedIn.Queryable (class Queryable)
 import LinkedIn.UI.Components.ArtDeco (ArtDecoPvsEntity, _pvs_to_header_bold, _pvs_to_header_light, _pvs_to_header_normal, _pvs_to_subcomponents)
 import Type.Proxy (Proxy(..))
 
-
-data ArtDecoCardElement a = ArtDecoCardElement {
-  pvs_entity :: ArtDecoPvsEntity a
-}
+type ArtDecoCardElementObject a = { pvs_entity :: ArtDecoPvsEntity a }
+data ArtDecoCardElement a = ArtDecoCardElement (ArtDecoCardElementObject a)
 
 derive instance Generic (ArtDecoCardElement a) _
 derive instance Eq a => Eq (ArtDecoCardElement a)

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

@@ -17,9 +17,8 @@ import LinkedIn.UI.Components.ArtDeco (ArtDecoPvsEntity, _pvs_to_header_bold, _p
 import Type.Proxy (Proxy(..))
 
 
-data ArtDecoTabElement a = ArtDecoTabElement {
-  pvs_entity :: ArtDecoPvsEntity a
-}
+type ArtDecoTabElementObject a = { pvs_entity :: ArtDecoPvsEntity a }
+data ArtDecoTabElement a = ArtDecoTabElement (ArtDecoTabElementObject a)
 
 derive instance Generic (ArtDecoTabElement a) _
 derive instance Eq a => Eq (ArtDecoTabElement a)

+ 6 - 10
src/LinkedIn/UI/Components/JobsUnifiedTopCard.purs

@@ -19,23 +19,19 @@ import LinkedIn.Queryable (class Queryable, toNode)
 import Type.Proxy (Proxy(..))
 import Web.DOM.Node as N
 
-data JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement {
+type JobsUnifiedTopCardElementObject a = {
   header :: a,
   primaryDescription :: TopCardPrimaryDescription a,
   insights :: List (TopCardInsight a),
   actions :: List (TopCardAction a)
 }
+data JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement (JobsUnifiedTopCardElementObject a)
 
-data TopCardPrimaryDescription a = TopCardPrimaryDescription {
-  link :: a,
-  text :: a,
-  tvmText :: List a
-}
+type TopCardPrimaryDescriptionObject a = { link :: a, text :: a, tvmText :: List a }
+data TopCardPrimaryDescription a = TopCardPrimaryDescription (TopCardPrimaryDescriptionObject a)
 
-data TopCardInsight a = TopCardInsight {
-  icon :: a,
-  content :: TopCardInsightContent a
-}
+type TopCardInsightObject a = { icon :: a, content :: TopCardInsightContent a }
+data TopCardInsight a = TopCardInsight (TopCardInsightObject a)
 
 data TopCardInsightContent a =
   TopCardInsightContentSingle a