From 0a9006430fe57f17320c874435d0d92fbafc9431 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:40:35 +0530 Subject: [PATCH 01/56] fix: command --- package.json | 2 +- turbo.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 30076100f..59ee798d4 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dx": "npm i && npm run dx:up && npm run prisma:migrate-dev", "dx:up": "docker compose -f docker/compose-services.yml up -d", "dx:down": "docker compose -f docker/compose-services.yml down", - "ci": "turbo run build test:e2e", + "ci": "turbo run test:e2e", "prisma:generate": "npm run with:env -- npm run prisma:generate -w @documenso/prisma", "prisma:migrate-dev": "npm run with:env -- npm run prisma:migrate-dev -w @documenso/prisma", "prisma:migrate-deploy": "npm run with:env -- npm run prisma:migrate-deploy -w @documenso/prisma", diff --git a/turbo.json b/turbo.json index 3a96c2a07..5bc0ac483 100644 --- a/turbo.json +++ b/turbo.json @@ -27,7 +27,8 @@ "cache": false }, "test:e2e": { - "dependsOn": ["^build"] + "dependsOn": ["^build"], + "cache": false } }, "globalDependencies": ["**/.env.*local"], From e470020b166abf37975034c73d2efac5a59b305f Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:41:24 +0530 Subject: [PATCH 02/56] feat: add cache build action --- .github/actions/cache-build/action.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/actions/cache-build/action.yml diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml new file mode 100644 index 000000000..6fba4f745 --- /dev/null +++ b/.github/actions/cache-build/action.yml @@ -0,0 +1,25 @@ +name: Cache production build binaries +description: 'Cache or restore if necessary' +inputs: + node_version: + required: false + default: v18.x +runs: + using: 'composite' + steps: + - name: Cache production build + uses: actions/cache@v3 + id: production-build-cache + env: + cache-name: prod-build + with: + path: | + ${{ github.workspace }}/apps/web/.next + ${{ github.workspace }}/apps/marketing/.next + **/.turbo/** + **/dist/** + + key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }} + + - run: npm run build + if: steps.production-build-cache.outputs.cache-hit != 'true' From fc372d0aa9cb05fe495d1a05536530965ec28fee Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:41:48 +0530 Subject: [PATCH 03/56] feat: add node install action --- .github/actions/node-install/action.yml | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/actions/node-install/action.yml diff --git a/.github/actions/node-install/action.yml b/.github/actions/node-install/action.yml new file mode 100644 index 000000000..92d02092a --- /dev/null +++ b/.github/actions/node-install/action.yml @@ -0,0 +1,33 @@ +name: 'Setup node and cache node_modules' +inputs: + node_version: + required: false + default: v18.x + +runs: + using: 'composite' + steps: + - name: Set up Node ${{ inputs.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node_version }} + + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }} + + - name: Install dependencies + run: | + npm ci + npm run prisma:generate + env: + HUSKY: '0' From 9b5d64cc1a356e67600562f444b9a54aa5064cf8 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:44:27 +0530 Subject: [PATCH 04/56] feat: add playwright action --- .github/actions/playwright-install/action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/actions/playwright-install/action.yml diff --git a/.github/actions/playwright-install/action.yml b/.github/actions/playwright-install/action.yml new file mode 100644 index 000000000..6d0648649 --- /dev/null +++ b/.github/actions/playwright-install/action.yml @@ -0,0 +1,18 @@ +name: Install playwright binaries +description: 'Install playwright, cache and restore if necessary' +runs: + using: 'composite' + steps: + - name: Cache playwright + id: cache-playwright + uses: actions/cache@v3 + with: + path: | + ~/.cache/ms-playwright + ${{ github.workspace }}/node_modules/playwright + key: playwright-${{ hashFiles('**/package-lock.json') }} + restore-keys: playwright- + + - name: Install playwright + if: steps.cache-playwright.outputs.cache-hit != 'true' + run: npx playwright install --with-deps From 9e57de512a8cce6cbb225db7721981dc4f384599 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:46:09 +0530 Subject: [PATCH 05/56] feat: use actions --- .github/workflows/ci.yml | 12 ++---------- .github/workflows/e2e-tests.yml | 17 +++++++---------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index deda53ff0..53ed03f20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,20 +23,12 @@ jobs: with: fetch-depth: 2 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-install - name: Copy env run: cp .env.example .env - - name: Build - run: npm run build + - uses: ./.github/actions/cache-build build_docker: name: Build Docker Image diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 7b05458d9..9d1782363 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -6,26 +6,21 @@ on: branches: ['main'] jobs: e2e_tests: - name: "E2E Tests" + name: 'E2E Tests' timeout-minutes: 60 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm - - name: Install dependencies - run: npm ci - name: Copy env run: cp .env.example .env + - uses: ./.github/actions/node-install + - name: Start Services run: npm run dx:up - - name: Install Playwright Browsers - run: npx playwright install --with-deps + - uses: ./.github/actions/playwright-install - name: Generate Prisma Client run: npm run prisma:generate -w @documenso/prisma @@ -36,6 +31,8 @@ jobs: - name: Seed the database run: npm run prisma:seed + - uses: ./.github/actions/cache-build + - name: Run Playwright tests run: npm run ci @@ -43,7 +40,7 @@ jobs: if: always() with: name: test-results - path: "packages/app-tests/**/test-results/*" + path: 'packages/app-tests/**/test-results/*' retention-days: 30 env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} From ce6f523230164f830cabcfb4fff224a9db8080dd Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Thu, 4 Jan 2024 23:56:32 +0530 Subject: [PATCH 06/56] fix: key --- .github/actions/cache-build/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index 6fba4f745..b91332e04 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -12,6 +12,11 @@ runs: id: production-build-cache env: cache-name: prod-build + key-1: ${{ hashFiles('**/package-lock.json') }} + key-2: ${{ github.run_id }} + + # Ensures production-build.yml will always be fresh + key-3: ${{ github.sha }} with: path: | ${{ github.workspace }}/apps/web/.next @@ -19,7 +24,7 @@ runs: **/.turbo/** **/dist/** - key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} - run: npm run build if: steps.production-build-cache.outputs.cache-hit != 'true' From b35f050409a3b137e09a0a8d593b30a71e249050 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 00:03:20 +0530 Subject: [PATCH 07/56] fix: add shell --- .github/actions/cache-build/action.yml | 1 + .github/actions/node-install/action.yml | 1 + .github/actions/playwright-install/action.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index b91332e04..cbbe3a0a1 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -27,4 +27,5 @@ runs: key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} - run: npm run build + shell: bash if: steps.production-build-cache.outputs.cache-hit != 'true' diff --git a/.github/actions/node-install/action.yml b/.github/actions/node-install/action.yml index 92d02092a..351598182 100644 --- a/.github/actions/node-install/action.yml +++ b/.github/actions/node-install/action.yml @@ -26,6 +26,7 @@ runs: ${{ runner.os }} - name: Install dependencies + shell: bash run: | npm ci npm run prisma:generate diff --git a/.github/actions/playwright-install/action.yml b/.github/actions/playwright-install/action.yml index 6d0648649..27d0e66b4 100644 --- a/.github/actions/playwright-install/action.yml +++ b/.github/actions/playwright-install/action.yml @@ -16,3 +16,4 @@ runs: - name: Install playwright if: steps.cache-playwright.outputs.cache-hit != 'true' run: npx playwright install --with-deps + shell: bash From e5b7bf81fa2af9a7add33502044f479d4641ff18 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 00:06:16 +0530 Subject: [PATCH 08/56] fix: add action to codeql --- .github/workflows/codeql-analysis.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 465041c0a..314dc7b7b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,19 +25,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm - - - name: Install Dependencies - run: npm ci - - name: Copy env run: cp .env.example .env - - name: Build Documenso - run: npm run build + - uses: ./.github/actions/node-install + + - uses: ./.github/actions/cache-build - name: Initialize CodeQL uses: github/codeql-action/init@v2 From 308f55f3d40df50ec36e0bc9a816af668ed057bb Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 00:09:41 +0530 Subject: [PATCH 09/56] fix: key --- .github/actions/cache-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index cbbe3a0a1..9c0b1feae 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -24,7 +24,7 @@ runs: **/.turbo/** **/dist/** - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} - run: npm run build shell: bash From 26b604dbd0fd6db002b318e6922df997beb44dfd Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 00:21:05 +0530 Subject: [PATCH 10/56] fix: add workflow call --- .github/workflows/ci.yml | 4 +--- .github/workflows/codeql-analysis.yml | 1 + .github/workflows/e2e-tests.yml | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53ed03f20..54dec497b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: 'Continuous Integration' on: + workflow_call: push: branches: ['main'] pull_request: @@ -10,9 +11,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -env: - HUSKY: 0 - jobs: build_app: name: Build App diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 314dc7b7b..873869210 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,6 +1,7 @@ name: 'CodeQL' on: + workflow_call: workflow_dispatch: push: branches: ['main'] diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 9d1782363..ad9295ac2 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,5 +1,6 @@ name: Playwright Tests on: + workflow_call: push: branches: ['main'] pull_request: From 0c12e34c38d09ee00ec04edff6c4164cac762399 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:08:32 +0530 Subject: [PATCH 11/56] fix: remove call --- .github/workflows/codeql-analysis.yml | 1 - .github/workflows/e2e-tests.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 873869210..314dc7b7b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,7 +1,6 @@ name: 'CodeQL' on: - workflow_call: workflow_dispatch: push: branches: ['main'] diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index ad9295ac2..9d1782363 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,6 +1,5 @@ name: Playwright Tests on: - workflow_call: push: branches: ['main'] pull_request: From c86f79dd7b68c32d47b051e5745515e6db4385da Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:11:28 +0530 Subject: [PATCH 12/56] feat: add workflow call actions --- .github/workflows/node-install.yml | 16 ++++++++++++++++ .github/workflows/production-build.yml | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .github/workflows/node-install.yml create mode 100644 .github/workflows/production-build.yml diff --git a/.github/workflows/node-install.yml b/.github/workflows/node-install.yml new file mode 100644 index 000000000..9b1bd52a7 --- /dev/null +++ b/.github/workflows/node-install.yml @@ -0,0 +1,16 @@ +name: Node install + +on: + workflow_call: + +jobs: + setup: + name: Setup Node & cache + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Copy env + run: cp .env.example .env + + - uses: ./.github/actions/node-install diff --git a/.github/workflows/production-build.yml b/.github/workflows/production-build.yml new file mode 100644 index 000000000..e227f2aaa --- /dev/null +++ b/.github/workflows/production-build.yml @@ -0,0 +1,21 @@ +name: Production Build + +on: + workflow_call: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Copy env + run: cp .env.example .env + + - uses: ./.github/actions/node-install + + - uses: ./.github/actions/cache-build From d24b9de254062fff60162bc294ce1d23c15467ab Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:19:22 +0530 Subject: [PATCH 13/56] fix: skip install --- .github/actions/node-install/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/node-install/action.yml b/.github/actions/node-install/action.yml index 351598182..947049b62 100644 --- a/.github/actions/node-install/action.yml +++ b/.github/actions/node-install/action.yml @@ -27,6 +27,7 @@ runs: - name: Install dependencies shell: bash + if: steps.cache-npm.outputs.cache-hit != 'true' run: | npm ci npm run prisma:generate From 2bbbe1098a71fab800ea3486c2d381037e816f14 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:32:47 +0530 Subject: [PATCH 14/56] fix: action --- .github/actions/cache-build/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index 9c0b1feae..ca7550c76 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -12,11 +12,11 @@ runs: id: production-build-cache env: cache-name: prod-build - key-1: ${{ hashFiles('**/package-lock.json') }} - key-2: ${{ github.run_id }} - + key-1: ${{ inputs.node_version }}-${{ hashFiles('**/package-lock.json') }} + key-2: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', '!**/node_modules') }} + key-3: ${{ github.event.pull_request.number || github.ref }} # Ensures production-build.yml will always be fresh - key-3: ${{ github.sha }} + key-4: ${{ github.sha }} with: path: | ${{ github.workspace }}/apps/web/.next @@ -24,7 +24,7 @@ runs: **/.turbo/** **/dist/** - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }} - run: npm run build shell: bash From 634807328ed6b14c344a0f15decbe62c03157438 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:38:14 +0530 Subject: [PATCH 15/56] fix: command --- .github/actions/node-install/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/node-install/action.yml b/.github/actions/node-install/action.yml index 947049b62..351598182 100644 --- a/.github/actions/node-install/action.yml +++ b/.github/actions/node-install/action.yml @@ -27,7 +27,6 @@ runs: - name: Install dependencies shell: bash - if: steps.cache-npm.outputs.cache-hit != 'true' run: | npm ci npm run prisma:generate From 75630ef19d3329c03d85b44dd905152c00a7e072 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 01:58:00 +0530 Subject: [PATCH 16/56] fix: npm action --- .github/actions/node-install/action.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/actions/node-install/action.yml b/.github/actions/node-install/action.yml index 351598182..77483a9a4 100644 --- a/.github/actions/node-install/action.yml +++ b/.github/actions/node-install/action.yml @@ -12,23 +12,28 @@ runs: with: node-version: ${{ inputs.node_version }} - - name: Cache node modules - id: cache-npm + - name: Cache npm uses: actions/cache@v3 - env: - cache-name: cache-node-modules with: path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }} + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + + - name: Cache node_modules + uses: actions/cache@v3 + id: cache-node-modules + with: + path: | + node_modules + packages/*/node_modules + apps/*/node_modules + key: modules-${{ hashFiles('package-lock.json') }} - name: Install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' shell: bash run: | - npm ci + npm ci --no-audit npm run prisma:generate env: HUSKY: '0' From c8337d7dcc2def5bbaddf190867d946fe1a29b37 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 02:13:42 +0530 Subject: [PATCH 17/56] fix: key --- .github/actions/cache-build/action.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index ca7550c76..b903e8b07 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -10,13 +10,6 @@ runs: - name: Cache production build uses: actions/cache@v3 id: production-build-cache - env: - cache-name: prod-build - key-1: ${{ inputs.node_version }}-${{ hashFiles('**/package-lock.json') }} - key-2: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', '!**/node_modules') }} - key-3: ${{ github.event.pull_request.number || github.ref }} - # Ensures production-build.yml will always be fresh - key-4: ${{ github.sha }} with: path: | ${{ github.workspace }}/apps/web/.next @@ -24,7 +17,8 @@ runs: **/.turbo/** **/dist/** - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }} + key: prod-build-${{ github.run_id }} + restore-keys: prod-build- - run: npm run build shell: bash From 346078dbbe7672c181214821b671f2723b130d90 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 02:15:27 +0530 Subject: [PATCH 18/56] fix: e2e --- .github/actions/cache-build/action.yml | 1 - .github/workflows/e2e-tests.yml | 3 --- 2 files changed, 4 deletions(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index b903e8b07..e1eb4da22 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -22,4 +22,3 @@ runs: - run: npm run build shell: bash - if: steps.production-build-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 9d1782363..12a7d9521 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -22,9 +22,6 @@ jobs: - uses: ./.github/actions/playwright-install - - name: Generate Prisma Client - run: npm run prisma:generate -w @documenso/prisma - - name: Create the database run: npm run prisma:migrate-dev From 8eed13e27520206627cce61c5d1771b08a93fc76 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Fri, 5 Jan 2024 02:22:42 +0530 Subject: [PATCH 19/56] fix: remove additional workflow --- .github/workflows/node-install.yml | 16 ---------------- .github/workflows/production-build.yml | 21 --------------------- 2 files changed, 37 deletions(-) delete mode 100644 .github/workflows/node-install.yml delete mode 100644 .github/workflows/production-build.yml diff --git a/.github/workflows/node-install.yml b/.github/workflows/node-install.yml deleted file mode 100644 index 9b1bd52a7..000000000 --- a/.github/workflows/node-install.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Node install - -on: - workflow_call: - -jobs: - setup: - name: Setup Node & cache - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Copy env - run: cp .env.example .env - - - uses: ./.github/actions/node-install diff --git a/.github/workflows/production-build.yml b/.github/workflows/production-build.yml deleted file mode 100644 index e227f2aaa..000000000 --- a/.github/workflows/production-build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Production Build - -on: - workflow_call: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Copy env - run: cp .env.example .env - - - uses: ./.github/actions/node-install - - - uses: ./.github/actions/cache-build From 6d1ad179d4b6cca4f835cc23e4a646f6f729ec7d Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 13:30:21 +0530 Subject: [PATCH 20/56] feat: add clean cache workflow --- .github/workflows/clean-cache.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/clean-cache.yml diff --git a/.github/workflows/clean-cache.yml b/.github/workflows/clean-cache.yml new file mode 100644 index 000000000..2cb13f661 --- /dev/null +++ b/.github/workflows/clean-cache.yml @@ -0,0 +1,29 @@ +name: cleanup caches by a branch +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge From 3eb1a17d3c1be45f345967c749ea800419409d81 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 14:42:49 +0530 Subject: [PATCH 21/56] chore: force build error --- apps/web/src/app/(dashboard)/layout.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/web/src/app/(dashboard)/layout.tsx b/apps/web/src/app/(dashboard)/layout.tsx index 433aeb18c..40831549b 100644 --- a/apps/web/src/app/(dashboard)/layout.tsx +++ b/apps/web/src/app/(dashboard)/layout.tsx @@ -2,8 +2,6 @@ import React from 'react'; import { redirect } from 'next/navigation'; -import { getServerSession } from 'next-auth'; - import { LimitsProvider } from '@documenso/ee/server-only/limits/provider/server'; import { NEXT_AUTH_OPTIONS } from '@documenso/lib/next-auth/auth-options'; import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session'; From 142c93aa630c20622cfd31ae2cbd5383e2c006a6 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 14:45:44 +0530 Subject: [PATCH 22/56] chore: revert force build error --- apps/web/src/app/(dashboard)/layout.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/web/src/app/(dashboard)/layout.tsx b/apps/web/src/app/(dashboard)/layout.tsx index 40831549b..433aeb18c 100644 --- a/apps/web/src/app/(dashboard)/layout.tsx +++ b/apps/web/src/app/(dashboard)/layout.tsx @@ -2,6 +2,8 @@ import React from 'react'; import { redirect } from 'next/navigation'; +import { getServerSession } from 'next-auth'; + import { LimitsProvider } from '@documenso/ee/server-only/limits/provider/server'; import { NEXT_AUTH_OPTIONS } from '@documenso/lib/next-auth/auth-options'; import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session'; From 46e83d65bb3caaba4904d207750f9f66420ef9cd Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 15:14:28 +0530 Subject: [PATCH 23/56] feat: cache docker --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54dec497b..117064721 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,5 +37,13 @@ jobs: with: fetch-depth: 2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build Docker Image - run: ./docker/build.sh + uses: docker/build-push-action@v5 + with: + push: false + context: . + file: ./docker/Dockerfile + tags: documenso-${{ github.sha }} From ba37633ecd2a6aabce35b9250f8008d993953c74 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 15:18:09 +0530 Subject: [PATCH 24/56] fix: revert --- .github/workflows/ci.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117064721..54dec497b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,13 +37,5 @@ jobs: with: fetch-depth: 2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build Docker Image - uses: docker/build-push-action@v5 - with: - push: false - context: . - file: ./docker/Dockerfile - tags: documenso-${{ github.sha }} + run: ./docker/build.sh From 34a59d2db3324b90044594be7a2ed46b4f6d25f2 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 15:18:33 +0530 Subject: [PATCH 25/56] fix: cache --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54dec497b..117064721 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,5 +37,13 @@ jobs: with: fetch-depth: 2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build Docker Image - run: ./docker/build.sh + uses: docker/build-push-action@v5 + with: + push: false + context: . + file: ./docker/Dockerfile + tags: documenso-${{ github.sha }} From 60651407157fd93153c5ace69b3b9b8689f32c58 Mon Sep 17 00:00:00 2001 From: nafees nazik Date: Sat, 6 Jan 2024 15:29:19 +0530 Subject: [PATCH 26/56] feat: cache layers --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117064721..bebca8e85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Build Docker Image uses: docker/build-push-action@v5 with: @@ -47,3 +55,13 @@ jobs: context: . file: ./docker/Dockerfile tags: documenso-${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache From deea6b153506cfe608e41e9e6b437134d2dd39d6 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Fri, 16 Feb 2024 17:54:23 +0530 Subject: [PATCH 27/56] feat: update marketing site Signed-off-by: Adithya Krishna --- apps/marketing/src/app/(marketing)/layout.tsx | 2 ++ .../src/components/(marketing)/callout.tsx | 6 ++-- .../src/components/(marketing)/header.tsx | 9 ++++++ .../src/components/(marketing)/hero.tsx | 9 +++--- .../(marketing)/mobile-navigation.tsx | 12 +++++++- .../src/components/(marketing)/widget.tsx | 4 +-- packages/ui/primitives/announcement-bar.tsx | 30 +++++++++++++++++++ packages/ui/primitives/toggle.tsx | 3 +- 8 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 packages/ui/primitives/announcement-bar.tsx diff --git a/apps/marketing/src/app/(marketing)/layout.tsx b/apps/marketing/src/app/(marketing)/layout.tsx index dd1a46418..75baefd99 100644 --- a/apps/marketing/src/app/(marketing)/layout.tsx +++ b/apps/marketing/src/app/(marketing)/layout.tsx @@ -5,6 +5,7 @@ import React, { useEffect, useState } from 'react'; import { usePathname } from 'next/navigation'; import { cn } from '@documenso/ui/lib/utils'; +import { AnnouncementBar } from '@documenso/ui/primitives/announcement-bar'; import { Footer } from '~/components/(marketing)/footer'; import { Header } from '~/components/(marketing)/header'; @@ -38,6 +39,7 @@ export default function MarketingLayout({ children }: MarketingLayoutProps) { 'bg-background/50 backdrop-blur-md': scrollY > 5, })} > +
diff --git a/apps/marketing/src/components/(marketing)/callout.tsx b/apps/marketing/src/components/(marketing)/callout.tsx index 72ae3907b..ba801159e 100644 --- a/apps/marketing/src/components/(marketing)/callout.tsx +++ b/apps/marketing/src/components/(marketing)/callout.tsx @@ -40,9 +40,9 @@ export const Callout = ({ starCount }: CalloutProps) => { className="rounded-full bg-transparent backdrop-blur-sm" onClick={onSignUpClick} > - Get the Early Adopters Plan - - $30/mo. forever! + Claim Community Plan + + -80% diff --git a/apps/marketing/src/components/(marketing)/header.tsx b/apps/marketing/src/components/(marketing)/header.tsx index e1813f7f6..038185031 100644 --- a/apps/marketing/src/components/(marketing)/header.tsx +++ b/apps/marketing/src/components/(marketing)/header.tsx @@ -74,6 +74,15 @@ export const Header = ({ className, ...props }: HeaderProps) => { > Sign in + + + Sign up + + { className="rounded-full bg-transparent backdrop-blur-sm" onClick={onSignUpClick} > - Get the Early Adopters Plan - - $30/mo. forever! + Claim Community Plan + + -80% diff --git a/apps/marketing/src/components/(marketing)/mobile-navigation.tsx b/apps/marketing/src/components/(marketing)/mobile-navigation.tsx index 982e2967a..1c71da78a 100644 --- a/apps/marketing/src/components/(marketing)/mobile-navigation.tsx +++ b/apps/marketing/src/components/(marketing)/mobile-navigation.tsx @@ -50,6 +50,10 @@ export const MENU_NAVIGATION_LINKS = [ href: 'https://app.documenso.com/signin', text: 'Sign in', }, + { + href: 'https://app.documenso.com/signup', + text: 'Sign up', + }, ]; export const MobileNavigation = ({ isMenuOpen, onMenuOpenChange }: MobileNavigationProps) => { @@ -104,7 +108,13 @@ export const MobileNavigation = ({ isMenuOpen, onMenuOpenChange }: MobileNavigat onClick={() => handleMenuItemClick()} target={target} > - {text} + {href === 'https://app.documenso.com/signup' ? ( + + {text} + + ) : ( + text + )} ))} diff --git a/apps/marketing/src/components/(marketing)/widget.tsx b/apps/marketing/src/components/(marketing)/widget.tsx index fe7502d27..94fd95bea 100644 --- a/apps/marketing/src/components/(marketing)/widget.tsx +++ b/apps/marketing/src/components/(marketing)/widget.tsx @@ -199,7 +199,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => { className="bg-foreground/5 col-span-12 flex flex-col rounded-2xl p-6 lg:col-span-5" onSubmit={handleSubmit(onFormSubmit)} > -

Sign up for the early adopters plan

+

Sign up to Community Plan

with Timur Ercan & Lucas Smith from Documenso

@@ -220,7 +220,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => { diff --git a/packages/ui/primitives/announcement-bar.tsx b/packages/ui/primitives/announcement-bar.tsx new file mode 100644 index 000000000..46292b6bb --- /dev/null +++ b/packages/ui/primitives/announcement-bar.tsx @@ -0,0 +1,30 @@ +import Link from 'next/link'; + +interface AnnouncementBarProps { + isShown: boolean; +} + +export const AnnouncementBar: React.FC = ({ isShown }) => { + return ( + isShown && ( +
+
+ + Claim your documenso public profile URL now! + {' '} + documenso.com/u/yourname +
+ +
+
+ + Claim now + +
+
+
+ ) + ); +}; diff --git a/packages/ui/primitives/toggle.tsx b/packages/ui/primitives/toggle.tsx index 8deabffab..543d96a79 100644 --- a/packages/ui/primitives/toggle.tsx +++ b/packages/ui/primitives/toggle.tsx @@ -3,7 +3,8 @@ import * as React from 'react'; import * as TogglePrimitive from '@radix-ui/react-toggle'; -import { VariantProps, cva } from 'class-variance-authority'; +import type { VariantProps } from 'class-variance-authority'; +import { cva } from 'class-variance-authority'; import { cn } from '../lib/utils'; From 65d762dd4b85131cdb372728537522739caf85ef Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Thu, 22 Feb 2024 01:57:46 +0530 Subject: [PATCH 28/56] feat: update signin signup ui Signed-off-by: Adithya Krishna --- .../src/components/(marketing)/widget.tsx | 2 +- .../settings/public-profile/layout.tsx | 9 + .../settings/public-profile/page.tsx | 30 ++ .../settings/security/activity/page.tsx | 13 +- apps/web/src/app/(unauthenticated)/layout.tsx | 31 ++- .../src/app/(unauthenticated)/signin/page.tsx | 51 ++-- .../app/(unauthenticated)/signup-layout.tsx | 34 +++ .../src/app/(unauthenticated)/signup/page.tsx | 40 +-- .../(dashboard)/layout/new/new-header.tsx | 87 ++++++ .../layout/new/new-mobile-hamburger.tsx | 20 ++ .../layout/new/new-mobile-navigation.tsx | 151 ++++++++++ .../settings/layout/activity-back.tsx | 22 ++ .../settings/layout/desktop-nav.tsx | 15 +- .../(dashboard)/settings/layout/header.tsx | 16 +- .../settings/layout/mobile-nav.tsx | 15 +- .../src/components/forms/public-profile.tsx | 165 +++++++++++ apps/web/src/components/forms/signin.tsx | 261 +++++++++--------- .../server-only/user/get-public-profile.ts | 14 + .../server-only/user/update-public-profile.ts | 32 +++ .../migration.sql | 25 ++ packages/prisma/schema.prisma | 29 +- packages/trpc/server/profile-router/router.ts | 23 ++ packages/trpc/server/profile-router/schema.ts | 5 + packages/ui/primitives/announcement-bar.tsx | 6 +- 24 files changed, 889 insertions(+), 207 deletions(-) create mode 100644 apps/web/src/app/(dashboard)/settings/public-profile/layout.tsx create mode 100644 apps/web/src/app/(dashboard)/settings/public-profile/page.tsx create mode 100644 apps/web/src/app/(unauthenticated)/signup-layout.tsx create mode 100644 apps/web/src/components/(dashboard)/layout/new/new-header.tsx create mode 100644 apps/web/src/components/(dashboard)/layout/new/new-mobile-hamburger.tsx create mode 100644 apps/web/src/components/(dashboard)/layout/new/new-mobile-navigation.tsx create mode 100644 apps/web/src/components/(dashboard)/settings/layout/activity-back.tsx create mode 100644 apps/web/src/components/forms/public-profile.tsx create mode 100644 packages/lib/server-only/user/get-public-profile.ts create mode 100644 packages/lib/server-only/user/update-public-profile.ts create mode 100644 packages/prisma/migrations/20240220115435_add_public_profile_url_bio/migration.sql diff --git a/apps/marketing/src/components/(marketing)/widget.tsx b/apps/marketing/src/components/(marketing)/widget.tsx index 94fd95bea..88b7f47c9 100644 --- a/apps/marketing/src/components/(marketing)/widget.tsx +++ b/apps/marketing/src/components/(marketing)/widget.tsx @@ -199,7 +199,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => { className="bg-foreground/5 col-span-12 flex flex-col rounded-2xl p-6 lg:col-span-5" onSubmit={handleSubmit(onFormSubmit)} > -

Sign up to Community Plan

+

Sign up to Community Plan

with Timur Ercan & Lucas Smith from Documenso

diff --git a/apps/web/src/app/(dashboard)/settings/public-profile/layout.tsx b/apps/web/src/app/(dashboard)/settings/public-profile/layout.tsx new file mode 100644 index 000000000..bd7755cc4 --- /dev/null +++ b/apps/web/src/app/(dashboard)/settings/public-profile/layout.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +export type PublicProfileSettingsLayout = { + children: React.ReactNode; +}; + +export default function PublicProfileSettingsLayout({ children }: PublicProfileSettingsLayout) { + return
{children}
; +} diff --git a/apps/web/src/app/(dashboard)/settings/public-profile/page.tsx b/apps/web/src/app/(dashboard)/settings/public-profile/page.tsx new file mode 100644 index 000000000..ddba9386e --- /dev/null +++ b/apps/web/src/app/(dashboard)/settings/public-profile/page.tsx @@ -0,0 +1,30 @@ +import * as React from 'react'; + +import type { Metadata } from 'next'; + +import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session'; +import { Switch } from '@documenso/ui/primitives/switch'; + +import { SettingsHeader } from '~/components/(dashboard)/settings/layout/header'; +import { PublicProfileForm } from '~/components/forms/public-profile'; + +export const metadata: Metadata = { + title: 'Public Profile', +}; + +export default async function PublicProfilePage() { + const { user } = await getRequiredServerComponentSession(); + + return ( + <> + } + className="max-w-xl" + /> + + + + ); +} diff --git a/apps/web/src/app/(dashboard)/settings/security/activity/page.tsx b/apps/web/src/app/(dashboard)/settings/security/activity/page.tsx index 6e183b0c7..9f866ca49 100644 --- a/apps/web/src/app/(dashboard)/settings/security/activity/page.tsx +++ b/apps/web/src/app/(dashboard)/settings/security/activity/page.tsx @@ -1,5 +1,8 @@ import type { Metadata } from 'next'; +import { SettingsHeader } from '~/components/(dashboard)/settings/layout/header'; + +import ActivityPageBackButton from '../../../../../components/(dashboard)/settings/layout/activity-back'; import { UserSecurityActivityDataTable } from './user-security-activity-data-table'; export const metadata: Metadata = { @@ -9,11 +12,11 @@ export const metadata: Metadata = { export default function SettingsSecurityActivityPage() { return (
-

Security activity

- -

- View all recent security activity related to your account. -

+ } + />
diff --git a/apps/web/src/app/(unauthenticated)/layout.tsx b/apps/web/src/app/(unauthenticated)/layout.tsx index 43c6d291f..784135c44 100644 --- a/apps/web/src/app/(unauthenticated)/layout.tsx +++ b/apps/web/src/app/(unauthenticated)/layout.tsx @@ -3,6 +3,9 @@ import React from 'react'; import Image from 'next/image'; import backgroundPattern from '@documenso/assets/images/background-pattern.png'; +import { Card } from '@documenso/ui/primitives/card'; + +import { NewHeader } from '../../components/(dashboard)/layout/new/new-header'; type UnauthenticatedLayoutProps = { children: React.ReactNode; @@ -10,18 +13,22 @@ type UnauthenticatedLayoutProps = { export default function UnauthenticatedLayout({ children }: UnauthenticatedLayoutProps) { return ( -
-
-
- background pattern + <> + +
+
+
+ background pattern +
+ +
{children}
+
- -
{children}
-
-
+ + ); } diff --git a/apps/web/src/app/(unauthenticated)/signin/page.tsx b/apps/web/src/app/(unauthenticated)/signin/page.tsx index 50356a5bb..31baa502f 100644 --- a/apps/web/src/app/(unauthenticated)/signin/page.tsx +++ b/apps/web/src/app/(unauthenticated)/signin/page.tsx @@ -30,36 +30,31 @@ export default function SignInPage({ searchParams }: SignInPageProps) { } return ( -
-

Sign in to your account

+ <> +
+

Sign in to your account

-

- Welcome back, we are lucky to have you. -

- - - - {NEXT_PUBLIC_DISABLE_SIGNUP !== 'true' && ( -

- Don't have an account?{' '} - - Sign up - +

+ Welcome back, we are lucky to have you.

- )} -

- - Forgot your password? - -

-
+
+ + + + {process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== 'true' && ( +

+ Don't have an account?{' '} + + Sign up + +

+ )} +
+ ); } diff --git a/apps/web/src/app/(unauthenticated)/signup-layout.tsx b/apps/web/src/app/(unauthenticated)/signup-layout.tsx new file mode 100644 index 000000000..61c390d13 --- /dev/null +++ b/apps/web/src/app/(unauthenticated)/signup-layout.tsx @@ -0,0 +1,34 @@ +import React from 'react'; + +import Image from 'next/image'; + +import backgroundPattern from '@documenso/assets/images/background-pattern.png'; +import { Card } from '@documenso/ui/primitives/card'; + +import { NewHeader } from '../../components/(dashboard)/layout/new/new-header'; + +type SignUpLayoutProps = { + children: React.ReactNode; +}; + +export default function SignUpLayout({ children }: SignUpLayoutProps) { + return ( + <> + +
+
+
+ background pattern +
+ +
{children}
+
+
+
+ + ); +} diff --git a/apps/web/src/app/(unauthenticated)/signup/page.tsx b/apps/web/src/app/(unauthenticated)/signup/page.tsx index b9365e1d5..ed7477041 100644 --- a/apps/web/src/app/(unauthenticated)/signup/page.tsx +++ b/apps/web/src/app/(unauthenticated)/signup/page.tsx @@ -9,6 +9,8 @@ import { decryptSecondaryData } from '@documenso/lib/server-only/crypto/decrypt' import { SignUpForm } from '~/components/forms/signup'; +import SignUpLayout from '../signup-layout'; + export const metadata: Metadata = { title: 'Sign Up', }; @@ -34,26 +36,28 @@ export default function SignUpPage({ searchParams }: SignUpPageProps) { } return ( -
-

Create a new account

+ + <> +

Create a new account

-

- Create your account and start using state-of-the-art document signing. Open and beautiful - signing is within your grasp. -

+

+ Create your account and start using state-of-the-art document signing. Open and beautiful + signing is within your grasp. +

- + -

- Already have an account?{' '} - - Sign in instead - -

-
+

+ Already have an account?{' '} + + Sign in instead + +

+ + ); } diff --git a/apps/web/src/components/(dashboard)/layout/new/new-header.tsx b/apps/web/src/components/(dashboard)/layout/new/new-header.tsx new file mode 100644 index 000000000..66036359c --- /dev/null +++ b/apps/web/src/components/(dashboard)/layout/new/new-header.tsx @@ -0,0 +1,87 @@ +'use client'; + +import type { HTMLAttributes } from 'react'; +import { useState } from 'react'; + +import Image from 'next/image'; +import Link from 'next/link'; + +import LogoImage from '@documenso/assets/logo.png'; +import { cn } from '@documenso/ui/lib/utils'; + +import { NewHamburgerMenu } from './new-mobile-hamburger'; +import { NewMobileNavigation } from './new-mobile-navigation'; + +export type HeaderProps = HTMLAttributes; + +export const NewHeader = ({ className, ...props }: HeaderProps) => { + const [isHamburgerMenuOpen, setIsHamburgerMenuOpen] = useState(false); + + return ( +
+
+ setIsHamburgerMenuOpen(false)}> + Documenso Logo + +
+ +
+ + Pricing + + + + Blog + + + + Open Startup + + + + Sign in + + + + Sign up + + +
+ + setIsHamburgerMenuOpen((v) => !v)} + isMenuOpen={isHamburgerMenuOpen} + /> + +
+ ); +}; diff --git a/apps/web/src/components/(dashboard)/layout/new/new-mobile-hamburger.tsx b/apps/web/src/components/(dashboard)/layout/new/new-mobile-hamburger.tsx new file mode 100644 index 000000000..8b7666df4 --- /dev/null +++ b/apps/web/src/components/(dashboard)/layout/new/new-mobile-hamburger.tsx @@ -0,0 +1,20 @@ +'use client'; + +import { Menu, X } from 'lucide-react'; + +import { Button } from '@documenso/ui/primitives/button'; + +export interface HamburgerMenuProps { + isMenuOpen: boolean; + onToggleMenuOpen?: () => void; +} + +export const NewHamburgerMenu = ({ isMenuOpen, onToggleMenuOpen }: HamburgerMenuProps) => { + return ( +
+ +
+ ); +}; diff --git a/apps/web/src/components/(dashboard)/layout/new/new-mobile-navigation.tsx b/apps/web/src/components/(dashboard)/layout/new/new-mobile-navigation.tsx new file mode 100644 index 000000000..0d104eeb6 --- /dev/null +++ b/apps/web/src/components/(dashboard)/layout/new/new-mobile-navigation.tsx @@ -0,0 +1,151 @@ +'use client'; + +import Image from 'next/image'; +import Link from 'next/link'; + +import { motion, useReducedMotion } from 'framer-motion'; +import { FaXTwitter } from 'react-icons/fa6'; +import { LiaDiscord } from 'react-icons/lia'; +import { LuGithub } from 'react-icons/lu'; + +import LogoImage from '@documenso/assets/logo.png'; +import { Sheet, SheetContent } from '@documenso/ui/primitives/sheet'; + +export type MobileNavigationProps = { + isMenuOpen: boolean; + onMenuOpenChange?: (_value: boolean) => void; +}; + +export const MENU_NAVIGATION_LINKS = [ + { + href: 'https://documenso.com/singleplayer', + text: 'Singleplayer', + }, + { + href: 'https://documenso.com/blog', + text: 'Blog', + }, + { + href: 'https://documenso.com/pricing', + text: 'Pricing', + }, + { + href: 'https://documenso.com/open', + text: 'Open Startup', + }, + { + href: 'https://status.documenso.com', + text: 'Status', + }, + { + href: 'mailto:support@documenso.com', + text: 'Support', + target: '_blank', + }, + { + href: 'https://documenso.com/privacy', + text: 'Privacy', + }, + { + href: '/signin', + text: 'Sign in', + }, + { + href: '/signup', + text: 'Sign up', + }, +]; + +export const NewMobileNavigation = ({ isMenuOpen, onMenuOpenChange }: MobileNavigationProps) => { + const shouldReduceMotion = useReducedMotion(); + + const handleMenuItemClick = () => { + onMenuOpenChange?.(false); + }; + + return ( + + + + Documenso Logo + + + + {MENU_NAVIGATION_LINKS.map(({ href, text, target }) => ( + + handleMenuItemClick()} + target={target} + > + {href === 'https://app.documenso.com/signup' ? ( + + {text} + + ) : ( + text + )} + + + ))} + + +
+ + + + + + + + + + + +
+
+
+ ); +}; diff --git a/apps/web/src/components/(dashboard)/settings/layout/activity-back.tsx b/apps/web/src/components/(dashboard)/settings/layout/activity-back.tsx new file mode 100644 index 000000000..d6ab1d080 --- /dev/null +++ b/apps/web/src/components/(dashboard)/settings/layout/activity-back.tsx @@ -0,0 +1,22 @@ +'use client'; + +import { useRouter } from 'next/navigation'; + +import { Button } from '@documenso/ui/primitives/button'; + +export default function ActivityPageBackButton() { + const router = useRouter(); + return ( +
+ +
+ ); +} diff --git a/apps/web/src/components/(dashboard)/settings/layout/desktop-nav.tsx b/apps/web/src/components/(dashboard)/settings/layout/desktop-nav.tsx index e87c47b67..17147305f 100644 --- a/apps/web/src/components/(dashboard)/settings/layout/desktop-nav.tsx +++ b/apps/web/src/components/(dashboard)/settings/layout/desktop-nav.tsx @@ -5,7 +5,7 @@ import type { HTMLAttributes } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; -import { Braces, CreditCard, Lock, User, Users } from 'lucide-react'; +import { Braces, CreditCard, Globe2, Lock, User, Users } from 'lucide-react'; import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag'; import { cn } from '@documenso/ui/lib/utils'; @@ -91,6 +91,19 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => { )} + + + +
); }; diff --git a/apps/web/src/components/(dashboard)/settings/layout/header.tsx b/apps/web/src/components/(dashboard)/settings/layout/header.tsx index 3fe567b81..bc8b33507 100644 --- a/apps/web/src/components/(dashboard)/settings/layout/header.tsx +++ b/apps/web/src/components/(dashboard)/settings/layout/header.tsx @@ -1,21 +1,33 @@ import React from 'react'; +import { cn } from '@documenso/ui/lib/utils'; + export type SettingsHeaderProps = { title: string; subtitle: string; children?: React.ReactNode; + titleChildren?: React.ReactNode; + className?: string; }; -export const SettingsHeader = ({ children, title, subtitle }: SettingsHeaderProps) => { +export const SettingsHeader = ({ + children, + title, + subtitle, + titleChildren, + className, +}: SettingsHeaderProps) => { return ( <> -
+

{title}

{subtitle}

+
{titleChildren}
+ {children}
diff --git a/apps/web/src/components/(dashboard)/settings/layout/mobile-nav.tsx b/apps/web/src/components/(dashboard)/settings/layout/mobile-nav.tsx index ad5ca96f6..152eb59a6 100644 --- a/apps/web/src/components/(dashboard)/settings/layout/mobile-nav.tsx +++ b/apps/web/src/components/(dashboard)/settings/layout/mobile-nav.tsx @@ -5,7 +5,7 @@ import type { HTMLAttributes } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; -import { Braces, CreditCard, Lock, User, Users } from 'lucide-react'; +import { Braces, CreditCard, Globe2, Lock, User, Users } from 'lucide-react'; import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag'; import { cn } from '@documenso/ui/lib/utils'; @@ -94,6 +94,19 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => { )} + + + +
); }; diff --git a/apps/web/src/components/forms/public-profile.tsx b/apps/web/src/components/forms/public-profile.tsx new file mode 100644 index 000000000..5ceb2c6a5 --- /dev/null +++ b/apps/web/src/components/forms/public-profile.tsx @@ -0,0 +1,165 @@ +'use client'; + +import { useRef } from 'react'; + +import { useRouter } from 'next/navigation'; + +import { zodResolver } from '@hookform/resolvers/zod'; +import { Copy } from 'lucide-react'; +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; + +import type { User } from '@documenso/prisma/client'; +import { TRPCClientError } from '@documenso/trpc/client'; +import { trpc } from '@documenso/trpc/react'; +import { cn } from '@documenso/ui/lib/utils'; +import { Button } from '@documenso/ui/primitives/button'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@documenso/ui/primitives/form/form'; +import { Input } from '@documenso/ui/primitives/input'; +import { Textarea } from '@documenso/ui/primitives/textarea'; +import { useToast } from '@documenso/ui/primitives/use-toast'; + +export const ZPublicProfileFormSchema = z.object({ + profileURL: z.string().trim().min(1, { message: 'Please enter a valid URL slug.' }), + profileBio: z + .string() + .max(256, { message: 'Profile bio must not exceed 256 characters' }) + .optional(), +}); + +export type TPublicProfileFormSchema = z.infer; + +export type PublicProfileFormProps = { + className?: string; + user: User; +}; + +export const PublicProfileForm = ({ user, className }: PublicProfileFormProps) => { + const textRef = useRef(null); + + const { toast } = useToast(); + const router = useRouter(); + + const form = useForm({ + values: { + profileURL: user.profileURL || '', + }, + resolver: zodResolver(ZPublicProfileFormSchema), + }); + + const isSaving = form.formState.isSubmitting; + + const { mutateAsync: updatePublicProfile, data: profileURL } = + trpc.profile.updatePublicProfile.useMutation(); + + const copyTextToClipboard = async () => { + if (textRef.current) { + try { + await navigator.clipboard.writeText(textRef.current.textContent || ''); + } catch (err) { + console.log('Failed to copy: ', err); + } + } + }; + + const onFormSubmit = async ({ profileURL, profileBio }: TPublicProfileFormSchema) => { + try { + await updatePublicProfile({ + profileURL, + profileBio: profileBio || '', + }); + + toast({ + title: 'Public profile updated', + description: 'Your public profile has been updated successfully.', + duration: 5000, + }); + + router.refresh(); + } catch (err) { + if (err instanceof TRPCClientError && err.data?.code === 'BAD_REQUEST') { + toast({ + title: 'An error occurred', + description: err.message, + variant: 'destructive', + }); + } else { + toast({ + title: 'An unknown error occurred', + variant: 'destructive', + description: + 'We encountered an unknown error while attempting to save your details. Please try again later.', + }); + } + } + }; + + return ( +
+ +
+ ( + + Public profile URL + + <> + + {profileURL && ( + + + {profileURL} + + + + )} + + + + + )} + /> + + ( + + Bio + +