diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ed6ecc0ac..455860ea1 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,6 +5,7 @@ module.exports = { rules: { '@next/next/no-img-element': 'off', 'no-unreachable': 'error', + 'react-hooks/exhaustive-deps': 'off', }, settings: { next: { diff --git a/apps/remix/.bin/build.sh b/apps/remix/.bin/build.sh new file mode 100755 index 000000000..37c5df64c --- /dev/null +++ b/apps/remix/.bin/build.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Exit on error. +set -eo pipefail + +cd "$(dirname "$0")/.." + +start_time=$(date +%s) + +echo "[Build]: Extracting and compiling translations" +npm run translate --prefix ../../ + +echo "[Build]: Building app" +npm run build:app + +echo "[Build]: Building server" +npm run build:server + +# Copy over the entry point for the server. +cp server/main.js build/server/main.js + +# Copy over all web.js translations +cp -r ../../packages/lib/translations build/server/hono/packages/lib/translations + +# Time taken +end_time=$(date +%s) + +echo "[Build]: Done in $((end_time - start_time)) seconds" diff --git a/apps/remix/.dockerignore b/apps/remix/.dockerignore new file mode 100644 index 000000000..9b8d51471 --- /dev/null +++ b/apps/remix/.dockerignore @@ -0,0 +1,4 @@ +.react-router +build +node_modules +README.md \ No newline at end of file diff --git a/apps/remix/.gitignore b/apps/remix/.gitignore new file mode 100644 index 000000000..188507428 --- /dev/null +++ b/apps/remix/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/node_modules/ + +# React Router +/.react-router/ +/build/ + +# Vite +vite.config.*.timestamp* \ No newline at end of file diff --git a/apps/remix/Dockerfile b/apps/remix/Dockerfile new file mode 100644 index 000000000..207bf937e --- /dev/null +++ b/apps/remix/Dockerfile @@ -0,0 +1,22 @@ +FROM node:20-alpine AS development-dependencies-env +COPY . /app +WORKDIR /app +RUN npm ci + +FROM node:20-alpine AS production-dependencies-env +COPY ./package.json package-lock.json /app/ +WORKDIR /app +RUN npm ci --omit=dev + +FROM node:20-alpine AS build-env +COPY . /app/ +COPY --from=development-dependencies-env /app/node_modules /app/node_modules +WORKDIR /app +RUN npm run build + +FROM node:20-alpine +COPY ./package.json package-lock.json /app/ +COPY --from=production-dependencies-env /app/node_modules /app/node_modules +COPY --from=build-env /app/build /app/build +WORKDIR /app +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/apps/remix/Dockerfile.bun b/apps/remix/Dockerfile.bun new file mode 100644 index 000000000..973038e8a --- /dev/null +++ b/apps/remix/Dockerfile.bun @@ -0,0 +1,25 @@ +FROM oven/bun:1 AS dependencies-env +COPY . /app + +FROM dependencies-env AS development-dependencies-env +COPY ./package.json bun.lockb /app/ +WORKDIR /app +RUN bun i --frozen-lockfile + +FROM dependencies-env AS production-dependencies-env +COPY ./package.json bun.lockb /app/ +WORKDIR /app +RUN bun i --production + +FROM dependencies-env AS build-env +COPY ./package.json bun.lockb /app/ +COPY --from=development-dependencies-env /app/node_modules /app/node_modules +WORKDIR /app +RUN bun run build + +FROM dependencies-env +COPY ./package.json bun.lockb /app/ +COPY --from=production-dependencies-env /app/node_modules /app/node_modules +COPY --from=build-env /app/build /app/build +WORKDIR /app +CMD ["bun", "run", "start"] \ No newline at end of file diff --git a/apps/remix/Dockerfile.pnpm b/apps/remix/Dockerfile.pnpm new file mode 100644 index 000000000..57916afc2 --- /dev/null +++ b/apps/remix/Dockerfile.pnpm @@ -0,0 +1,26 @@ +FROM node:20-alpine AS dependencies-env +RUN npm i -g pnpm +COPY . /app + +FROM dependencies-env AS development-dependencies-env +COPY ./package.json pnpm-lock.yaml /app/ +WORKDIR /app +RUN pnpm i --frozen-lockfile + +FROM dependencies-env AS production-dependencies-env +COPY ./package.json pnpm-lock.yaml /app/ +WORKDIR /app +RUN pnpm i --prod --frozen-lockfile + +FROM dependencies-env AS build-env +COPY ./package.json pnpm-lock.yaml /app/ +COPY --from=development-dependencies-env /app/node_modules /app/node_modules +WORKDIR /app +RUN pnpm build + +FROM dependencies-env +COPY ./package.json pnpm-lock.yaml /app/ +COPY --from=production-dependencies-env /app/node_modules /app/node_modules +COPY --from=build-env /app/build /app/build +WORKDIR /app +CMD ["pnpm", "start"] \ No newline at end of file diff --git a/apps/remix/README.md b/apps/remix/README.md new file mode 100644 index 000000000..e0d20664e --- /dev/null +++ b/apps/remix/README.md @@ -0,0 +1,100 @@ +# Welcome to React Router! + +A modern, production-ready template for building full-stack React applications using React Router. + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default) + +## Features + +- 🚀 Server-side rendering +- ⚡️ Hot Module Replacement (HMR) +- 📦 Asset bundling and optimization +- 🔄 Data loading and mutations +- 🔒 TypeScript by default +- 🎉 TailwindCSS for styling +- 📖 [React Router docs](https://reactrouter.com/) + +## Getting Started + +### Installation + +Install the dependencies: + +```bash +npm install +``` + +### Development + +Start the development server with HMR: + +```bash +npm run dev +``` + +Your application will be available at `http://localhost:5173`. + +## Building for Production + +Create a production build: + +```bash +npm run build +``` + +## Deployment + +### Docker Deployment + +This template includes three Dockerfiles optimized for different package managers: + +- `Dockerfile` - for npm +- `Dockerfile.pnpm` - for pnpm +- `Dockerfile.bun` - for bun + +To build and run using Docker: + +```bash +# For npm +docker build -t my-app . + +# For pnpm +docker build -f Dockerfile.pnpm -t my-app . + +# For bun +docker build -f Dockerfile.bun -t my-app . + +# Run the container +docker run -p 3000:3000 my-app +``` + +The containerized application can be deployed to any platform that supports Docker, including: + +- AWS ECS +- Google Cloud Run +- Azure Container Apps +- Digital Ocean App Platform +- Fly.io +- Railway + +### DIY Deployment + +If you're familiar with deploying Node applications, the built-in app server is production-ready. + +Make sure to deploy the output of `npm run build` + +``` +├── package.json +├── package-lock.json (or pnpm-lock.yaml, or bun.lockb) +├── build/ +│ ├── client/ # Static assets +│ └── server/ # Server-side code +``` + +## Styling + +This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer. + +--- + +Built with ❤️ using React Router. diff --git a/apps/remix/app/app.css b/apps/remix/app/app.css new file mode 100644 index 000000000..529edec77 --- /dev/null +++ b/apps/remix/app/app.css @@ -0,0 +1,24 @@ +@import '@documenso/ui/styles/theme.css'; + +@font-face { + font-family: 'Inter'; + src: url('/public/fonts/inter-regular.ttf') format('ttf'); + /* font-weight: 400; + font-style: normal; + font-display: swap; */ +} + +@font-face { + font-family: 'Caveat'; + src: url('/public/fonts/caveat.ttf') format('ttf'); + /* font-weight: 400; + font-style: normal; + font-display: swap; */ +} + +@layer base { + :root { + --font-sans: 'Inter'; + --font-signature: 'Caveat'; + } +} diff --git a/apps/web/src/app/(dashboard)/settings/profile/delete-account-dialog.tsx b/apps/remix/app/components/dialogs/account-delete-dialog.tsx similarity index 91% rename from apps/web/src/app/(dashboard)/settings/profile/delete-account-dialog.tsx rename to apps/remix/app/components/dialogs/account-delete-dialog.tsx index 2bb37e57b..5c528dfc4 100644 --- a/apps/web/src/app/(dashboard)/settings/profile/delete-account-dialog.tsx +++ b/apps/remix/app/components/dialogs/account-delete-dialog.tsx @@ -1,12 +1,11 @@ -'use client'; - import { useState } from 'react'; -import { Trans, msg } from '@lingui/macro'; +import { msg } from '@lingui/core/macro'; import { useLingui } from '@lingui/react'; -import { signOut } from 'next-auth/react'; +import { Trans } from '@lingui/react/macro'; -import type { User } from '@documenso/prisma/client'; +import { authClient } from '@documenso/auth/client'; +import { useSession } from '@documenso/lib/client-only/providers/session'; import { trpc } from '@documenso/trpc/react'; import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert'; import { Button } from '@documenso/ui/primitives/button'; @@ -23,12 +22,13 @@ import { Input } from '@documenso/ui/primitives/input'; import { Label } from '@documenso/ui/primitives/label'; import { useToast } from '@documenso/ui/primitives/use-toast'; -export type DeleteAccountDialogProps = { +export type AccountDeleteDialogProps = { className?: string; - user: User; }; -export const DeleteAccountDialog = ({ className, user }: DeleteAccountDialogProps) => { +export const AccountDeleteDialog = ({ className }: AccountDeleteDialogProps) => { + const { user } = useSession(); + const { _ } = useLingui(); const { toast } = useToast(); @@ -49,7 +49,7 @@ export const DeleteAccountDialog = ({ className, user }: DeleteAccountDialogProp duration: 5000, }); - return await signOut({ callbackUrl: '/' }); + return await authClient.signOut(); } catch (err) { toast({ title: _(msg`An unknown error occurred`), @@ -118,7 +118,7 @@ export const DeleteAccountDialog = ({ className, user }: DeleteAccountDialogProp {!hasTwoFactorAuthentication && ( -
+