diff --git a/README.md b/README.md index b7bf7a6..284694f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/gatsby-config.ts b/gatsby-config.ts index 88f9848..f4179c1 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -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: {}, @@ -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`), }, diff --git a/prismic-types/yield_terms_and_conditions.json b/prismic-types/yield_terms_and_conditions.json new file mode 100644 index 0000000..cb5c124 --- /dev/null +++ b/prismic-types/yield_terms_and_conditions.json @@ -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" + } + } + } +} diff --git a/prismic-types/yield_terms_and_conditions_1_5.json b/prismic-types/yield_terms_and_conditions_1_5.json new file mode 100644 index 0000000..cb5c124 --- /dev/null +++ b/prismic-types/yield_terms_and_conditions_1_5.json @@ -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" + } + } + } +} diff --git a/src/components/RichBlock.tsx b/src/components/RichBlock.tsx index c97ad12..00b3a56 100644 --- a/src/components/RichBlock.tsx +++ b/src/components/RichBlock.tsx @@ -9,7 +9,7 @@ import { isTextNode, isImgNode, } from '@/types/graphql/prismic/BlogPostNode'; -import { linkResolver } from '@/utils/linkResolver'; +import { linkResolver } from '@/linkResolver'; const themes = { light: { diff --git a/src/components/RichTextContainer.tsx b/src/components/RichTextContainer.tsx index 6485047..d7a723c 100644 --- a/src/components/RichTextContainer.tsx +++ b/src/components/RichTextContainer.tsx @@ -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: { diff --git a/src/pages/chsb-yield-terms.tsx b/src/pages/chsb-yield-terms.tsx index f30a28f..34e6797 100644 --- a/src/pages/chsb-yield-terms.tsx +++ b/src/pages/chsb-yield-terms.tsx @@ -7,6 +7,7 @@ import { InfoPageContainer, renderContent, } from '@/components/InfoPageContainer'; +import { SingleElementList } from '@/types/graphql/prismic/common'; interface Node { data: { @@ -26,7 +27,7 @@ interface Edge { type Props = LocalizedPage & { data: { allPrismicChsbYieldTermsAndConditions: { - edges: Edge[]; + edges: SingleElementList; }; }; }; diff --git a/src/pages/terms.tsx b/src/pages/terms.tsx index b967966..60e369e 100644 --- a/src/pages/terms.tsx +++ b/src/pages/terms.tsx @@ -7,6 +7,7 @@ import { InfoPageContainer, renderContent, } from '@/components/InfoPageContainer'; +import { SingleElementList } from '@/types/graphql/prismic/common'; interface Node { data: { @@ -26,7 +27,7 @@ interface Edge { type Props = LocalizedPage & { data: { allPrismicTermsAndConditions: { - edges: Edge[]; + edges: SingleElementList; }; }; }; diff --git a/src/pages/yield-terms-1_5.tsx b/src/pages/yield-terms-1_5.tsx new file mode 100644 index 0000000..3dac6f0 --- /dev/null +++ b/src/pages/yield-terms-1_5.tsx @@ -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; + }; + }; +}; + +const YieldTerms: React.FC = ({ data, pageContext }: Props) => { + const { edges } = data.allPrismicYieldTermsAndConditions15; + + return ( + + + {renderContent(edges[0])(({ node }) => ( + + ))} + + + ); +}; + +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 + } + } + } + } + } + } +`; diff --git a/src/pages/privacy.tsx b/src/pages/yield-terms.tsx similarity index 66% rename from src/pages/privacy.tsx rename to src/pages/yield-terms.tsx index b294528..c8fe981 100644 --- a/src/pages/privacy.tsx +++ b/src/pages/yield-terms.tsx @@ -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[]; }; }; @@ -25,23 +26,21 @@ interface Edge { type Props = LocalizedPage & { data: { - allPrismicPrivacyPolicy: { - edges: Edge[]; + allPrismicYieldTermsAndConditions: { + edges: SingleElementList; }; }; }; -const Privacy: React.FC = ({ data, pageContext: { lang } }: Props) => { - const { edges } = data.allPrismicPrivacyPolicy; +const YieldTerms: React.FC = ({ data, pageContext }: Props) => { + const { edges } = data.allPrismicYieldTermsAndConditions; + return ( - + {renderContent(edges[0])(({ node }) => ( ))} @@ -50,21 +49,21 @@ const Privacy: React.FC = ({ 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 } } diff --git a/src/utils/linkResolver.ts b/src/utils/linkResolver.ts deleted file mode 100644 index acb3b16..0000000 --- a/src/utils/linkResolver.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PostMeta } from '@/types/graphql/prismic/PostHeader'; - -export const linkResolver = (doc: PostMeta) => - doc.type === `post` ? `/post/${doc.id}` : `/`;