Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core Content Pages: Render CTAs and contact cards within Service Entries #340

Closed
wants to merge 34 commits into from

Conversation

hinzed1127
Copy link
Contributor

@hinzed1127 hinzed1127 commented Jul 28, 2023

Jira ticket: LDAF-359

Proposed changes

This pulls in the changes from both #274 and #279, so the diff is very large right now. Skip to my commits for the relevant changes:

  • added an EntryHyperlink.svelte component for to render those types of Rich Text Nodes
  • added contactInformationCollection and serviceCtaCollection to what gets requested on the service entries in the graphQL query. I’m working through making sure all the CTA types render as outlined here (urls and contact cards definitely work, I think assets and page details do, but not 100% sure on those 2 yet)
  • I wanted to keep the logic for rendering CTA items as buttons independent of the rich text rendering, so right now the usa-button class is getting applied via a query selector on render. I don’t love that solution but not sure if there’s an immediately cleaner way
  • most of the my changes outside of EntryHyperlink.svelte (and a little glue to get that working) are within the page.svelte and page.server.ts files for the serviceGroup page

Screenshots

Example accordion with contact info and CTA button on /plants/nurseries-landscaping (this from the last "nursery inspections" accordion on the page):
Screenshot 2023-07-28 at 6 19 36 PM

Acceptance criteria validation

  • Call To Action items get rendered within Service Entry accordions on Core Content pages
  • Contact info cards also get rendered in the same location

Other details

Alternate solutions

Possible drawbacks

Requested feedback

Benaiah and others added 28 commits July 20, 2023 18:47
SQUASHME: client creation in Nav

rename contentful implementation file

remove unnecessary type declaration

don't override page data with the document; pass query to frontend

rename contentful/client to contentful/graphqlClient

convert under construction page to use GraphQL client

fix e2e header tests

fix loadMainNav when there is no Contentful connection

remove unnecessary query variable from page data

add server-side contentful previewing w/contentful auth

ignore unused vars that start with _

improve server loading

enable previewing in nav graphql query

WIP

fix import

add management client to try block

delete cookie on logout

don't store the user token in localStorage; let it expire

fix oauth callback page

make sure user is activated

add some debug logging

decode the cookie values

fiddling with the cookie

move logout logic to an action

use sveltekit's fetch function instead of global fetch when possible

debugging

reduce token scope

can we use the user's token instead of a global one?

move codegen config; separate schema and schema type generation

switch default scalar type to "unknown" to avoid "any" pollution

update package scripts to generate schema types correctly

make preview authentication universal

let contentful embed the site

fix package scripts

throw preview authentication errors in layout not handler

fix broken oauth link

request correct token

WIP disable layout error

WIP catch preview auth errors with an actual layout

import component

remove unused preview client

add missing baseURL variable

stop throwing errors in the root layout

make errors more detailed

silly mistake

another silly mistake

set CSP in a hook in addition to vercel settings

try it again

try with x-frame-options

allow cookies to pass to frame

fix sameSite setting

WIP does this work

fix cookie samesite handling

tighten up CSP

improve CSP headers

create the server-side contentful client in a single place

add previewing to all gql queries

update schemas

fix homepage

fix linting; add query variable typing

add a trailing newline

add new env variables to env.d.ts

make LoginLink accept anchor element props

open login link in new window if it's in an iframe

fix a test

make contentful oauth endpoint an environment variable

refresh the page on logout

make LoginLink a little nicer

improve parseHashQuery

parseHashQuery should return Record<string, string>

logout should only be available in the browser

run prebuild before building storybook

avoid errors when $page or $page.url are undefined

update schemas

use null to explicitly delete cookie and localStorage entries

improve cookie deletion

add trailing newline

reuse setCookie to define deleteCookie

undo "fix" to parseHashQuery

add preview parameter when navigating from a preview

set preview to previous preview value

use workaround to preserve query parameter

cf. sveltejs/kit#10122

small refactors to root layout

only add preview param to URLs that don't already have it

move a variable

refactor logout action with "get" from svelte/store

improve graphqlClient tests

get current user on the server

fix User component

work around weird test error

use new /login and /logout endpoints for http-only contentful auth

remove unnecessary type annotations

make login/logout logic work without hard refreshing

mock $app/stores to fix tests

disable flaky eslint rule that's already covered by ts

use "import type" in app.d.ts

remove unused imports

add tests of cookie functionality

more tests of cookies

remove a bunch of dead code

various changes prior to setting up redis token handling

tests for handleToken

set up docker compose with redis

redis authentication complete; still need to fix tests

update office/organization page to support new preview functionality

also queries based on the slug instead of grabbing all office page entries

support passing "unknown" to ContentfulRichText

fix test-contentful-content page

lots of testing of handleToken; some improvements to it

shorten a line

don't merge office page with layout data

add missing test file

lots of testing and improvements

lots more progress and tests, including adding a logging service

add handleError hooks to the client and server

set url context in handleError on both client and server

add some comments

rearrange logging code; fix tests and dev; use new message format

fix a type error

remove a weird emacs thing in tsconfig

stop exposing logger on window

expand some comments

fix file capitalization

fix syntax error

add type definitions for new env variables

add example values for new env variables

remove .only from describe

remove unused imports

simplify ContentfulLoginLink

show footer when there is a previewAuthenticationError

use Link for special links; fix a LoginLink bug

update schema and migrate from "metadata" to "pageMetadata"

await error logging in handleError

actually run the error handling

fix some types

fix some prop types

improve the nav loading to get rid of type assertions

fix test data

move redis client creation into its own hook

fix type errors

don't import devalue parse ahead of time

fix type errors

get the redis client working in docker

get types checking and some tests passing again

fix nav

fix a type issue

move server hooks into their own files (still need to fix tests)

big refactoring and improved tests

remove old redis service

move contentful service into a server-only folder

improvements to error handling and logging

use dynamic env for KV_URL

run end-to-end tests with docker compose

fix formatting

don't show logout button when not logged in

small updates to login page

fix bad import

add comment to token duration
We already had support for "hyperlink" and "asset-hyperlink" nodes. This
adds support for "entry-hyperlink", with the only remaining inline type
to account for from Contentful being "embedded-entry-inline".
- Entries are either a contact (render contact card) or page details
(render as a button)
- Assets render as a button
@vercel
Copy link

vercel bot commented Jul 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ldaf ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2023 10:44pm

@hinzed1127 hinzed1127 requested a review from LouisFettet July 29, 2023 02:32
@hinzed1127 hinzed1127 requested a review from Benaiah July 29, 2023 02:32
@hinzed1127
Copy link
Contributor Author

Moved to #350

@hinzed1127 hinzed1127 closed this Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants