diff --git a/apps/cli/package.json b/apps/cli/package.json index 18475c53..d908cfc2 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -13,6 +13,6 @@ "@atj/interviews": "workspace:*", "@atj/dependency-graph": "workspace:*", "@atj/docassemble": "workspace:*", - "commander": "^11.0.0" + "commander": "^11.1.0" } } diff --git a/apps/form-service/.gitignore b/apps/form-service/.gitignore new file mode 100644 index 00000000..849ddff3 --- /dev/null +++ b/apps/form-service/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/apps/form-service/package.json b/apps/form-service/package.json new file mode 100644 index 00000000..abf8d1b2 --- /dev/null +++ b/apps/form-service/package.json @@ -0,0 +1,18 @@ +{ + "name": "@atj/form-service", + "private": true, + "description": "backend service for handling submitted forms", + "main": "src/index.ts", + "scripts": { + "build": "esbuild src/index.ts --bundle --minify --sourcemap --platform=node --target=es2020 --outfile=dist/index.js", + "build:client": "tsup src/* --env.NODE_ENV production --dts-resolve", + "clean": "rm -rf dist tsconfig.tsbuildinfo" + }, + "dependencies": { + "@atj/interviews": "workspace:*" + }, + "devDependencies": { + "@types/aws-lambda": "^8.10.109", + "esbuild": "^0.19.5" + } +} diff --git a/apps/form-service/src/index.ts b/apps/form-service/src/index.ts new file mode 100644 index 00000000..c85bc3d0 --- /dev/null +++ b/apps/form-service/src/index.ts @@ -0,0 +1,33 @@ +import { APIGatewayEvent, APIGatewayProxyResult, Context } from 'aws-lambda'; + +export const lambdaHandler = async ( + event: APIGatewayEvent, + context: Context +): Promise => { + if (!event.body) { + const response: APIGatewayProxyResult = { + statusCode: 400, + body: JSON.stringify({ message: 'Request body is missing.' }), + }; + return response; + } + + const body = Buffer.from(event.body, 'base64').toString('utf-8'); + const formData = new URLSearchParams(body); + const fullName = formData.get('full_name'); + if (!fullName) { + const response: APIGatewayProxyResult = { + statusCode: 400, + body: JSON.stringify({ + message: 'Full name is required.', + }), + }; + return response; + } + + const response: APIGatewayProxyResult = { + statusCode: 200, + body: JSON.stringify({ message: `Hello, ${fullName}!` }), + }; + return response; +}; diff --git a/apps/form-service/tsconfig.json b/apps/form-service/tsconfig.json new file mode 100644 index 00000000..23707a42 --- /dev/null +++ b/apps/form-service/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "emitDeclarationOnly": true, + "rootDir": "src" + }, + "include": [ + "src/**/*" + ], + "references": [ + { + "path": "../../packages/interviews" + } + ] +} diff --git a/apps/spotlight/package.json b/apps/spotlight/package.json index 7a1ed814..d28c665b 100644 --- a/apps/spotlight/package.json +++ b/apps/spotlight/package.json @@ -15,13 +15,12 @@ "@atj/docassemble": "workspace:*", "@atj/documents": "workspace:*", "@atj/interviews": "workspace:*", - "@uswds/uswds": "^3.6.0", - "astro": "^3.3.0", + "astro": "^3.3.3", "react": "^18.2.0", "react-dom": "^18.2.0" }, "devDependencies": { "@astrojs/check": "^0.2.1", - "@types/react": "^18.2.21" + "@types/react": "^18.2.33" } } diff --git a/apps/spotlight/src/layouts/ContentLayout.astro b/apps/spotlight/src/layouts/ContentLayout.astro new file mode 100644 index 00000000..2026a996 --- /dev/null +++ b/apps/spotlight/src/layouts/ContentLayout.astro @@ -0,0 +1,28 @@ +--- +import { type AppContext } from '../context'; +import Layout from '../layouts/Layout.astro'; + +interface Props { + title: string; + context: AppContext; +} +const { context, title } = Astro.props; +--- + + +
+
+
+
+
+
+ +
+
+
+
+
+
+
diff --git a/apps/spotlight/src/layouts/Layout.astro b/apps/spotlight/src/layouts/Layout.astro index 9f3ee869..54a029ac 100644 --- a/apps/spotlight/src/layouts/Layout.astro +++ b/apps/spotlight/src/layouts/Layout.astro @@ -1,15 +1,15 @@ --- -import '../styles.css' +import '../styles.css'; import Footer from '../components/Footer.astro'; import UsaBanner from '../components/UsaBanner.astro'; -import { type GithubRepository } from '../lib/github'; +import { type AppContext } from '../context'; interface Props { title: string; - github: GithubRepository; + context: AppContext; } -const { github, title } = Astro.props; +const { context, title } = Astro.props; --- @@ -17,11 +17,29 @@ const { github, title } = Astro.props; - - - - - + + + + + {title} @@ -29,6 +47,6 @@ const { github, title } = Astro.props; -