Skip to content

Commit 4ffa5ac

Browse files
committed
feat: admin react-router migration
1 parent 71ec9fa commit 4ffa5ac

File tree

137 files changed

+2985
-1769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2985
-1769
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ temp/
6666
.react-router/
6767
build/
6868
node_modules/
69-
README.md
69+
README.md

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ dev-editor
102102
storybook-static
103103

104104
CLAUDE.md
105+
106+
build/
107+
.react-router/

apps/admin/.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# React Router - https://github.com/remix-run/react-router-templates/blob/dc79b1a065f59f3bfd840d4ef75cc27689b611e6/default/.dockerignore
2+
.react-router/
3+
build/
4+
node_modules/
5+
README.md

apps/admin/.eslintrc.cjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
root: true,
3+
extends: ["@plane/eslint-config/next.js"],
4+
ignorePatterns: [
5+
"build/**",
6+
"dist/**",
7+
".vite/**",
8+
],
9+
rules: {
10+
"no-duplicate-imports": "off",
11+
"import/no-duplicates": ["error", {"prefer-inline": false}],
12+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
13+
"@typescript-eslint/no-import-type-side-effects": "error",
14+
"@typescript-eslint/consistent-type-imports": [
15+
"error",
16+
{
17+
prefer: "type-imports",
18+
fixStyle: "separate-type-imports",
19+
disallowTypeAnnotations: false,
20+
},
21+
],
22+
},
23+
};
24+
25+

apps/admin/.eslintrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

apps/admin/Dockerfile.admin

Lines changed: 47 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,86 @@
1-
# syntax=docker/dockerfile:1.7
21
FROM node:22-alpine AS base
32

4-
# Setup pnpm package manager with corepack and configure global bin directory for caching
3+
WORKDIR /app
4+
5+
ENV TURBO_TELEMETRY_DISABLED=1
56
ENV PNPM_HOME="/pnpm"
67
ENV PATH="$PNPM_HOME:$PATH"
7-
RUN corepack enable
8+
ENV CI=1
9+
10+
RUN corepack enable pnpm
11+
12+
# =========================================================================== #
813

9-
# *****************************************************************************
10-
# STAGE 1: Build the project
11-
# *****************************************************************************
1214
FROM base AS builder
13-
RUN apk add --no-cache libc6-compat
14-
WORKDIR /app
1515

16-
ARG TURBO_VERSION=2.5.6
17-
RUN corepack enable pnpm && pnpm add -g turbo@${TURBO_VERSION}
16+
RUN pnpm add -g turbo@2.5.8
17+
1818
COPY . .
1919

20+
# Create a pruned workspace for just the admin app
2021
RUN turbo prune --scope=admin --docker
2122

22-
# *****************************************************************************
23-
# STAGE 2: Install dependencies & build the project
24-
# *****************************************************************************
25-
FROM base AS installer
26-
27-
RUN apk add --no-cache libc6-compat
28-
WORKDIR /app
23+
# =========================================================================== #
2924

30-
COPY .gitignore .gitignore
31-
COPY --from=builder /app/out/json/ .
32-
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
33-
RUN corepack enable pnpm
34-
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store
25+
FROM base AS installer
3526

36-
COPY --from=builder /app/out/full/ .
37-
COPY turbo.json turbo.json
38-
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store
27+
# Build in production mode; we still install dev deps explicitly below
28+
ENV NODE_ENV=production
3929

30+
# Public envs required at build time (pick up via process.env)
4031
ARG NEXT_PUBLIC_API_BASE_URL=""
4132
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
33+
ARG NEXT_PUBLIC_API_BASE_PATH="/api"
34+
ENV NEXT_PUBLIC_API_BASE_PATH=$NEXT_PUBLIC_API_BASE_PATH
4235

4336
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
4437
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
45-
4638
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
4739
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
4840

4941
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
5042
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
51-
5243
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
5344
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
5445

