diff --git a/apps/nextjs/next.config.js b/apps/nextjs/next.config.js index 28d87ee..3669f99 100644 --- a/apps/nextjs/next.config.js +++ b/apps/nextjs/next.config.js @@ -37,6 +37,7 @@ const nextConfig = { search: "", }, { + // local protocol: "https", hostname: "d3t9degcpc8bgc.cloudfront.net", }, diff --git a/infra/nextjs.ts b/infra/nextjs.ts index 25f0f3b..70ba826 100644 --- a/infra/nextjs.ts +++ b/infra/nextjs.ts @@ -60,6 +60,15 @@ const NEXT_PUBLIC_BASE_URL = ? "https://d1a1w7ulyz8ubg.cloudfront.net" : "http://localhost:3000"; +const NEXT_PUBLIC_CDN_DOMAIN = + $app.stage === "production" + ? "https://cdn.joinhomefront.org" + : $app.stage === "staging" + ? "https://staging-cdn.joinhomefront.org" + : $app.stage === "development" + ? "https://d3t9degcpc8bgc.cloudfront.net" + : "https://d3t9degcpc8bgc.cloudfront.net"; + function getDomain(): NextjsArgs["domain"] | undefined { switch ($app.stage) { // case "development": @@ -124,6 +133,7 @@ export const nextjs = new sst.aws.Nextjs("Web", { ], environment: { NEXT_PUBLIC_BASE_URL, + NEXT_PUBLIC_CDN_DOMAIN, NEXT_PUBLIC_PROTOMAPS_API_KEY, NEXT_PUBLIC_STRIPE_BILLING_RETURN_URL, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, @@ -145,7 +155,6 @@ export const nextjs = new sst.aws.Nextjs("Web", { STRIPE_HASH_KEY: stripeHashKey.value, STRIPE_SECRET_KEY: stripeSecretKey.value, STRIPE_WEBHOOK_SECRET: stripeWebhookSecret.value, - NEXT_PUBLIC_CDN_DOMAIN: "https://d3t9degcpc8bgc.cloudfront.net", }, vpc, }); diff --git a/infra/storage.ts b/infra/storage.ts index a8b2907..2a769b3 100644 --- a/infra/storage.ts +++ b/infra/storage.ts @@ -6,12 +6,6 @@ export const bucket = new sst.aws.Bucket("homefront-next-prod", { export const cdnBucket = new sst.aws.Bucket("join-homefront", { access: "public", - transform: { - bucket(args, opts) { - args.bucket = $app.stage === "production" ? "join-homefront" : undefined; - opts.import = $app.stage === "production" ? "join-homefront" : undefined; - }, - }, }); export const cdn = new sst.aws.Cdn("CDN", { @@ -21,6 +15,18 @@ export const cdn = new sst.aws.Cdn("CDN", { domainName: cdnBucket.domain, }, ], + domain: + $app.stage === "production" + ? { + name: "cdn.joinhomefront.org", + dns: sst.cloudflare.dns(), + } + : $app.stage === "staging" + ? { + name: "staging-cdn.joinhomefront.org", + dns: sst.cloudflare.dns(), + } + : undefined, defaultCacheBehavior: { targetOriginId: cdnBucket.arn, allowedMethods: ["GET", "HEAD", "OPTIONS"], diff --git a/packages/app/features/actions/RecommendedActionsList.tsx b/packages/app/features/actions/RecommendedActionsList.tsx index c9bb63e..5a14c19 100644 --- a/packages/app/features/actions/RecommendedActionsList.tsx +++ b/packages/app/features/actions/RecommendedActionsList.tsx @@ -36,11 +36,7 @@ export function RecommendedActionsList() { } }, [isLoading, recommendedActions, hasAttemptedGeneration]); - if ( - isLoading || - generateRecommendedActions.isPending || - !recommendedActions?.length - ) { + if (isLoading || generateRecommendedActions.isPending) { return ( @@ -57,7 +53,7 @@ export function RecommendedActionsList() { )} ListEmptyComponent={() => ( - You don't have any recommended actions yet. + You don't have any recommended actions right now. )} keyExtractor={(recommendedAction) => diff --git a/packages/aws/src/index.ts b/packages/aws/src/index.ts index fbcc583..54ec032 100644 --- a/packages/aws/src/index.ts +++ b/packages/aws/src/index.ts @@ -3,15 +3,7 @@ import { Resource } from "sst"; const BUCKET_NAME = Resource["join-homefront"].name; -const opts = - Resource.App.stage === "production" - ? { - region: "us-east-2", - endpoint: `https://${BUCKET_NAME}.s3.us-east-2.amazonaws.com`, - } - : {}; - -const s3 = new S3Client(opts); +const s3 = new S3Client({}); const MIME_TO_EXT = { "image/jpeg": ".jpg",