Skip to content

Commit

Permalink
Updated - React email
Browse files Browse the repository at this point in the history
- set all components to "use client"

Fix production build

Added sharp npm form image - it was recommended

fix some types

Updated Dockerfile
  • Loading branch information
pdovhomilja committed Nov 3, 2023
1 parent cb8b7e4 commit 4724a1c
Show file tree
Hide file tree
Showing 19 changed files with 300 additions and 380 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM node:18-alpine AS deps
FROM node:20.9.0-alpine AS deps

WORKDIR /app
COPY package*.json ./
RUN npm install

FROM node:18-alpine AS BUILD_IMAGE
FROM node:20.9.0-alpine AS BUILD_IMAGE

WORKDIR /app

Expand All @@ -15,7 +15,7 @@ RUN npm run build
RUN rm -rf node_modules
RUN npm install

FROM node:18-alpine
FROM node:20.9.0-alpine

ENV NODE_ENV production

Expand All @@ -27,12 +27,15 @@ COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/package.json /app/package-loc
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/public ./public
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/.next ./.next
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/.env.local ./.env.local

# Copy .env and .env.local to the final image
COPY --from=deps --chown=nextjs:nodejs /app/.env ./.env
COPY --from=deps --chown=nextjs:nodejs /app/.env.local ./.env.local

USER nextjs

EXPOSE 3000

CMD [ "npm", "start" ]

#docker build --build-arg ENV_FILE=.env -t myimage .
#docker build --build-arg ENV_FILE=.env -t myimage .
4 changes: 2 additions & 2 deletions actions/crm/get-opportunities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getOpportunitiesByMonth = async () => {
{}
);