46+
ARG NEXT_PUBLIC_LIVE_BASE_URL=""
47+
ENV NEXT_PUBLIC_LIVE_BASE_URL=$NEXT_PUBLIC_LIVE_BASE_URL
48+
ARG NEXT_PUBLIC_LIVE_BASE_PATH="/live"
49+
ENV NEXT_PUBLIC_LIVE_BASE_PATH=$NEXT_PUBLIC_LIVE_BASE_PATH
50+
5551
ARG NEXT_PUBLIC_WEB_BASE_URL=""
5652
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
53+
ARG NEXT_PUBLIC_WEB_BASE_PATH=""
54+
ENV NEXT_PUBLIC_WEB_BASE_PATH=$NEXT_PUBLIC_WEB_BASE_PATH
5755

58-
ENV NEXT_TELEMETRY_DISABLED=1
59-
ENV TURBO_TELEMETRY_DISABLED=1
60-
61-
RUN pnpm turbo run build --filter=admin
56+
ARG NEXT_PUBLIC_WEBSITE_URL="https://plane.so"
57+
ENV NEXT_PUBLIC_WEBSITE_URL=$NEXT_PUBLIC_WEBSITE_URL
58+
ARG NEXT_PUBLIC_SUPPORT_EMAIL="[email protected]"
59+
ENV NEXT_PUBLIC_SUPPORT_EMAIL=$NEXT_PUBLIC_SUPPORT_EMAIL
6260

63-
# *****************************************************************************
64-
# STAGE 3: Copy the project and start it
65-
# *****************************************************************************
66-
FROM base AS runner
67-
WORKDIR /app
68-
69-
# Don't run production as root
70-
RUN addgroup --system --gid 1001 nodejs
71-
RUN adduser --system --uid 1001 nextjs
72-
USER nextjs
73-
74-
# Automatically leverage output traces to reduce image size
75-
# https://nextjs.org/docs/advanced-features/output-file-tracing
76-
COPY --from=installer /app/apps/admin/.next/standalone ./
77-
COPY --from=installer /app/apps/admin/.next/static ./apps/admin/.next/static
78-
COPY --from=installer /app/apps/admin/public ./apps/admin/public
79-
80-
ARG NEXT_PUBLIC_API_BASE_URL=""
81-
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
82-
83-
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
84-
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
61+
COPY .gitignore .gitignore
62+
COPY --from=builder /app/out/json/ .
63+
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
8564

86-
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
87-
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
65+
# Fetch dependencies to cache store, then install offline with dev deps
66+
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store
67+
COPY --from=builder /app/out/full/ .
68+
COPY turbo.json turbo.json
69+
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --offline --frozen-lockfile --store-dir=/pnpm/store --prod=false
8870

89-
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
90-
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
71+
# Build only the admin package
72+
RUN pnpm turbo run build --filter=admin
9173

92-
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
93-
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
74+
# =========================================================================== #
9475

95-
ARG NEXT_PUBLIC_WEB_BASE_URL=""
96-
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
76+
FROM nginx:1.27-alpine AS production
9777

98-
ENV NEXT_TELEMETRY_DISABLED=1
99-
ENV TURBO_TELEMETRY_DISABLED=1
78+
COPY apps/admin/nginx/nginx.conf /etc/nginx/nginx.conf
79+
COPY --from=installer /app/apps/admin/build/client /usr/share/nginx/html
10080

10181
EXPOSE 3000
10282

103-
CMD ["node", "apps/admin/server.js"]
83+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
84+
CMD curl -fsS http://127.0.0.1:3000/ >/dev/null || exit 1
85+
86+
CMD ["nginx", "-g", "daemon off;"]

