Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CaliCastle committed Mar 12, 2024
1 parent 06b227f commit b50ce05
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
9 changes: 5 additions & 4 deletions app/admin/newsletters/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import { emailConfig } from '~/config/email'
import { db } from '~/db'
import { newsletters, subscribers } from '~/db/schema'
import NewslettersTemplate from '~/emails/NewslettersTemplate'
import { env } from '~/env.mjs'
import { resend } from '~/lib/mail'

extendDateTime({
timezone: true,
})

const CreateNewsletterSchema = z.object({
subject: z.string().nonempty(),
body: z.string().nonempty(),
subject: z.string().min(1),
body: z.string().min(1),
})
export default function CreateNewsletterPage() {
async function addNewsletter(formData: FormData) {
Expand All @@ -39,10 +40,10 @@ export default function CreateNewsletterPage() {
.map((sub) => sub.email!),
])

await resend.sendEmail({
await resend.emails.send({
subject: data.subject,
from: emailConfig.from,
to: '[email protected]',
to: env.SITE_NOTIFICATION_EMAIL_TO ?? [],
reply_to: emailConfig.from,
bcc: Array.from(subscriberEmails),
react: NewslettersTemplate({
Expand Down
13 changes: 4 additions & 9 deletions app/api/comments/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function GET(req: NextRequest, { params }: Params) {
...rest,
id: CommentHashids.encode(id),
parentId: parentId ? CommentHashids.encode(parentId) : null,
} as PostIDLessCommentDto)
}) as PostIDLessCommentDto
)
)
} catch (error) {
Expand Down Expand Up @@ -131,18 +131,13 @@ export async function POST(req: NextRequest, { params }: Params) {
.from(comments)
.where(eq(comments.id, parentId as number))
if (parentUserFromDb && parentUserFromDb.userId !== user.id) {
const {
primaryEmailAddressId,
emailAddresses,
imageUrl,
firstName,
lastName,
} = await clerkClient.users.getUser(parentUserFromDb.userId)
const { primaryEmailAddressId, emailAddresses } =
await clerkClient.users.getUser(parentUserFromDb.userId)
const primaryEmailAddress = emailAddresses.find(
(emailAddress) => emailAddress.id === primaryEmailAddressId
)
if (primaryEmailAddress) {
await resend.sendEmail({
await resend.emails.send({
from: emailConfig.from,
to: primaryEmailAddress.emailAddress,
subject: '👋 有人回复了你的评论',
Expand Down
2 changes: 1 addition & 1 deletion app/api/guestbook/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function POST(req: NextRequest) {
}

if (env.NODE_ENV === 'production' && env.SITE_NOTIFICATION_EMAIL_TO) {
await resend.sendEmail({
await resend.emails.send({
from: emailConfig.from,
to: env.SITE_NOTIFICATION_EMAIL_TO,
subject: '👋 有人刚刚在留言墙留言了',
Expand Down
4 changes: 2 additions & 2 deletions app/api/newsletter/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { resend } from '~/lib/mail'
import { redis } from '~/lib/redis'

const newsletterFormSchema = z.object({
email: z.string().email().nonempty(),
email: z.string().email().min(1),
})

const ratelimit = new Ratelimit({
Expand Down Expand Up @@ -47,7 +47,7 @@ export async function POST(req: NextRequest) {
const token = crypto.randomUUID()

if (env.NODE_ENV === 'production') {
await resend.sendEmail({
await resend.emails.send({
from: emailConfig.from,
to: parsed.email,
subject: '来自 Cali 的订阅确认',
Expand Down
1 change: 1 addition & 0 deletions components/portable-text/PortableTextBlocks.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { type PortableTextComponentProps } from '@portabletext/react'
import React from 'react'

Expand Down
3 changes: 1 addition & 2 deletions components/ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const Root = DialogPrimitive.Root
const Trigger = DialogPrimitive.Trigger

const DialogPortal = ({
className,
children,
...props
}: DialogPrimitive.DialogPortalProps) => (
<DialogPrimitive.Portal className={clsxm(className)} {...props}>
<DialogPrimitive.Portal {...props}>
<div className="fixed inset-0 z-50 flex items-start justify-center sm:items-center">
{children}
</div>
Expand Down

0 comments on commit b50ce05

Please sign in to comment.