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

Add login page #1

Merged
merged 13 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
- 'develop'

env:
APP_TITLE: ${{ vars.APP_TITLE }}
GITHUB_WORKFLOW: true

jobs:
test:
name: Run tests
environment: 'Test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -21,7 +23,7 @@ jobs:
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Run test
run: yarn test
Expand All @@ -36,25 +38,27 @@ jobs:
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Run unimported
run: yarn unimported
run: yarn lint:unused
lint:
name: Lint JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
with:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Lint
run: yarn lint
run: yarn generate && yarn lint:js
css-lint:
name: Lint CSS
runs-on: ubuntu-latest
Expand All @@ -66,38 +70,44 @@ jobs:
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Css Lint
run: yarn css-lint
run: yarn lint:css
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-node@v1
with:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Typecheck
run: yarn typecheck
run: yarn generate && yarn typecheck
build:
name: Build
environment: 'Test'
needs: [lint, css-lint, typecheck, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
with:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies
run: yarn install --prefer-online
run: yarn install --prefer-offline --frozen-lockfile

- name: Build
run: yarn export
run: yarn generate && yarn build
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ build-ssr
.env
.eslintcache
tsconfig.tsbuildinfo

# server repo
questionnaire-builder-backend/

# generated graphql schema
generated/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "backend"]
path = backend
url = [email protected]:the-deep/questionnaire-builder-backend.git
12 changes: 9 additions & 3 deletions .unimportedrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"entry": ["./src/main.tsx"],
"entry": ["./src/index.tsx"],
"ignorePatterns": ["**/node_modules/**", "build/**"],
"ignoreUnimported": ["**/*.d.ts"],
"ignoreUnimported": ["**/*.d.ts", "**/*.test.tsx", "**/*.test.ts"],
"ignoreUnused": [],
"extensions": [".ts", ".js", ".tsx", ".jsx"],
"aliases": {
"#views/*": ["./src/views/*"],
"#utils/*": ["./src/utils/*"]
"#utils/*": ["./src/utils/*"],
"#redirects/*": ["./src/redirects/*"],
"#contexts/*": ["./src/contexts/*"],
"#components/*": ["./src/components/*"],
"#hooks/*": ["./src/hooks/*"],
"#configs/*": ["./src/configs/*"],
"#generated/*": ["./generated/*"]
}
}
1 change: 1 addition & 0 deletions backend
Submodule backend added at d38056
14 changes: 14 additions & 0 deletions codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
overwrite: true
schema:
- "./backend/schema.graphql"
documents:
- "src/**/*.tsx"
- "src/**/*.ts"
generates:
./generated/types.ts:
plugins:
- "typescript"
- "typescript-operations"
./generated/schema.json:
plugins:
- "introspection"
65 changes: 61 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,68 @@
version: '3.8'
version: '3.2'

services:
react:
tty: true
build: .
command: sh -c 'yarn install && yarn dev --host'
environment:
APP_TITLE: ${APP_TITLE:-React Base App}
APP_TITLE: ${APP_TITLE:-Questionnaire Builder}
APP_STATIC_ENDPOINT: ${APP_STATIC_ENDPOINT:-http://localhost:8311}
APP_GRAPHQL_ENDPOINT: ${APP_GRAPHQL_ENDPOINT:-http://localhost:8311/graphql/}
env_file:
- .env
command: sh -c 'yarn install && yarn start --host'
ports:
- '3000:3000'
volumes:
- .:/code

db:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: questionnaire_builder
volumes:
- postgres-data15:/var/lib/postgresql/data

api:
image: ghcr.io/the-deep/questionnaire-builder-backend:${DOCKER_BACKEND_TAG:-latest}
build:
context: ./backend/
environment:
APP_ENVIRONMENT: development
APP_TYPE: web
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY?err}
# To overwrite this values. set the values in .env
DJANGO_DEBUG: ${DJANGO_DEBUG:-True}
APP_DOMAIN: localhost:8311
APP_HTTP_PROTOCOL: http
APP_FRONTEND_HOST: localhost:3000
SESSION_COOKIE_DOMAIN: ${SESSION_COOKIE_DOMAIN:-localhost}
CSRF_COOKIE_DOMAIN: ${CSRF_COOKIE_DOMAIN:-localhost}
DJANGO_ALLOWED_HOST: ${DJANGO_ALLOWED_HOST:-*}
DJANGO_DB_NAME: ${DJANGO_DB_NAME:-questionnaire_builder}
DJANGO_DB_USER: ${DJANGO_DB_USER:-postgres}
DJANGO_DB_PASSWORD: ${DJANGO_DB_PASSWORD:-postgres}
DJANGO_DB_PORT: ${DJANGO_DB_PORT:-5432}
DJANGO_DB_HOST: ${DJANGO_DB_HOST:-db}
# EMAIL
EMAIL_FROM: ${EMAIL_FROM:[email protected]}
command: ./scripts/run_develop.sh
env_file:
# Provide additional environment variables using .env file
- .env
volumes:
- ./backend/:/code
- media:/media
- ipython_data_local:/root/.ipython/profile_default # persist ipython data, including ipython history
ports:
- '3000:3000'
- 8311:8000
depends_on:
- db


volumes:
media:
postgres-data15:
ipython_data_local:
9 changes: 7 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link
rel="icon"
type="image/svg+xml"
href="/pineapple.svg"
href="/favicon.svg"
/>
<meta
name="viewport"
Expand All @@ -21,7 +21,12 @@
<title>
%APP_TITLE%
</title>
<link href="https://api.fontshare.com/v2/css?f[]=nunito@300,700,400&f[]=bebas-neue@400&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;700;900;&display=swap"
rel="stylesheet"
>
Comment on lines +24 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add trailing slack if necessary

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean trailing slash? If yes, it's not required here.

</head>
<body>
<noscript>
Expand Down
29 changes: 22 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,40 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"initialize:type": "mkdir -p generated/ && test -f ./generated/types.ts && true || cp types.stub.ts ./generated/types.ts",
"prestart": "yarn initialize:type",
"prelint:js": "yarn initialize:type",
"prelint:unused": "yarn initialize:type",
"prebuild": "yarn initialize:type",
"start": "vite",
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"check-unused": "unimported",
"test": "vitest",
"coverage": "vitest run --coverage",
"generate": "graphql-codegen --config codegen.yml && eslint --fix generated/types.ts",
"typecheck": "tsc",
"lint": "eslint src",
"css-lint": "stylelint ./src/**/*.css"
"lint:js": "eslint src",
"lint:css": "stylelint ./src/**/*.css",
"lint:unused": "unimported",
"test": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@apollo/client": "^3.7.15",
"@hcaptcha/react-hcaptcha": "^1.8.1",
"@the-deep/deep-ui": "^2.0.3",
"@togglecorp/fujs": "^2.0.0",
"@togglecorp/toggle-form": "^2.0.3",
"apollo-link": "^1.2.14",
"apollo-link-retry": "^2.2.16",
"graphql": "^16.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-router-dom": "^6.11.1"
},
"devDependencies": {
"@eslint/eslintrc": "^2.0.3",
"@graphql-codegen/cli": "^2.16.4",
"@graphql-codegen/introspection": "^2.2.3",
"@graphql-codegen/typescript-operations": "^2.5.12",
"@julr/vite-plugin-validate-env": "^0.2.2",
"@types/node": "^20.1.3",
"@types/react": "^18.0.28",
Expand Down
9 changes: 9 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 0 additions & 86 deletions public/pineapple.svg

This file was deleted.

Loading
Loading