apps/admin/app/(all)/(dashboard)/ai/form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"use client";
2-
import { FC } from "react";
32
import { useForm } from "react-hook-form";
43
import { Lightbulb } from "lucide-react";
54
import { Button } from "@plane/propel/button";
65
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
7-
import { IFormattedInstanceConfiguration, TInstanceAIConfigurationKeys } from "@plane/types";
6+
import type { IFormattedInstanceConfiguration, TInstanceAIConfigurationKeys } from "@plane/types";
87
// components
9-
import { ControllerInput, TControllerInputFormField } from "@/components/common/controller-input";
8+
import type { TControllerInputFormField } from "@/components/common/controller-input";
9+
import { ControllerInput } from "@/components/common/controller-input";
1010
// hooks
1111
import { useInstance } from "@/hooks/store";
1212

@@ -16,7 +16,7 @@ type IInstanceAIForm = {
1616

1717
type AIFormValues = Record<TInstanceAIConfigurationKeys, string>;
1818

19-
export const InstanceAIForm: FC<IInstanceAIForm> = (props) => {
19+
export const InstanceAIForm: React.FC<IInstanceAIForm> = (props) => {
2020
const { config } = props;
2121
// store
2222
const { updateInstanceConfigurations } = useInstance();

apps/admin/app/(all)/(dashboard)/ai/layout.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/admin/app/(all)/(dashboard)/ai/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { Loader } from "@plane/ui";
66
// hooks
77
import { useInstance } from "@/hooks/store";
88
// components
9+
import type { Route } from "./+types/page";
910
import { InstanceAIForm } from "./form";
1011

11-
const InstanceAIPage = observer(() => {
12+
const InstanceAIPage = observer<React.FC<Route.ComponentProps>>(() => {
1213
// store
1314
const { fetchInstanceConfigurations, formattedConfig } = useInstance();
1415

@@ -42,4 +43,6 @@ const InstanceAIPage = observer(() => {
4243
);
4344
});
4445

46+
export const meta: Route.MetaFunction = () => [{ title: "Artificial Intelligence Settings - God Mode" }];
47+
4548
export default InstanceAIPage;

apps/admin/app/(all)/(dashboard)/authentication/github/form.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { FC, useState } from "react";
3+
import { useState } from "react";
44
import { isEmpty } from "lodash-es";
55
import Link from "next/link";
66
import { useForm } from "react-hook-form";
@@ -9,14 +9,16 @@ import { Monitor } from "lucide-react";
99
import { API_BASE_URL } from "@plane/constants";
1010
import { Button, getButtonStyling } from "@plane/propel/button";
1111
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
12-
import { IFormattedInstanceConfiguration, TInstanceGithubAuthenticationConfigurationKeys } from "@plane/types";
12+
import type { IFormattedInstanceConfiguration, TInstanceGithubAuthenticationConfigurationKeys } from "@plane/types";
1313

1414
import { cn } from "@plane/utils";
1515
// components
1616
import { CodeBlock } from "@/components/common/code-block";
1717
import { ConfirmDiscardModal } from "@/components/common/confirm-discard-modal";
18-
import { ControllerInput, TControllerInputFormField } from "@/components/common/controller-input";
19-
import { CopyField, TCopyField } from "@/components/common/copy-field";
18+
import { ControllerInput } from "@/components/common/controller-input";
19+
import type { TControllerInputFormField } from "@/components/common/controller-input";
20+
import { CopyField } from "@/components/common/copy-field";
21+
import type { TCopyField } from "@/components/common/copy-field";
2022
// hooks
2123
import { useInstance } from "@/hooks/store";
2224

@@ -26,7 +28,7 @@ type Props = {
2628

2729
type GithubConfigFormValues = Record<TInstanceGithubAuthenticationConfigurationKeys, string>;
2830

29-
export const InstanceGithubConfigForm: FC<Props> = (props) => {
31+
export const InstanceGithubConfigForm: React.FC<Props> = (props) => {
3032
const { config } = props;
3133
// states
3234
const [isDiscardChangesModalOpen, setIsDiscardChangesModalOpen] = useState(false);

0 commit comments

Comments
 (0)