Skip to content

Commit

Permalink
temp2
Browse files Browse the repository at this point in the history
  • Loading branch information
nz10387 committed Jun 21, 2024
1 parent 7cbb5ce commit c2e50a6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions apps/blog/app/[post]/@comment/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export default async function Page({ params }: { params: { post: string } }) {
</Typo.Link>
</Flex>
</Flex>
<div className='w-full'>
{/* <div className='w-full'>
<CommentList contents={comments.items} deleteAction={deleteComment} />
</div>
</div> */}
<CreateCommentForm articleId={articleId} createAction={createComment} />
</Flex>
)
Expand Down
4 changes: 3 additions & 1 deletion apps/blog/app/robots.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { MetadataRoute } from 'next'

import { env } from '@/env'

export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
disallow: '/private/',
},
sitemap: 'https://zakelstorm.store/sitemap.xml',
sitemap: `${env('NEXT_PUBLIC_BASE_URL')}/sitemap.xml`,
}
}
9 changes: 5 additions & 4 deletions apps/blog/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import { MetadataRoute } from 'next'

import { getAllArticles } from '@/action/article'
import { env } from '@/env'

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const res = await getAllArticles()

return [
{
url: 'https://zakelstorm.store',
url: env('NEXT_PUBLIC_BASE_URL'),
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 1,
},
{
url: 'https://zakelstorm.store/category',
url: `${env('NEXT_PUBLIC_BASE_URL')}/category`,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: 'https://zakelstorm.store/about',
url: `${env('NEXT_PUBLIC_BASE_URL')}/about`,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.5,
},
...res.items.map(
item =>
({
url: `https://zakelstorm.store/${item._id}`,
url: `${env('NEXT_PUBLIC_BASE_URL')}/${item._id}`,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.5,
Expand Down
42 changes: 20 additions & 22 deletions apps/blog/features/Form/CreateCommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,31 @@ export const CreateCommentForm = ({
createAction,
}: CreateCommentFormProps) => {
const { toast } = useToast()
const { breakPoint } = useBreakPoint()

const [content, setContent] = useState('')
const { username, password, setUsername, setPassword } = useCommentStore()

const submitCreateComment = (formData: FormData) => {
createAction(formData)
.then(res => {
setContent('')

toast({
title: res.type,
description:
res.type === 'Success'
? '댓글이 성공적으로 등록되었습니다.'
: res.description,
})
})
.catch(() => {
toast({
title: 'Success',
description: '댓글 등록에 실패했습니다.',
})
})
// createAction(formData)
// .then(res => {
// setContent('')
// // toast({
// // title: res.type,
// // description:
// // res.type === 'Success'
// // ? '댓글이 성공적으로 등록되었습니다.'
// // : res.description,
// // })
// })
// .catch(() => {
// // toast({
// // title: 'Success',
// // description: '댓글 등록에 실패했습니다.',
// // })
// })
}

const { breakPoint } = useBreakPoint()

const [content, setContent] = useState('')

if (!breakPoint) {
return <CreateCommentFormSkeleton />
}
Expand Down
2 changes: 1 addition & 1 deletion apps/blog/features/List/CommentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const CommentList = ({ contents, deleteAction }: CommentListProps) => {
}

return (
<List data={contents} pagination={pagination}>
<List data={contents} pagination>
{content => {
return (
<List.Item
Expand Down

0 comments on commit c2e50a6

Please sign in to comment.