Skip to content

Commit

Permalink
feat(frontend): social media image preview
Browse files Browse the repository at this point in the history
  • Loading branch information
chao-mu committed Jul 15, 2024
2 parents b7893b5 + 21f96ee commit cf0a37e
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 77 deletions.
11 changes: 7 additions & 4 deletions frontend/.env.beta
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auth variables
# Auth
NEXT_PUBLIC_AUTH_REGION=us-east-1
NEXT_PUBLIC_AUTH_USER_POOL_ID=us-east-1_0revSxCzf
NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID=1dfi5rar7a2fr5samugigrmise
Expand All @@ -8,11 +8,14 @@ NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_IN=https://beta.chessdojo.club
NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_OUT=https://beta.chessdojo.club
NEXT_PUBLIC_AUTH_OAUTH_RESPONSE_TYPE=code

# API variables
# API
NEXT_PUBLIC_API_BASE_URL=https://g4shdaq6ug.execute-api.us-east-1.amazonaws.com

# Media variables
# Media
NEXT_PUBLIC_MEDIA_PICTURES_BUCKET=https://chess-dojo-prod-pictures.s3.amazonaws.com

# Stripe variables
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_51OB6imGilmvijaecicnOhS1rqgX6VofcmTgi4n3TdhYoPgutx4W8HnUch6iQE7GL62fngez6mL471YWiZSrUhbJI007MlHx5CM

# Site
NEXT_PUBLIC_BASE_URL=https://beta.chessdojo.club
11 changes: 7 additions & 4 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auth variables
# Auth
NEXT_PUBLIC_AUTH_REGION=us-east-1
NEXT_PUBLIC_AUTH_USER_POOL_ID=us-east-1_apywr6kwu
NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID=76en8knncv8bfpfgbheua6j6k
Expand All @@ -8,11 +8,14 @@ NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_IN=http://localhost:3000
NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_OUT=http://localhost:3000
NEXT_PUBLIC_AUTH_OAUTH_RESPONSE_TYPE=code

# API variables
# API
NEXT_PUBLIC_API_BASE_URL=https://c2qamdaw08.execute-api.us-east-1.amazonaws.com

# Media variables
# Media
NEXT_PUBLIC_MEDIA_PICTURES_BUCKET=https://chess-dojo-dev-pictures.s3.amazonaws.com

# Stripe variables
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51OB6imGilmvijaecMJqdvLJdu89BcghnjU7eOIoCwlBl8DeV6i2XojJOaZ36lamZMuVjO7aorXtl90OcdtAstFfF0022uf0sdp

# Site
NEXT_PUBLIC_BASE_URL=http://localhost:3000
11 changes: 7 additions & 4 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auth variables
# Auth
NEXT_PUBLIC_AUTH_REGION=us-east-1
NEXT_PUBLIC_AUTH_USER_POOL_ID=us-east-1_0revSxCzf
NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID=1dfi5rar7a2fr5samugigrmise
Expand All @@ -8,11 +8,14 @@ NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_IN=https://www.chessdojo.club
NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_OUT=https://www.chessdojo.club
NEXT_PUBLIC_AUTH_OAUTH_RESPONSE_TYPE=code

# API variables
# API
NEXT_PUBLIC_API_BASE_URL=https://g4shdaq6ug.execute-api.us-east-1.amazonaws.com

# Media variables
# Media
NEXT_PUBLIC_MEDIA_PICTURES_BUCKET=https://chess-dojo-prod-pictures.s3.amazonaws.com

# Stripe variables
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_51OB6imGilmvijaecicnOhS1rqgX6VofcmTgi4n3TdhYoPgutx4W8HnUch6iQE7GL62fngez6mL471YWiZSrUhbJI007MlHx5CM

# Site
NEXT_PUBLIC_BASE_URL=https://www.chessdojo.club
13 changes: 8 additions & 5 deletions frontend/.env.test
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Auth variables
# Auth
NEXT_PUBLIC_AUTH_REGION: us-east-1
NEXT_PUBLIC_AUTH_USER_POOL_ID: us-east-1_apywr6kwu
NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID: 76en8knncv8bfpfgbheua6j6k
NEXT_PUBLIC_AUTH_OAUTH_DOMAIN: authdev.chessdojo.club
NEXT_PUBLIC_AUTH_OAUTH_DOMAIN: user-pool-domain-dev-chess-dojo-scheduler.auth.us-east-1.amazoncognito.com
NEXT_PUBLIC_AUTH_OAUTH_SCOPES: profile,email,openid
NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_IN: http://localhost:3000
NEXT_PUBLIC_AUTH_OAUTH_REDIRECT_SIGN_OUT: http://localhost:3000
NEXT_PUBLIC_AUTH_OAUTH_RESPONSE_TYPE: code

# API variables
# API
NEXT_PUBLIC_API_BASE_URL: https://c2qamdaw08.execute-api.us-east-1.amazonaws.com

# Media variables
# Media
NEXT_PUBLIC_MEDIA_PICTURES_BUCKET: https://chess-dojo-dev-pictures.s3.amazonaws.com

# Stripe variables
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: pk_test_51OB6imGilmvijaecMJqdvLJdu89BcghnjU7eOIoCwlBl8DeV6i2XojJOaZ36lamZMuVjO7aorXtl90OcdtAstFfF0022uf0sdp

# Site
NEXT_PUBLIC_BASE_URL=http://localhost:3000
5 changes: 2 additions & 3 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ cypress/screenshots/

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.*.local