const chartData = Object.keys(opportunitiesByMonth).map((month) => {
const chartData = Object.keys(opportunitiesByMonth).map((month: any) => {
return {
name: month,
Number: opportunitiesByMonth[month],
Expand Down Expand Up @@ -73,7 +73,7 @@ export const getOpportunitiesByStage = async () => {
{}
);

const chartData = Object.keys(opportunitiesByStage).map((stage) => {
const chartData = Object.keys(opportunitiesByStage).map((stage: any) => {
return {
name: stage,
Number: opportunitiesByStage[stage],
Expand Down
2 changes: 1 addition & 1 deletion actions/get-notions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const getNotions = async (): Promise<any[] | null> => {
});

const notionItems = databases.map(
(item) =>
(item:any) =>
({
id: item.id,
createdAt: moment(item.created_time).format("YYYY-MM-DD"),
Expand Down
2 changes: 1 addition & 1 deletion actions/get-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const getUsersByMonth = async () => {
return acc;
}, {});

const chartData = Object.keys(usersByMonth).map((month) => {
const chartData = Object.keys(usersByMonth).map((month: any) => {
return {
name: month,
Number: usersByMonth[month],
Expand Down
6 changes: 3 additions & 3 deletions actions/projects/get-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getTasks = async () => {
//Filtering tasks by section and board
const sections = await prismadb.sections.findMany({
where: {
OR: boards.map((board:any) => {
OR: boards.map((board: any) => {
return {
board: board.id,
};
Expand All @@ -45,7 +45,7 @@ export const getTasks = async () => {

const data = await prismadb.tasks.findMany({
where: {
OR: sections.map((section:any) => {
OR: sections.map((section: any) => {
return {
section: section.id,
};
Expand Down Expand Up @@ -84,7 +84,7 @@ export const getTasksByMonth = async () => {
return acc;
}, {});

const chartData = Object.keys(tasksByMonth).map((month) => {
const chartData = Object.keys(tasksByMonth).map((month: any) => {
return {
name: month,
Number: tasksByMonth[month],
Expand Down
5 changes: 3 additions & 2 deletions app/[locale]/(auth)/pending/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { getServerSession } from "next-auth";
import Link from "next/link";
import { redirect } from "next/navigation";
import TryAgain from "./components/TryAgain";
import { Users } from "@prisma/client";

const PendingPage = async () => {
const adminUsers = await prismadb.users.findMany({
const adminUsers: Users[] = await prismadb.users.findMany({
where: {
is_admin: true,
userStatus: "ACTIVE",
Expand Down Expand Up @@ -39,7 +40,7 @@ const PendingPage = async () => {
<div className="flex flex-col justify-center ">
<h2 className="flex justify-center text-xl">Admin List</h2>
{adminUsers &&
adminUsers?.map((user) => (
adminUsers?.map((user: Users) => (
<div
key={user.id}
className="flex flex-col p-5 m-2 gap-3 border rounded-md"
Expand Down
12 changes: 7 additions & 5 deletions app/[locale]/(auth)/register/components/RegisterComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ export function RegisterComponent() {
</SelectTrigger>
</FormControl>
<SelectContent className="flex overflow-y-auto h-56">
{["en", "de", "cz"].map((lng, index) => (
<SelectItem key={index} value={lng}>
{t("locale", { locale: lng })}
</SelectItem>
))}
{["en", "de", "cz"].map(
(lng: string, index: number) => (
<SelectItem key={index} value={lng}>
{t("locale", { locale: lng })}
</SelectItem>
)
)}
</SelectContent>
</Select>
<FormMessage />
Expand Down
7 changes: 4 additions & 3 deletions app/[locale]/(routes)/admin/_components/GptCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { prismadb } from "@/lib/prisma";
import SetGptModel from "../forms/SetGptModel";

import OnTestButton from "./OnTestButton";
import { gpt_models } from "@prisma/client";

const GptCard = async () => {
const gptModels = await prismadb.gpt_models.findMany();
const gptModels: gpt_models[] = await prismadb.gpt_models.findMany();
//console.log(gptModels, "gptModels");

return (
Expand All @@ -24,8 +25,8 @@ const GptCard = async () => {
{
//filter in gptModels where status = ACTIVE
gptModels
.filter((model) => model.status === "ACTIVE")
.map((model) => model.model)
.filter((model: gpt_models) => model.status === "ACTIVE")
.map((model: gpt_models) => model.model)
}
</CardDescription>
</CardHeader>
Expand Down
8 changes: 7 additions & 1 deletion app/[locale]/(routes)/admin/forms/SetGptModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ import {
import { toast } from "@/components/ui/use-toast";
import updateModel from "@/actions/admin/update-gpt-model";
import { useRouter } from "next/navigation";
import { gpt_models } from "@prisma/client";

const FormSchema = z.object({
model: z.string().min(10).max(30),
});

type Model = {
id: string;
model: string;
};

const SetGptModel = ({ models }: any) => {
const router = useRouter();

Expand Down Expand Up @@ -70,7 +76,7 @@ const SetGptModel = ({ models }: any) => {
</SelectTrigger>
</FormControl>
<SelectContent>
{models.map((model: any) => (
{models.map((model: Model) => (
<SelectItem key={model.id} value={model.id}>
{model.model}
</SelectItem>
Expand Down
12 changes: 0 additions & 12 deletions app/[locale]/(routes)/editor/page.tsx

This file was deleted.

83 changes: 0 additions & 83 deletions app/api/generate/route.ts

This file was deleted.

1 change: 1 addition & 0 deletions emails/DemoTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import * as React from "react";

interface EmailTemplateProps {
Expand Down
3 changes: 1 addition & 2 deletions emails/InviteUser.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import {
Body,
Button,
Expand Down Expand Up @@ -84,8 +85,6 @@ export const InviteUserEmail = ({

<Section className="text-center mt-[32px] mb-[32px]">
<Button
pX={20}
pY={12}
className="bg-[#000000] rounded text-white text-[12px] font-semibold no-underline text-center"
href={process.env.NEXT_PUBLIC_APP_URL}
>
Expand Down
4 changes: 2 additions & 2 deletions emails/NewTaskComment.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import {
Body,
Button,
Expand Down Expand Up @@ -77,8 +79,6 @@ export const NewTaskCommentEmail = ({
</Text>
<Section className="text-center mt-[32px] mb-[32px]">
<Button
pX={20}
pY={12}
className="bg-black text-[#ffffff] rounded text-[12px] font-semibold no-underline text-center"
href={`${process.env.NEXT_PUBLIC_APP_URL}/projects/tasks/viewtask/${taskId}`}
>
Expand Down
3 changes: 1 addition & 2 deletions emails/NewTaskFromCRM.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import {
Body,
Button,
Expand Down Expand Up @@ -71,8 +72,6 @@ export const NewTaskFromCRMEmail = ({
</Text>
<Section className="text-center mt-[32px] mb-[32px]">
<Button
pX={20}
pY={12}
className="bg-black text-[#ffffff] rounded text-[12px] font-semibold no-underline text-center"
href={`${process.env.NEXT_PUBLIC_APP_URL}/projects/tasks/viewtask/${taskData.id}`}
>
Expand Down
3 changes: 1 addition & 2 deletions emails/NewTaskFromCRMToWatchers.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import {
Body,
Button,
Expand Down Expand Up @@ -71,8 +72,6 @@ export const NewTaskFromCRMToWatchersEmail = ({
</Text>
<Section className="text-center mt-[32px] mb-[32px]">
<Button
pX={20}
pY={12}
className="bg-black text-[#ffffff] rounded text-[12px] font-semibold no-underline text-center"
href={`${process.env.NEXT_PUBLIC_APP_URL}/crm/tasks/viewtask/${taskData.id}`}
>
Expand Down
3 changes: 1 addition & 2 deletions emails/NewTaskFromProject.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import {
Body,
Button,
Expand Down Expand Up @@ -73,8 +74,6 @@ export const NewTaskFromProject = ({
</Text>
<Section className="text-center mt-[32px] mb-[32px]">
<Button
pX={20}
pY={12}
className="bg-black text-[#ffffff] rounded text-[12px] font-semibold no-underline text-center"
href={`${process.env.NEXT_PUBLIC_APP_URL}/projects/tasks/viewtask/${taskData.id}`}
>
Expand Down
4 changes: 1 addition & 3 deletions emails/PasswordReset.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
"use client";
import {
Body,
Button,
Container,
Column,
Head,
Heading,
Hr,
Html,
Img,
Link,
Preview,
Row,
Section,
Tailwind,
Text,
Expand Down
Loading

6 comments on commit 4724a1c

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nextcrm-test – ./

nextcrm-test-e-osvc.vercel.app
test.nextcrm.io
nextcrm-test-git-main-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nextcrm-demo – ./

demo.nextcrm.io
nextcrm-demo-e-osvc.vercel.app
nextcrm-demo-git-main-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nextcrm-others – ./

nextcrm-others-git-main-e-osvc.vercel.app
others.nextcrm.io
nextcrm-others-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 4724a1c Nov 3, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.