Skip to content

Commit

Permalink
feat: last batch of pages
Browse files Browse the repository at this point in the history
pages
  • Loading branch information
Marcin Baraniecki committed Jun 7, 2022
1 parent 69bb7bf commit 44e5cf9
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 26 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
✅ check & verify linking & nav between main asset page & news articles
✅ possibly DA pages with JSON over GraphQL
- verify segment is working
- configs & amplify files
- verify build process
- remove commitizen & commitlint?
- write readme
- mobile developers: ask to remove lang param from pages: chsb-yield-terms, privacy, terms, yield-terms
4 changes: 2 additions & 2 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const config: GatsbyConfig = {
terms_and_conditions: require(`./prismic-types/terms_and_conditions.json`),
privacy_policy: require(`./prismic-types/privacy_policy.json`),
asset_analysis: {},
yield_terms_and_conditions: {},
yield_terms_and_conditions: require(`./prismic-types/yield_terms_and_conditions.json`),
chsb_yield_terms_and_conditions: require(`./prismic-types/chsb_yield_terms_and_conditions.json`),
app_tour: {},
premium_tour: {},
Expand All @@ -65,7 +65,7 @@ const config: GatsbyConfig = {
app_tour_stage: {},
premium_tour_stage: {},
daa_video: require(`./prismic-types/daa_video.json`),
yield_terms_and_conditions_1_5: {},
yield_terms_and_conditions_1_5: require(`./prismic-types/yield_terms_and_conditions_1_5.json`),
fees: require(`./prismic-types/fees.json`),
test_blog_post: require(`./prismic-types/test_blog_post.json`),
},
Expand Down
18 changes: 18 additions & 0 deletions prismic-types/yield_terms_and_conditions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Main": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading1,heading2,heading3,heading4,heading5,heading6",
"label": "title"
}
},
"body": {
"type": "StructuredText",
"config": {
"multi": "paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl",
"label": "body"
}
}
}
}
18 changes: 18 additions & 0 deletions prismic-types/yield_terms_and_conditions_1_5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Main": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading1,heading2,heading3,heading4,heading5,heading6",
"label": "title"
}
},
"body": {
"type": "StructuredText",
"config": {
"multi": "paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl",
"label": "body"
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/RichBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isTextNode,
isImgNode,
} from '@/types/graphql/prismic/BlogPostNode';
import { linkResolver } from '@/utils/linkResolver';
import { linkResolver } from '@/linkResolver';

const themes = {
light: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RichTextContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styled, {
import { Theme, ThemeContext, themeContext } from '@/context/themeContext';
import { BodyElement } from '@/types/graphql/prismic/BodyElement';

import { linkResolver } from '@/utils/linkResolver';
import { linkResolver } from '@/linkResolver';

const themes = {
light: {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/chsb-yield-terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
InfoPageContainer,
renderContent,
} from '@/components/InfoPageContainer';
import { SingleElementList } from '@/types/graphql/prismic/common';

interface Node {
data: {
Expand All @@ -26,7 +27,7 @@ interface Edge {
type Props = LocalizedPage & {
data: {
allPrismicChsbYieldTermsAndConditions: {
edges: Edge[];
edges: SingleElementList<Edge>;
};
};
};
Expand Down
3 changes: 2 additions & 1 deletion src/pages/terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
InfoPageContainer,
renderContent,
} from '@/components/InfoPageContainer';
import { SingleElementList } from '@/types/graphql/prismic/common';

interface Node {
data: {
Expand All @@ -26,7 +27,7 @@ interface Edge {
type Props = LocalizedPage & {
data: {
allPrismicTermsAndConditions: {
edges: Edge[];
edges: SingleElementList<Edge>;
};
};
};
Expand Down
74 changes: 74 additions & 0 deletions src/pages/yield-terms-1_5.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import * as React from 'react';
import { graphql } from 'gatsby';
import { TextElement } from '@/types/graphql/prismic/TextElement';
import RichTextContainer from '@/components/RichTextContainer';
import Layout, { LocalizedPage } from '@/components/Layout';
import {
InfoPageContainer,
renderContent,
} from '@/components/InfoPageContainer';
import { SingleElementList } from '@/types/graphql/prismic/common';

interface Node {
data: {
title: {
richText: TextElement[];
};
body: {
richText: TextElement[];
};
};
}

interface Edge {
node: Node;
}

type Props = LocalizedPage & {
data: {
allPrismicYieldTermsAndConditions15: {
edges: SingleElementList<Edge>;
};
};
};

const YieldTerms: React.FC<Props> = ({ data, pageContext }: Props) => {
const { edges } = data.allPrismicYieldTermsAndConditions15;

return (
<Layout locale={pageContext.lang}>
<InfoPageContainer>
{renderContent(edges[0])(({ node }) => (
<RichTextContainer
elements={[...node.data.title.richText, ...node.data.body.richText]}
key={0}
/>
))}
</InfoPageContainer>
</Layout>
);
};

export default YieldTerms;

// the lang param:
// - the URL path variable is now ignored (but kept for backwards-compatibility reasons)
// - at the GraphQL query level, it is hardcoded to "en-us" despite the locale (the business decided we ONLY need english version of that page)
export const PageQuery = graphql`
query YieldTermsAndConditions15 {
allPrismicYieldTermsAndConditions15(filter: { lang: { eq: "en-us" } }) {
edges {
node {
data {
body {
richText
}
title {
richText
}
}
}
}
}
}
`;
31 changes: 15 additions & 16 deletions src/pages/privacy.tsx → src/pages/yield-terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import {
InfoPageContainer,
renderContent,
} from '@/components/InfoPageContainer';
import { SingleElementList } from '@/types/graphql/prismic/common';

interface Node {
data: {
pp_title: {
title: {
richText: TextElement[];
};
pp_body: {
body: {
richText: TextElement[];
};
};
Expand All @@ -25,23 +26,21 @@ interface Edge {

type Props = LocalizedPage & {
data: {
allPrismicPrivacyPolicy: {
edges: Edge[];
allPrismicYieldTermsAndConditions: {
edges: SingleElementList<Edge>;
};
};
};

const Privacy: React.FC<Props> = ({ data, pageContext: { lang } }: Props) => {
const { edges } = data.allPrismicPrivacyPolicy;
const YieldTerms: React.FC<Props> = ({ data, pageContext }: Props) => {
const { edges } = data.allPrismicYieldTermsAndConditions;

return (
<Layout locale={lang}>
<Layout locale={pageContext.lang}>
<InfoPageContainer>
{renderContent(edges[0])(({ node }) => (
<RichTextContainer
elements={[
...node.data.pp_title.richText,
...node.data.pp_body.richText,
]}
elements={[...node.data.title.richText, ...node.data.body.richText]}
key={0}
/>
))}
Expand All @@ -50,21 +49,21 @@ const Privacy: React.FC<Props> = ({ data, pageContext: { lang } }: Props) => {
);
};

export default Privacy;
export default YieldTerms;

// the lang param:
// - the URL path variable is now ignored (but kept for backwards-compatibility reasons)
// - at the GraphQL query level, it is hardcoded to "en-us" despite the locale (the business decided we ONLY need english version of that page)
export const PageQuery = graphql`
query PrivacyPolicy {
allPrismicPrivacyPolicy(filter: { lang: { eq: "en-us" } }) {
query YieldTermsAndConditions {
allPrismicYieldTermsAndConditions(filter: { lang: { eq: "en-us" } }) {
edges {
node {
data {
pp_body {
body {
richText
}
pp_title {
title {
richText
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/utils/linkResolver.ts

This file was deleted.

0 comments on commit 44e5cf9

Please sign in to comment.