Compare commits
30 Commits
v1.5.0-rc.
...
v1.5.1-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
927cb1a934 | ||
|
|
579a2f96e5 | ||
|
|
70494fa5bb | ||
|
|
f6f9c301da | ||
|
|
6065140715 | ||
|
|
34a59d2db3 | ||
|
|
ba37633ecd | ||
|
|
46e83d65bb | ||
|
|
142c93aa63 | ||
|
|
3eb1a17d3c | ||
|
|
6d1ad179d4 | ||
|
|
8eed13e275 | ||
|
|
346078dbbe | ||
|
|
c8337d7dcc | ||
|
|
75630ef19d | ||
|
|
634807328e | ||
|
|
2bbbe1098a | ||
|
|
d24b9de254 | ||
|
|
c86f79dd7b | ||
|
|
0c12e34c38 | ||
|
|
26b604dbd0 | ||
|
|
308f55f3d4 | ||
|
|
e5b7bf81fa | ||
|
|
b35f050409 | ||
|
|
ce6f523230 | ||
|
|
9e57de512a | ||
|
|
9b5d64cc1a | ||
|
|
fc372d0aa9 | ||
|
|
e470020b16 | ||
|
|
0a9006430f |
24
.github/actions/cache-build/action.yml
vendored
Normal file
24
.github/actions/cache-build/action.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/apps/web/.next
|
||||||
|
${{ github.workspace }}/apps/marketing/.next
|
||||||
|
**/.turbo/**
|
||||||
|
**/dist/**
|
||||||
|
|
||||||
|
key: prod-build-${{ github.run_id }}
|
||||||
|
restore-keys: prod-build-
|
||||||
|
|
||||||
|
- run: npm run build
|
||||||
|
shell: bash
|
||||||
39
.github/actions/node-install/action.yml
vendored
Normal file
39
.github/actions/node-install/action.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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 npm
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
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 --no-audit
|
||||||
|
npm run prisma:generate
|
||||||
|
env:
|
||||||
|
HUSKY: '0'
|
||||||
19
.github/actions/playwright-install/action.yml
vendored
Normal file
19
.github/actions/playwright-install/action.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
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
|
||||||
|
shell: bash
|
||||||
44
.github/workflows/ci.yml
vendored
44
.github/workflows/ci.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
name: 'Continuous Integration'
|
name: 'Continuous Integration'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_call:
|
||||||
push:
|
push:
|
||||||
branches: ['main']
|
branches: ['main']
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -10,9 +11,6 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
|
||||||
HUSKY: 0
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_app:
|
build_app:
|
||||||
name: Build App
|
name: Build App
|
||||||
@@ -23,20 +21,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Install Node.js
|
- uses: ./.github/actions/node-install
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Copy env
|
- name: Copy env
|
||||||
run: cp .env.example .env
|
run: cp .env.example .env
|
||||||
|
|
||||||
- name: Build
|
- uses: ./.github/actions/cache-build
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
build_docker:
|
build_docker:
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
@@ -47,5 +37,31 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- 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
|
- 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 }}
|
||||||
|
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
|
||||||
|
|||||||
29
.github/workflows/clean-cache.yml
vendored
Normal file
29
.github/workflows/clean-cache.yml
vendored
Normal file
@@ -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
|
||||||
13
.github/workflows/codeql-analysis.yml
vendored
13
.github/workflows/codeql-analysis.yml
vendored
@@ -25,19 +25,12 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Copy env
|
- name: Copy env
|
||||||
run: cp .env.example .env
|
run: cp .env.example .env
|
||||||
|
|
||||||
- name: Build Documenso
|
- uses: ./.github/actions/node-install
|
||||||
run: npm run build
|
|
||||||
|
- uses: ./.github/actions/cache-build
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
|
|||||||
20
.github/workflows/e2e-tests.yml
vendored
20
.github/workflows/e2e-tests.yml
vendored
@@ -6,29 +6,21 @@ on:
|
|||||||
branches: ['main']
|
branches: ['main']
|
||||||
jobs:
|
jobs:
|
||||||
e2e_tests:
|
e2e_tests:
|
||||||
name: "E2E Tests"
|
name: 'E2E Tests'
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: npm
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Copy env
|
- name: Copy env
|
||||||
run: cp .env.example .env
|
run: cp .env.example .env
|
||||||
|
|
||||||
|
- uses: ./.github/actions/node-install
|
||||||
|
|
||||||
- name: Start Services
|
- name: Start Services
|
||||||
run: npm run dx:up
|
run: npm run dx:up
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
- uses: ./.github/actions/playwright-install
|
||||||
run: npx playwright install --with-deps
|
|
||||||
|
|
||||||
- name: Generate Prisma Client
|
|
||||||
run: npm run prisma:generate -w @documenso/prisma
|
|
||||||
|
|
||||||
- name: Create the database
|
- name: Create the database
|
||||||
run: npm run prisma:migrate-dev
|
run: npm run prisma:migrate-dev
|
||||||
@@ -36,6 +28,8 @@ jobs:
|
|||||||
- name: Seed the database
|
- name: Seed the database
|
||||||
run: npm run prisma:seed
|
run: npm run prisma:seed
|
||||||
|
|
||||||
|
- uses: ./.github/actions/cache-build
|
||||||
|
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: npm run ci
|
run: npm run ci
|
||||||
|
|
||||||
@@ -43,7 +37,7 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: "packages/app-tests/**/test-results/*"
|
path: 'packages/app-tests/**/test-results/*'
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
env:
|
env:
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ export const SinglePlayerClient = () => {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
className="hover:text-foreground/80 font-semibold transition-colors"
|
className="hover:text-foreground/80 font-semibold transition-colors"
|
||||||
>
|
>
|
||||||
community plan
|
early adopter plan
|
||||||
</Link>{' '}
|
</Link>{' '}
|
||||||
for exclusive features, including the ability to collaborate with multiple signers.
|
for exclusive features, including the ability to collaborate with multiple signers.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const Callout = ({ starCount }: CalloutProps) => {
|
|||||||
className="rounded-full bg-transparent backdrop-blur-sm"
|
className="rounded-full bg-transparent backdrop-blur-sm"
|
||||||
onClick={onSignUpClick}
|
onClick={onSignUpClick}
|
||||||
>
|
>
|
||||||
Claim Community Plan
|
Claim Early Adopter Plan
|
||||||
<span className="bg-primary dark:text-background -mr-2.5 ml-2.5 rounded-full px-2 py-1.5 text-xs font-medium">
|
<span className="bg-primary dark:text-background -mr-2.5 ml-2.5 rounded-full px-2 py-1.5 text-xs font-medium">
|
||||||
$30/mo
|
$30/mo
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export const Hero = ({ className, ...props }: HeroProps) => {
|
|||||||
className="rounded-full bg-transparent backdrop-blur-sm"
|
className="rounded-full bg-transparent backdrop-blur-sm"
|
||||||
onClick={onSignUpClick}
|
onClick={onSignUpClick}
|
||||||
>
|
>
|
||||||
Claim Community Plan
|
Claim Early Adopter Plan
|
||||||
<span className="bg-primary dark:text-background -mr-2.5 ml-2.5 rounded-full px-2 py-1.5 text-xs font-medium">
|
<span className="bg-primary dark:text-background -mr-2.5 ml-2.5 rounded-full px-2 py-1.5 text-xs font-medium">
|
||||||
$30/mo
|
$30/mo
|
||||||
</span>
|
</span>
|
||||||
@@ -225,7 +225,8 @@ export const Hero = ({ className, ...props }: HeroProps) => {
|
|||||||
<span className="bg-primary text-black">
|
<span className="bg-primary text-black">
|
||||||
(in a non-legally binding, but heartfelt way)
|
(in a non-legally binding, but heartfelt way)
|
||||||
</span>{' '}
|
</span>{' '}
|
||||||
and lock in the community plan for forever, including everything we build this year.
|
and lock in the early adopter plan for forever, including everything we build this
|
||||||
|
year.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="flex h-24 items-center">
|
<div className="flex h-24 items-center">
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
data-plan="community"
|
data-plan="early-adopter"
|
||||||
className="border-primary bg-background shadow-foreground/5 flex flex-col items-center justify-center rounded-lg border-2 px-8 py-12 shadow-[0px_0px_0px_4px_#E3E3E380]"
|
className="border-primary bg-background shadow-foreground/5 flex flex-col items-center justify-center rounded-lg border-2 px-8 py-12 shadow-[0px_0px_0px_4px_#E3E3E380]"
|
||||||
>
|
>
|
||||||
<p className="text-foreground text-4xl font-medium">Early Adopters</p>
|
<p className="text-foreground text-4xl font-medium">Early Adopters</p>
|
||||||
@@ -119,7 +119,7 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {
|
|||||||
|
|
||||||
<Button className="mt-6 rounded-full text-base" asChild>
|
<Button className="mt-6 rounded-full text-base" asChild>
|
||||||
<Link
|
<Link
|
||||||
href={`${NEXT_PUBLIC_WEBAPP_URL()}/signup?utm_source=pricing-community`}
|
href={`${NEXT_PUBLIC_WEBAPP_URL()}/signup?utm_source=pricing-early-adopter`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
Signup Now
|
Signup Now
|
||||||
|
|||||||
@@ -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"
|
className="bg-foreground/5 col-span-12 flex flex-col rounded-2xl p-6 lg:col-span-5"
|
||||||
onSubmit={handleSubmit(onFormSubmit)}
|
onSubmit={handleSubmit(onFormSubmit)}
|
||||||
>
|
>
|
||||||
<h3 className="text-xl font-semibold">Sign up to Community Plan</h3>
|
<h3 className="text-xl font-semibold">Sign up to Early Adopter Plan</h3>
|
||||||
<p className="text-muted-foreground mt-2 text-xs">
|
<p className="text-muted-foreground mt-2 text-xs">
|
||||||
with Timur Ercan & Lucas Smith from Documenso
|
with Timur Ercan & Lucas Smith from Documenso
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default async function TeamsSettingBillingPage({ params }: TeamsSettingsB
|
|||||||
<CardContent className="flex flex-row items-center justify-between p-4">
|
<CardContent className="flex flex-row items-center justify-between p-4">
|
||||||
<div className="flex flex-col text-sm">
|
<div className="flex flex-col text-sm">
|
||||||
<p className="text-foreground font-semibold">
|
<p className="text-foreground font-semibold">
|
||||||
Current plan: {teamSubscription ? 'Team' : 'Community Team'}
|
Current plan: {teamSubscription ? 'Team' : 'Early Adopter Team'}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p className="text-muted-foreground mt-0.5">
|
<p className="text-muted-foreground mt-0.5">
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { useParams } from 'next/navigation';
|
|||||||
|
|
||||||
import { MenuIcon, SearchIcon } from 'lucide-react';
|
import { MenuIcon, SearchIcon } from 'lucide-react';
|
||||||
|
|
||||||
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
|
|
||||||
import type { GetTeamsResponse } from '@documenso/lib/server-only/team/get-teams';
|
import type { GetTeamsResponse } from '@documenso/lib/server-only/team/get-teams';
|
||||||
import { getRootHref } from '@documenso/lib/utils/params';
|
import { getRootHref } from '@documenso/lib/utils/params';
|
||||||
import type { User } from '@documenso/prisma/client';
|
import type { User } from '@documenso/prisma/client';
|
||||||
@@ -19,7 +18,6 @@ import { CommandMenu } from '../common/command-menu';
|
|||||||
import { DesktopNav } from './desktop-nav';
|
import { DesktopNav } from './desktop-nav';
|
||||||
import { MenuSwitcher } from './menu-switcher';
|
import { MenuSwitcher } from './menu-switcher';
|
||||||
import { MobileNavigation } from './mobile-navigation';
|
import { MobileNavigation } from './mobile-navigation';
|
||||||
import { ProfileDropdown } from './profile-dropdown';
|
|
||||||
|
|
||||||
export type HeaderProps = HTMLAttributes<HTMLDivElement> & {
|
export type HeaderProps = HTMLAttributes<HTMLDivElement> & {
|
||||||
user: User;
|
user: User;
|
||||||
@@ -29,10 +27,6 @@ export type HeaderProps = HTMLAttributes<HTMLDivElement> & {
|
|||||||
export const Header = ({ className, user, teams, ...props }: HeaderProps) => {
|
export const Header = ({ className, user, teams, ...props }: HeaderProps) => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
||||||
const { getFlag } = useFeatureFlags();
|
|
||||||
|
|
||||||
const isTeamsEnabled = getFlag('app_teams');
|
|
||||||
|
|
||||||
const [isCommandMenuOpen, setIsCommandMenuOpen] = useState(false);
|
const [isCommandMenuOpen, setIsCommandMenuOpen] = useState(false);
|
||||||
const [isHamburgerMenuOpen, setIsHamburgerMenuOpen] = useState(false);
|
const [isHamburgerMenuOpen, setIsHamburgerMenuOpen] = useState(false);
|
||||||
const [scrollY, setScrollY] = useState(0);
|
const [scrollY, setScrollY] = useState(0);
|
||||||
@@ -47,34 +41,6 @@ export const Header = ({ className, user, teams, ...props }: HeaderProps) => {
|
|||||||
return () => window.removeEventListener('scroll', onScroll);
|
return () => window.removeEventListener('scroll', onScroll);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (!isTeamsEnabled) {
|
|
||||||
return (
|
|
||||||
<header
|
|
||||||
className={cn(
|
|
||||||
'supports-backdrop-blur:bg-background/60 bg-background/95 sticky top-0 z-[60] flex h-16 w-full items-center border-b border-b-transparent backdrop-blur duration-200',
|
|
||||||
scrollY > 5 && 'border-b-border',
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<div className="mx-auto flex w-full max-w-screen-xl items-center justify-between gap-x-4 px-4 md:justify-normal md:px-8">
|
|
||||||
<Link
|
|
||||||
href="/"
|
|
||||||
className="focus-visible:ring-ring ring-offset-background rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
|
|
||||||
>
|
|
||||||
<Logo className="h-6 w-auto" />
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
<DesktopNav />
|
|
||||||
|
|
||||||
<div className="flex gap-x-4 md:ml-8">
|
|
||||||
<ProfileDropdown user={user} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header
|
<header
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
@@ -1,177 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import Link from 'next/link';
|
|
||||||
|
|
||||||
import {
|
|
||||||
Braces,
|
|
||||||
CreditCard,
|
|
||||||
FileSpreadsheet,
|
|
||||||
Lock,
|
|
||||||
LogOut,
|
|
||||||
User as LucideUser,
|
|
||||||
Monitor,
|
|
||||||
Moon,
|
|
||||||
Palette,
|
|
||||||
Sun,
|
|
||||||
UserCog,
|
|
||||||
} from 'lucide-react';
|
|
||||||
import { signOut } from 'next-auth/react';
|
|
||||||
import { useTheme } from 'next-themes';
|
|
||||||
import { LuGithub } from 'react-icons/lu';
|
|
||||||
|
|
||||||
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
|
|
||||||
import { isAdmin } from '@documenso/lib/next-auth/guards/is-admin';
|
|
||||||
import { extractInitials } from '@documenso/lib/utils/recipient-formatter';
|
|
||||||
import type { User } from '@documenso/prisma/client';
|
|
||||||
import { Avatar, AvatarFallback } from '@documenso/ui/primitives/avatar';
|
|
||||||
import { Button } from '@documenso/ui/primitives/button';
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuPortal,
|
|
||||||
DropdownMenuRadioGroup,
|
|
||||||
DropdownMenuRadioItem,
|
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuSub,
|
|
||||||
DropdownMenuSubContent,
|
|
||||||
DropdownMenuSubTrigger,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from '@documenso/ui/primitives/dropdown-menu';
|
|
||||||
|
|
||||||
export type ProfileDropdownProps = {
|
|
||||||
user: User;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ProfileDropdown = ({ user }: ProfileDropdownProps) => {
|
|
||||||
const { getFlag } = useFeatureFlags();
|
|
||||||
const { theme, setTheme } = useTheme();
|
|
||||||
const isUserAdmin = isAdmin(user);
|
|
||||||
|
|
||||||
const isBillingEnabled = getFlag('app_billing');
|
|
||||||
|
|
||||||
const avatarFallback = user.name
|
|
||||||
? extractInitials(user.name)
|
|
||||||
: user.email.slice(0, 1).toUpperCase();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
title="Profile Dropdown"
|
|
||||||
className="relative h-10 w-10 rounded-full"
|
|
||||||
>
|
|
||||||
<Avatar className="h-10 w-10">
|
|
||||||
<AvatarFallback>{avatarFallback}</AvatarFallback>
|
|
||||||
</Avatar>
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
|
|
||||||
<DropdownMenuContent className="z-[60] w-56" align="end" forceMount>
|
|
||||||
<DropdownMenuLabel>Account</DropdownMenuLabel>
|
|
||||||
|
|
||||||
{isUserAdmin && (
|
|
||||||
<>
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/admin" className="cursor-pointer">
|
|
||||||
<UserCog className="mr-2 h-4 w-4" />
|
|
||||||
Admin
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/settings/profile" className="cursor-pointer">
|
|
||||||
<LucideUser className="mr-2 h-4 w-4" />
|
|
||||||
Profile
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/settings/security" className="cursor-pointer">
|
|
||||||
<Lock className="mr-2 h-4 w-4" />
|
|
||||||
Security
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/settings/tokens" className="cursor-pointer">
|
|
||||||
<Braces className="mr-2 h-4 w-4" />
|
|
||||||
API Tokens
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
{isBillingEnabled && (
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/settings/billing" className="cursor-pointer">
|
|
||||||
<CreditCard className="mr-2 h-4 w-4" />
|
|
||||||
Billing
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link href="/templates" className="cursor-pointer">
|
|
||||||
<FileSpreadsheet className="mr-2 h-4 w-4" />
|
|
||||||
Templates
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
|
|
||||||
<DropdownMenuSub>
|
|
||||||
<DropdownMenuSubTrigger>
|
|
||||||
<Palette className="mr-2 h-4 w-4" />
|
|
||||||
Themes
|
|
||||||
</DropdownMenuSubTrigger>
|
|
||||||
<DropdownMenuPortal>
|
|
||||||
<DropdownMenuSubContent className="z-[60]">
|
|
||||||
<DropdownMenuRadioGroup value={theme} onValueChange={setTheme}>
|
|
||||||
<DropdownMenuRadioItem value="light">
|
|
||||||
<Sun className="mr-2 h-4 w-4" /> Light
|
|
||||||
</DropdownMenuRadioItem>
|
|
||||||
<DropdownMenuRadioItem value="dark">
|
|
||||||
<Moon className="mr-2 h-4 w-4" />
|
|
||||||
Dark
|
|
||||||
</DropdownMenuRadioItem>
|
|
||||||
<DropdownMenuRadioItem value="system">
|
|
||||||
<Monitor className="mr-2 h-4 w-4" />
|
|
||||||
System
|
|
||||||
</DropdownMenuRadioItem>
|
|
||||||
</DropdownMenuRadioGroup>
|
|
||||||
</DropdownMenuSubContent>
|
|
||||||
</DropdownMenuPortal>
|
|
||||||
</DropdownMenuSub>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
<DropdownMenuItem asChild>
|
|
||||||
<Link
|
|
||||||
href="https://github.com/documenso/documenso"
|
|
||||||
className="cursor-pointer"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<LuGithub className="mr-2 h-4 w-4" />
|
|
||||||
Star on Github
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
|
|
||||||
<DropdownMenuItem
|
|
||||||
onSelect={() =>
|
|
||||||
void signOut({
|
|
||||||
callbackUrl: '/',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<LogOut className="mr-2 h-4 w-4" />
|
|
||||||
Sign Out
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -19,7 +19,6 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
|
|||||||
const { getFlag } = useFeatureFlags();
|
const { getFlag } = useFeatureFlags();
|
||||||
|
|
||||||
const isBillingEnabled = getFlag('app_billing');
|
const isBillingEnabled = getFlag('app_billing');
|
||||||
const isTeamsEnabled = getFlag('app_teams');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex flex-col gap-y-2', className)} {...props}>
|
<div className={cn('flex flex-col gap-y-2', className)} {...props}>
|
||||||
@@ -36,20 +35,18 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{isTeamsEnabled && (
|
<Link href="/settings/teams">
|
||||||
<Link href="/settings/teams">
|
<Button
|
||||||
<Button
|
variant="ghost"
|
||||||
variant="ghost"
|
className={cn(
|
||||||
className={cn(
|
'w-full justify-start',
|
||||||
'w-full justify-start',
|
pathname?.startsWith('/settings/teams') && 'bg-secondary',
|
||||||
pathname?.startsWith('/settings/teams') && 'bg-secondary',
|
)}
|
||||||
)}
|
>
|
||||||
>
|
<Users className="mr-2 h-5 w-5" />
|
||||||
<Users className="mr-2 h-5 w-5" />
|
Teams
|
||||||
Teams
|
</Button>
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Link href="/settings/security">
|
<Link href="/settings/security">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => {
|
|||||||
const { getFlag } = useFeatureFlags();
|
const { getFlag } = useFeatureFlags();
|
||||||
|
|
||||||
const isBillingEnabled = getFlag('app_billing');
|
const isBillingEnabled = getFlag('app_billing');
|
||||||
const isTeamsEnabled = getFlag('app_teams');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -39,20 +38,18 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{isTeamsEnabled && (
|
<Link href="/settings/teams">
|
||||||
<Link href="/settings/teams">
|
<Button
|
||||||
<Button
|
variant="ghost"
|
||||||
variant="ghost"
|
className={cn(
|
||||||
className={cn(
|
'w-full justify-start',
|
||||||
'w-full justify-start',
|
pathname?.startsWith('/settings/teams') && 'bg-secondary',
|
||||||
pathname?.startsWith('/settings/teams') && 'bg-secondary',
|
)}
|
||||||
)}
|
>
|
||||||
>
|
<Users className="mr-2 h-5 w-5" />
|
||||||
<Users className="mr-2 h-5 w-5" />
|
Teams
|
||||||
Teams
|
</Button>
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Link href="/settings/security">
|
<Link href="/settings/security">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"dx": "npm i && npm run dx:up && npm run prisma:migrate-dev",
|
"dx": "npm i && npm run dx:up && npm run prisma:migrate-dev",
|
||||||
"dx:up": "docker compose -f docker/compose-services.yml up -d",
|
"dx:up": "docker compose -f docker/compose-services.yml up -d",
|
||||||
"dx:down": "docker compose -f docker/compose-services.yml down",
|
"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: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-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",
|
"prisma:migrate-deploy": "npm run with:env -- npm run prisma:migrate-deploy -w @documenso/prisma",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type TransferStripeSubscriptionOptions = {
|
|||||||
* Will create a new subscription for the new owner and cancel the old one.
|
* Will create a new subscription for the new owner and cancel the old one.
|
||||||
*
|
*
|
||||||
* Returns the subscription that should be associated with the team, null if
|
* Returns the subscription that should be associated with the team, null if
|
||||||
* no subscription is needed (for community plan).
|
* no subscription is needed (for early adopter plan).
|
||||||
*/
|
*/
|
||||||
export const transferTeamSubscription = async ({
|
export const transferTeamSubscription = async ({
|
||||||
user,
|
user,
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ export const downloadPDF = async ({ documentData, fileName }: DownloadPDFProps)
|
|||||||
type: 'application/pdf',
|
type: 'application/pdf',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [baseTitle] = fileName?.includes('.pdf')
|
const baseTitle = (fileName ?? 'document').replace(/\.pdf$/, '');
|
||||||
? fileName.split('.pdf')
|
|
||||||
: [fileName ?? 'document'];
|
|
||||||
|
|
||||||
downloadFile({
|
downloadFile({
|
||||||
filename: baseTitle,
|
filename: `${baseTitle}.pdf`,
|
||||||
data: blob,
|
data: blob,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const FEATURE_FLAG_POLL_INTERVAL = 30000;
|
|||||||
*/
|
*/
|
||||||
export const LOCAL_FEATURE_FLAGS: Record<string, boolean> = {
|
export const LOCAL_FEATURE_FLAGS: Record<string, boolean> = {
|
||||||
app_billing: NEXT_PUBLIC_FEATURE_BILLING_ENABLED() === 'true',
|
app_billing: NEXT_PUBLIC_FEATURE_BILLING_ENABLED() === 'true',
|
||||||
app_teams: true,
|
|
||||||
app_document_page_view_history_sheet: false,
|
app_document_page_view_history_sheet: false,
|
||||||
marketing_header_single_player_mode: false,
|
marketing_header_single_player_mode: false,
|
||||||
marketing_profiles_announcement_bar: true,
|
marketing_profiles_announcement_bar: true,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
import type { QueryClientConfig } from '@tanstack/react-query';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { httpBatchLink } from '@trpc/client';
|
import { httpBatchLink } from '@trpc/client';
|
||||||
import { createTRPCReact } from '@trpc/react-query';
|
import { createTRPCReact } from '@trpc/react-query';
|
||||||
@@ -27,7 +28,27 @@ export interface TrpcProviderProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function TrpcProvider({ children }: TrpcProviderProps) {
|
export function TrpcProvider({ children }: TrpcProviderProps) {
|
||||||
const [queryClient] = useState(() => new QueryClient());
|
let queryClientConfig: QueryClientConfig | undefined;
|
||||||
|
|
||||||
|
const isDevelopingOffline =
|
||||||
|
typeof window !== 'undefined' &&
|
||||||
|
window.location.hostname === 'localhost' &&
|
||||||
|
!window.navigator.onLine;
|
||||||
|
|
||||||
|
if (isDevelopingOffline) {
|
||||||
|
queryClientConfig = {
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
networkMode: 'always',
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
networkMode: 'always',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const [queryClient] = useState(() => new QueryClient(queryClientConfig));
|
||||||
|
|
||||||
const [trpcClient] = useState(() =>
|
const [trpcClient] = useState(() =>
|
||||||
trpc.createClient({
|
trpc.createClient({
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
"cache": false
|
"cache": false
|
||||||
},
|
},
|
||||||
"test:e2e": {
|
"test:e2e": {
|
||||||
"dependsOn": ["^build"]
|
"dependsOn": ["^build"],
|
||||||
|
"cache": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globalDependencies": ["**/.env.*local"],
|
"globalDependencies": ["**/.env.*local"],
|
||||||
|
|||||||
Reference in New Issue
Block a user