diff --git a/prisma/seeds/companies.ts b/prisma/seeds/companies.ts index a259f050f..4f24b99bf 100644 --- a/prisma/seeds/companies.ts +++ b/prisma/seeds/companies.ts @@ -1,8 +1,8 @@ import { generatePublicId } from "@/common/id"; -import { faker } from "@faker-js/faker"; import { db } from "@/server/db"; -import { sample } from "lodash-es"; +import { faker } from "@faker-js/faker"; import colors from "colors"; +import { sample } from "lodash-es"; colors.enable(); type CompanyType = { @@ -17,8 +17,8 @@ type CompanyType = { city: string; state: string; zipcode: string; + country: string; }; - const seedCompanies = async (count = 4) => { const companies: CompanyType[] = []; @@ -35,6 +35,7 @@ const seedCompanies = async (count = 4) => { city: faker.location.city(), state: faker.location.state({ abbreviated: true }), zipcode: faker.location.zipCode(), + country: faker.location.countryCode(), }); } diff --git a/src/components/update/editor.tsx b/src/components/update/editor.tsx index 85cb0b1af..bec375d14 100644 --- a/src/components/update/editor.tsx +++ b/src/components/update/editor.tsx @@ -12,17 +12,17 @@ import { DropdownButton } from "@/components/ui/dropdown-button"; import { useToast } from "@/components/ui/use-toast"; import type { ShareContactType, ShareRecipientType } from "@/schema/contacts"; import { api } from "@/trpc/react"; -import { type Block } from "@blocknote/core"; +import type { Block } from "@blocknote/core"; import type { Update } from "@prisma/client"; import { RiArrowDownSLine } from "@remixicon/react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { Fragment, useState } from "react"; -import { env } from "@/env"; import "@/styles/editor.css"; import { BlockNoteView, useCreateBlockNote } from "@blocknote/react"; import "@blocknote/react/style.css"; +import { env } from "next-runtime-env"; type UpdatesEditorProps = { update?: Update; @@ -41,7 +41,7 @@ const UpdatesEditor = ({ }: UpdatesEditorProps) => { const router = useRouter(); const { toast } = useToast(); - const baseUrl = env.NEXT_PUBLIC_BASE_URL; + const baseUrl = env("NEXT_PUBLIC_BASE_URL"); const date = new Date(); const formattedDate = dayjsExt(date).format("MMM YYYY"); @@ -181,7 +181,7 @@ const UpdatesEditor = ({ }); const draftMutation = api.update.save.useMutation({ - onSuccess: async ({ publicId, success, message }) => { + onSuccess: ({ publicId, success, message }) => { toast({ variant: success ? "default" : "destructive", title: success @@ -213,7 +213,7 @@ const UpdatesEditor = ({ }); const cloneMutation = api.update.clone.useMutation({ - onSuccess: async ({ publicId, success, message }) => { + onSuccess: ({ publicId, success, message }) => { toast({ variant: success ? "default" : "destructive", title: success @@ -240,7 +240,7 @@ const UpdatesEditor = ({ }, }); - const saveAsDraft = async () => { + const saveAsDraft = () => { setLoading(true); const data = { @@ -253,7 +253,7 @@ const UpdatesEditor = ({ draftMutation.mutate(data); }; - const cloneUpdate = async () => { + const cloneUpdate = () => { setLoading(true); const data = { @@ -261,6 +261,7 @@ const UpdatesEditor = ({ html, content, }; + cloneMutation.mutate(data); }; @@ -367,11 +368,11 @@ const UpdatesEditor = ({ */} - {update && mode === "edit" && ( + {update && mode === "edit" && recipients && contacts && (