Skip to content

Commit

Permalink
feat: add fiap contents (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
omariosouto authored Feb 25, 2024
1 parent b48cf44 commit c75ca43
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 71 deletions.
5 changes: 5 additions & 0 deletions _api/gql_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type Card = {
collaborations?: Maybe<Array<Maybe<GuideCollaboration>>>;
contents?: Maybe<Array<Maybe<CardContent>>>;
expertises?: Maybe<Array<Maybe<GuideExpertise>>>;
fiapContents?: Maybe<Array<Maybe<CardContent>>>;
id?: Maybe<Scalars['String']>;
keyObjectives?: Maybe<Array<Maybe<CardKeyObjective>>>;
logo?: Maybe<Scalars['String']>;
Expand Down Expand Up @@ -48,6 +49,7 @@ export type CardContent = {
export enum CardContentType {
Aluraplus = 'ALURAPLUS',
Article = 'ARTICLE',
Book = 'BOOK',
Challenge = 'CHALLENGE',
Course = 'COURSE',
Podcast = 'PODCAST',
Expand Down Expand Up @@ -104,6 +106,7 @@ export type Guide = {
export type GuideCard = {
__typename?: 'GuideCard';
item?: Maybe<Card>;
optional?: Maybe<Scalars['Boolean']>;
priority?: Maybe<Scalars['Int']>;
};

Expand Down Expand Up @@ -322,6 +325,7 @@ export type CardResolvers<ContextType = any, ParentType extends ResolversParentT
collaborations?: Resolver<Maybe<Array<Maybe<ResolversTypes['GuideCollaboration']>>>, ParentType, ContextType>;
contents?: Resolver<Maybe<Array<Maybe<ResolversTypes['CardContent']>>>, ParentType, ContextType>;
expertises?: Resolver<Maybe<Array<Maybe<ResolversTypes['GuideExpertise']>>>, ParentType, ContextType>;
fiapContents?: Resolver<Maybe<Array<Maybe<ResolversTypes['CardContent']>>>, ParentType, ContextType>;
id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
keyObjectives?: Resolver<Maybe<Array<Maybe<ResolversTypes['CardKeyObjective']>>>, ParentType, ContextType>;
logo?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
Expand Down Expand Up @@ -368,6 +372,7 @@ export type GuideResolvers<ContextType = any, ParentType extends ResolversParent

export type GuideCardResolvers<ContextType = any, ParentType extends ResolversParentTypes['GuideCard'] = ResolversParentTypes['GuideCard']> = {
item?: Resolver<Maybe<ResolversTypes['Card']>, ParentType, ContextType>;
optional?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
priority?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
Expand Down
1 change: 1 addition & 0 deletions _api/modules/cards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const typeDefs = gql`
aditionalObjectives: [CardAditionalObjective]
contents: [CardContent]
aluraContents: [CardContent]
fiapContents: [CardContent]
expertises: [GuideExpertise]
collaborations: [GuideCollaboration]
}
Expand Down
10 changes: 10 additions & 0 deletions _api/modules/cards/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ export function cardsRepository() {
title: content.title,
};
}),
fiapContents: fileContent["fiap-contents"]?.map((content) => {
const slug = slugify(content.title);
return {
...content,
type: content.type.toUpperCase(),
id: slug,
slug: slug,
title: content.title,
};
}),
};
});

Expand Down
2 changes: 2 additions & 0 deletions pages/pt-BR/external/[...external].ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export const getStaticProps: GetStaticProps = async (ctx) => {
...card,
aluraContents:
card?.aluraContents || card["alura-contents"] || [],
fiapContents:
card?.fiapContents || card["fiap-contents"] || [],
keyObjectives: keyObjectives.map((keyObjective) => ({
id: slugify(keyObjective),
name: keyObjective,
Expand Down
1 change: 1 addition & 0 deletions pages/pt-BR/path/[slug]/[activeCardSlug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const getStaticProps = async (ctx) => {
title,
keyObjectives: card?.item?.keyObjectives || [],
aluraContents: card?.item?.aluraContents || [],
fiapContents: card?.item?.fiapContents || [],
contents: card?.item?.contents || [],
},
},
Expand Down
10 changes: 6 additions & 4 deletions src/gql_types.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function ItemContent({
title,
keyObjectives,
aluraContents,
fiapContents,
contents,
optional,
}: any) {
Expand Down Expand Up @@ -213,9 +214,13 @@ export default function ItemContent({
lineHeight: "150%",
marginBottom: "27px",
color: "#88B8DB",
textTransform: "uppercase",
}}
>
{i18n.content("PATH.T_BLOCK_SUGGESTED_CONTENT")}
{i18n.content("PATH.T_BLOCK_SUGGESTED_CONTENT")}{" "}
<span style={{ marginLeft: "5px", display: "inline-block" }}>
✏️✏️✏️
</span>
</Text>

<Box>
Expand Down Expand Up @@ -269,77 +274,111 @@ export default function ItemContent({
</ul>
</Box>
<Box>
<ul style={{ listStyle: "none" }}>
{aluraContents?.map(({ type, title, link, id }) => (
<li
key={id}
style={{
fontSize: "14px",
lineHeight: "1.5",
marginBottom: "6px",
position: "relative",
}}
{[aluraContents, fiapContents].map((contents, index) => {
return (
<ul
style={{ listStyle: "none" }}
key={`extra-contents-list-${index}`}
>
<Link
href={link}
styleSheet={{ textDecoration: "none" }}
target="_blank"
>
<svg
width="15"
height="14"
viewBox="0 0 15 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{contents?.map(({ type, title, link, id }) => (
<li
key={id}
style={{
position: "absolute",
transform: "translateX(-100%)",
left: "-6px",
top: "5px",
fontSize: "14px",
lineHeight: "1.5",
marginBottom: "6px",
position: "relative",
}}
>
<circle cx="7.26758" cy="7" r="7" fill="#03C2E0" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8.29829 7.02539C8.28531 7.10789 8.23504 7.17996 8.16182 7.22106C8.08903 7.26771 8.02535 7.29104 7.96091 7.31437C7.82368 7.36141 7.67925 7.40844 7.52648 7.463C7.36537 7.51756 7.22094 7.57212 7.09206 7.61163C6.93133 7.66619 6.77856 7.71323 6.63337 7.76779C6.52414 7.81419 6.42154 7.87466 6.32821 7.94765C6.24142 8.02571 6.16567 8.11507 6.10304 8.2133C6.03859 8.32242 5.99803 8.46315 5.99803 8.62721C5.99803 8.9557 6.0784 9.20555 6.23951 9.36171C6.40024 9.52614 6.69819 9.60403 7.13982 9.60403C7.59017 9.60403 7.8957 9.51824 8.05719 9.34628C8.21754 9.17432 8.29791 8.93237 8.29791 8.62006V7.02539H8.29829ZM7.13797 3.56348C7.92645 3.56348 8.50531 3.71211 8.87491 4.01689C9.24489 4.31415 9.42988 4.69645 9.42988 5.14949V9.01011C9.42988 9.16627 9.39804 9.33823 9.34193 9.52562C9.28507 9.71376 9.17286 9.88534 8.99583 10.0411C8.82714 10.198 8.59401 10.3309 8.29643 10.4324C7.99886 10.534 7.61295 10.5886 7.13835 10.5886C6.6645 10.5886 6.27784 10.534 5.98064 10.4324C5.68344 10.3309 5.44993 10.198 5.28124 10.0411C5.12431 9.90075 5.00543 9.72349 4.93552 9.52562C4.87866 9.33861 4.84644 9.16665 4.84644 9.01049V8.39339C4.84644 8.0649 4.93476 7.76012 5.11179 7.49409C5.28882 7.22091 5.53788 7.03352 5.85971 6.91612C6.02044 6.86156 6.20543 6.807 6.41431 6.73664C6.62356 6.6659 6.81613 6.59553 7.00946 6.53345C7.20279 6.47061 7.37148 6.40777 7.51591 6.35283C7.60307 6.31822 7.69159 6.28709 7.78127 6.25952L7.92607 6.18915C7.98294 6.15792 8.03866 6.11088 8.09514 6.04842C8.15125 5.98634 8.19939 5.91597 8.23995 5.83771C8.28281 5.75296 8.30489 5.65935 8.30439 5.56453V5.3143C8.30499 5.22259 8.28559 5.13184 8.24753 5.04827C8.21569 4.9542 8.15125 4.86841 8.06292 4.79052C7.9746 4.71226 7.85367 4.64979 7.70924 4.60238C7.56443 4.5561 7.37186 4.53239 7.15427 4.53239C6.70392 4.53239 6.40635 4.61894 6.24562 4.79805C6.10915 4.95458 6.02878 5.14987 6.01286 5.36849C6.01286 5.41552 5.97268 5.44675 5.92416 5.44675L4.94348 5.46256C4.89499 5.46277 4.8554 5.42414 4.85478 5.37601V5.15024C4.85478 4.93087 4.89534 4.72768 4.98366 4.53239C5.07237 4.33673 5.20921 4.17305 5.39383 4.03194C5.57882 3.89159 5.82029 3.77457 6.10953 3.6963C6.39118 3.60223 6.7369 3.56348 7.13873 3.56348H7.13797Z"
fill="#161F31"
/>
</svg>
<Link
href={link}
styleSheet={{ textDecoration: "none" }}
target="_blank"
>
{index === 0 && (
<svg
width="15"
height="14"
viewBox="0 0 15 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style={{
position: "absolute",
transform: "translateX(-100%)",
left: "-6px",
top: "5px",
}}
>
<circle cx="7.26758" cy="7" r="7" fill="#03C2E0" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8.29829 7.02539C8.28531 7.10789 8.23504 7.17996 8.16182 7.22106C8.08903 7.26771 8.02535 7.29104 7.96091 7.31437C7.82368 7.36141 7.67925 7.40844 7.52648 7.463C7.36537 7.51756 7.22094 7.57212 7.09206 7.61163C6.93133 7.66619 6.77856 7.71323 6.63337 7.76779C6.52414 7.81419 6.42154 7.87466 6.32821 7.94765C6.24142 8.02571 6.16567 8.11507 6.10304 8.2133C6.03859 8.32242 5.99803 8.46315 5.99803 8.62721C5.99803 8.9557 6.0784 9.20555 6.23951 9.36171C6.40024 9.52614 6.69819 9.60403 7.13982 9.60403C7.59017 9.60403 7.8957 9.51824 8.05719 9.34628C8.21754 9.17432 8.29791 8.93237 8.29791 8.62006V7.02539H8.29829ZM7.13797 3.56348C7.92645 3.56348 8.50531 3.71211 8.87491 4.01689C9.24489 4.31415 9.42988 4.69645 9.42988 5.14949V9.01011C9.42988 9.16627 9.39804 9.33823 9.34193 9.52562C9.28507 9.71376 9.17286 9.88534 8.99583 10.0411C8.82714 10.198 8.59401 10.3309 8.29643 10.4324C7.99886 10.534 7.61295 10.5886 7.13835 10.5886C6.6645 10.5886 6.27784 10.534 5.98064 10.4324C5.68344 10.3309 5.44993 10.198 5.28124 10.0411C5.12431 9.90075 5.00543 9.72349 4.93552 9.52562C4.87866 9.33861 4.84644 9.16665 4.84644 9.01049V8.39339C4.84644 8.0649 4.93476 7.76012 5.11179 7.49409C5.28882 7.22091 5.53788 7.03352 5.85971 6.91612C6.02044 6.86156 6.20543 6.807 6.41431 6.73664C6.62356 6.6659 6.81613 6.59553 7.00946 6.53345C7.20279 6.47061 7.37148 6.40777 7.51591 6.35283C7.60307 6.31822 7.69159 6.28709 7.78127 6.25952L7.92607 6.18915C7.98294 6.15792 8.03866 6.11088 8.09514 6.04842C8.15125 5.98634 8.19939 5.91597 8.23995 5.83771C8.28281 5.75296 8.30489 5.65935 8.30439 5.56453V5.3143C8.30499 5.22259 8.28559 5.13184 8.24753 5.04827C8.21569 4.9542 8.15125 4.86841 8.06292 4.79052C7.9746 4.71226 7.85367 4.64979 7.70924 4.60238C7.56443 4.5561 7.37186 4.53239 7.15427 4.53239C6.70392 4.53239 6.40635 4.61894 6.24562 4.79805C6.10915 4.95458 6.02878 5.14987 6.01286 5.36849C6.01286 5.41552 5.97268 5.44675 5.92416 5.44675L4.94348 5.46256C4.89499 5.46277 4.8554 5.42414 4.85478 5.37601V5.15024C4.85478 4.93087 4.89534 4.72768 4.98366 4.53239C5.07237 4.33673 5.20921 4.17305 5.39383 4.03194C5.57882 3.89159 5.82029 3.77457 6.10953 3.6963C6.39118 3.60223 6.7369 3.56348 7.13873 3.56348H7.13797Z"
fill="#161F31"
/>
</svg>
)}
{index === 1 && (
<svg
width="15"
height="15"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style={{
position: "absolute",
transform: "translateX(-100%)",
left: "-6px",
top: "5px",
}}
>
<rect width="18" height="18" fill="#ED185B" />
<path
d="M11.3163 9.65698H7.45398V10.3953H11.3163V9.65698Z"
fill="white"
/>
<path
d="M4.5 4.5V15.2788H5.29294V5.23827H13.5V4.5H4.5Z"
fill="white"
/>
</svg>
)}

<span
style={{
display: "inline-block",
backgroundColor: i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.BG`
),
color: i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.COLOR`
),
fontSize: "11px",
fontWeight: "600",
paddingLeft: "6px",
paddingRight: "6px",
borderRadius: "2px",
marginRight: "8px",
textTransform: "uppercase",
}}
>
{i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.LABEL`
)}
</span>
{title}
</Link>
</li>
))}
</ul>
<span
style={{
display: "inline-block",
backgroundColor: i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.BG`
),
color: i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.COLOR`
),
fontSize: "11px",
fontWeight: "600",
paddingLeft: "6px",
paddingRight: "6px",
borderRadius: "2px",
marginRight: "8px",
textTransform: "uppercase",
}}
>
{i18n.content(
`PATH.T_BLOCK_SUGGESTED_CONTENT.${
type || "CONTENT"
}.LABEL`
)}
</span>
{title}
</Link>
</li>
))}
</ul>
);
})}
</Box>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function Item({ onClick, categoryName, index, main, card, extra }: any) {
title: card?.item?.name || "Error",
keyObjectives: card?.item?.keyObjectives,
aluraContents: card?.item?.aluraContents,
fiapContents: card?.item?.fiapContents,
contents: card?.item?.contents,
optional: card?.optional,
};
Expand All @@ -147,6 +148,7 @@ function Item({ onClick, categoryName, index, main, card, extra }: any) {
title={content.title}
keyObjectives={content.keyObjectives}
aluraContents={content.aluraContents}
fiapContents={content.fiapContents}
contents={content.contents}
optional={content.optional}
/>
Expand Down
6 changes: 6 additions & 0 deletions src/screens/PathScreen/queries/GetAllCards.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ query GetAllCards($locale: SiteLocale, $input: CardsInput) {
link
type
}
fiapContents {
id
title
link
type
}
contents {
id
title
Expand Down
12 changes: 12 additions & 0 deletions src/screens/PathScreen/queries/PathScreenGetGuideBySlug.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ query PathScreenGetGuideBySlug($input: GuideInput, $locale: SiteLocale) {
link
type
}
fiapContents {
id
title
link
type
}
contents {
id
title
Expand Down Expand Up @@ -52,6 +58,12 @@ query PathScreenGetGuideBySlug($input: GuideInput, $locale: SiteLocale) {
link
type
}
fiapContents {
id
title
link
type
}
contents {
id
title
Expand Down

0 comments on commit c75ca43

Please sign in to comment.