npm-debug.log*
yarn-debug.log*
Expand Down
9 changes: 5 additions & 4 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export default defineConfig({

cognito_username: process.env.AWS_COGNITO_USERNAME,
cognito_password: process.env.AWS_COGNITO_PASSWORD,
cognito_region: process.env.AWS_COGNITO_REGION,
cognito_user_pool_id: process.env.AWS_COGNITO_USER_POOL_ID,
cognito_user_pool_web_client_id: process.env.AWS_COGNITO_USER_POOL_WEB_CLIENT_ID,
cognito_domain: process.env.AWS_COGNITO_DOMAIN,
cognito_region: process.env.NEXT_PUBLIC_AUTH_REGION,
cognito_user_pool_id: process.env.NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID,
cognito_user_pool_web_client_id:
process.env.NEXT_PUBLIC_AUTH_USER_POOL_WEB_CLIENT_ID,
cognito_domain: process.env.NEXT_PUBLIC_AUTH_OAUTH_DOMAIN,
}),
});
20 changes: 0 additions & 20 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,32 @@
"scripts": {
"start": "echo ERROR: behavior of 'npm run start' was non-standard and thus has been removed to force migration to 'npm run dev'. In the future, 'npm run start' will serve the production build via 'next start', per NextJS conventions.",
"start:build": "next start",
"preinstall": "touch .env.local && cd ../common && npm install && cd ../eslint-config-dojo/ && npm install",
"dev": "dotenvx run --env-file=.env.development --env-file=.env.local -- next dev",
"preinstall": "npm run touch-env && cd ../common && npm install && cd ../eslint-config-dojo/ && npm install",
"touch-env": "touch .env.local .env.development.local .env.production.local .env.beta.local .env.test.local .env",
"dev": "$npm_package_config_run_dev -- next dev",
"precheck": "npm run lint && next build && npm run test:unit",
"precheck:full": "npm run precheck && npm run test:cypress",
"dev:precheck": "npm run precheck && npm run dev",
"build": "npm run build:production",
"build:production": "dotenvx run --env-file=.env.production -- next build",
"build:beta": "dotenvx run --env-file=.env.beta -- next build",
"build:test": "dotenvx run --env-file=.env.test -- next build",
"build:development": "dotenvx run --env-file=.env.development -- next build",
"build:production": "$npm_package_config_run_prod -- next build",
"build:beta": "$npm_package_config_run_beta -- next build",
"build:test": "$npm_package_config_run_test -- next build",
"build:development": "$npm_package_config_run_dev -- next build",
"test": "npm run test:unit && npm run test:cypress",
"test:unit": "vitest run",
"test:cypress": "dotenvx run --env-file=.env.test.local -- cypress run",
"test:unit": "$npm_package_config_run_test -- vitest run",
"test:cypress": "$npm_package_config_run_test -- cypress run",
"lint": "npm run lint:types && eslint .",
"lint:cypress": "eslint cypress",
"lint:fix": "eslint --fix .",
"lint:types": "tsc --noEmit",
"lint:types:watch": "tsc --noEmit --watch"
},
"config": {
"run_dev": "dotenvx run --env-file=.env.development.local --env-file=.env.local --env-file=.env.development --env-file=.env",
"run_test": "dotenvx run --env-file=.env.test.local --env-file=.env.local --env-file=.env.test --env-file=.env",
"run_prod": "dotenvx run --env-file=.env.production.local --env-file=.env.local --env-file=.env.production --env-file=.env",
"run_beta": "dotenvx run --env-file=.env.beta.local --env-file=.env.local --env-file=.env.beta --env-file=.env"
},
"browserslist": {
"production": [
">0.2%",
Expand Down Expand Up @@ -120,7 +127,6 @@
"@typescript-eslint/parser": "^7.12.0",
"command-line-args": "^5.2.1",
"command-line-usage": "^7.0.1",
"cross-env": "^7.0.3",
"cypress": "^13.13.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/app/(legacy)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { getConfig } from '@/config';
import { Layout } from '@/legacy/Layout';
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'ChessDojo',
description:
'View the scoreboard, schedule meetings and more for the ChessDojo Training Program',
'The ChessDojo Training Program offers structured training plans for all levels 0-2500, along with an active and supportive community',
metadataBase: getConfig().baseUrl,
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/app/(scoreboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Layout } from '@/legacy/Layout';
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'ChessDojo',
description:
'View the scoreboard, schedule meetings and more for the ChessDojo Training Program',
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
return <Layout>{children}</Layout>;
}
Binary file added frontend/src/app/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 6 additions & 23 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,13 @@ export const EnvSchema = z.object({
stripe: z.object({
publishableKey: z.string(),
}),
baseUrl: z
.string()
.url()
.transform((v) => new URL(v)),
});

export interface Config {
auth: {
region: 'us-east-1';
userPoolId: string;
userPoolWebClientId: string;
oauth: {
domain: string;
scope: string[];
redirectSignIn: string;
redirectSignOut: string;
responseType: 'code';
};
};
api: {
baseUrl: string;
};
media: {
picturesBucket: string;
};
stripe: {
publishableKey: string;
};
}
export type Config = z.infer<typeof EnvSchema>;

export function getConfig(): Config {
return EnvSchema.parse({
Expand All @@ -74,5 +56,6 @@ export function getConfig(): Config {
stripe: {
publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
},
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
});
}

0 comments on commit cf0a37e

Please sign in to comment.