Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 디버깅 #82

Merged
merged 8 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
## About the Project

쉽고 즐겁게 개발기록을 할 수 있는 개발자 커뮤니티 **Inforum**
개발기록을 쉽고 즐겁게, 무한한 개발 이야기 공간, 인포럼
Link : https://www.inforum.me

## Stack
<img width="25%" src="https://github.com/Funssion-SWM/Frontend/assets/68095803/7ded1a36-0616-40d2-9f7d-c756fdee7a62"/>

## Stacks

<img src="https://img.shields.io/badge/typescript-3178C6?style=for-the-badge&logo=typescript&logoColor=white"> <img src="https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=next.js&logoColor=white"> <img src="https://img.shields.io/badge/react-61DAFB?style=for-the-badge&logo=react&logoColor=black"> <img src="https://img.shields.io/badge/tailwind-FFFFFF?style=for-the-badge&logo=tailwindcss&logoColor=#38BDF8">

## 핵심 기능

- Gen AI를 활용한 텍스트 자동 생성
- Tiptap editor를 활용한 블럭 기반 웹에디터
- Post 히스토리 기능
- Q&A 기능
- Gen AI를 활용한 요약, 태그 자동 생성
#### 1. 컨텐츠 생산성 향상을 위한 기능

- 생성형 AI를 활용한 텍스트 자동 생성
- 생성형 AI를 활용한 요약, 태그 자동 생성
- 오픈소스( https://github.com/steven-tey/novel )를 활용한 블럭 기반 웹에디터
- 시리즈

#### 2. 컨텐츠 생산 동기 부여를 위한 기능

- Post history
- 등급 제도
- 시리즈 기능
- 채용 도우미 서비스

#### 3. 일반 커뮤니티 기능

- 댓글
- 알림
- 검색
- 좋아요
- Q&A

## 개발 현황

Expand All @@ -24,4 +39,6 @@ MVP 개발완료 및 배포 (23.08.14)
피드백 반영 (23.08.23~)
v2 배포 (23.10.11)
v2.5 배포 (23.10.23)
마케팅 (23.10.25~)
마케팅 (23.10.25 ~ 23.11.12)
v3 배포(23.11.07)
디버깅 및 성능 개선(11.07~)
16 changes: 11 additions & 5 deletions src/app/me/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
getCoverletterInfoByUserId,
getCoverletterVisibleMode,
} from '@/service/coverletter';
import { notFound } from 'next/navigation';

type Props = {
params: {
Expand All @@ -35,8 +36,12 @@ export default async function MePage({ params: { slug } }: Props) {
const cookie = `${ACCESS_TOKEN}=${accessToken}; ${REFRESH_TOKEN}=${refreshToken}`;
const userId = Number(slug);

const userInfo = await getUserInfo(userId, cookie);
if (userInfo.userId === undefined) {
notFound();
}

const memosData = getMemosByUserId(userId);
const userData = getUserInfo(userId, cookie);
const historyData = getHistory(
userId,
new Date().getFullYear(),
Expand All @@ -54,7 +59,6 @@ export default async function MePage({ params: { slug } }: Props) {

const [
memos,
userInfo,
history,
{ id, isLogin, authority },
tags,
Expand All @@ -66,7 +70,6 @@ export default async function MePage({ params: { slug } }: Props) {
coverletterIsVisible,
] = await Promise.all([
memosData,
userData,
historyData,
myData,
tagData,
Expand Down Expand Up @@ -137,9 +140,12 @@ export default async function MePage({ params: { slug } }: Props) {
);
}

export async function generateMetadata({ params }: Props) {
const userId = Number(params.slug);
export async function generateMetadata({ params: { slug } }: Props) {
const userId = Number(slug);
const { nickname } = await getUserInfo(userId);
if (nickname === undefined) {
notFound();
}

return {
title: `${nickname} - 인포럼`,
Expand Down
41 changes: 24 additions & 17 deletions src/app/memos/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const';
import { checkUser, getUserInfo } from '@/service/auth';
import { getQuestionsByMemoId } from '@/service/questions';
import { getNotificationsTop30 } from '@/service/notification';
import { notFound } from 'next/navigation';

type Props = {
params: {
Expand All @@ -23,36 +24,39 @@ export default async function MemoPage({ params: { slug } }: Props) {
const cookie = `${ACCESS_TOKEN}=${accessToken}; ${REFRESH_TOKEN}=${refreshToken}`;
const memoId = Number(slug);

const memoData = getMemoById(memoId, cookie);
const {
memoTitle,
memoColor,
memoText,
authorId,
likes,
authorName,
authorProfileImagePath,
memoTags,
isMine,
createdDate,
seriesId,
seriesTitle,
authorRank,
} = await getMemoById(memoId, cookie);

if (memoTitle === undefined) {
notFound();
}

const likeData = getIsLike('memos', memoId, cookie);
const commentData = getCommentsByPostTypeAndPostId('memo', memoId, cookie);
const myData = checkUser(cookie);
const questionsData = getQuestionsByMemoId(memoId);
const recommendationsData = getMemoRecommendationsById(memoId);

const [
{
memoTitle,
memoColor,
memoText,
authorId,
likes,
authorName,
authorProfileImagePath,
memoTags,
isMine,
createdDate,
seriesId,
seriesTitle,
authorRank,
},
{ isLike },
comments,
{ id, isLogin, authority },
recommendations,
questions,
] = await Promise.all([
memoData,
likeData,
commentData,
myData,
Expand Down Expand Up @@ -121,6 +125,9 @@ export default async function MemoPage({ params: { slug } }: Props) {
export async function generateMetadata({ params: { slug } }: Props) {
const memoId = Number(slug);
const { memoTitle, memoDescription } = await getMemoById(memoId);
if (memoTitle === undefined) {
notFound();
}

return {
title: memoTitle,
Expand Down
17 changes: 14 additions & 3 deletions src/app/questions/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getNotificationsTop30 } from '@/service/notification';
import { getQuestionById } from '@/service/questions';
import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const';
import { cookies } from 'next/headers';
import { notFound } from 'next/navigation';

type Props = {
params: {
Expand All @@ -22,13 +23,20 @@ export default async function QuestionPage({ params: { slug } }: Props) {
const cookie = `${ACCESS_TOKEN}=${accessToken}; ${REFRESH_TOKEN}=${refreshToken}`;
const questionId = Number(slug);

const questionData = getQuestionById(questionId, cookie);
const question = await getQuestionById(questionId, cookie);
if (question.id === undefined) {
notFound();
}

const answersData = getAnswersByQuestionId(questionId, cookie);
const myData = checkUser(cookie);
const likeData = getIsLike('questions', questionId, cookie);

const [question, answers, { id, isLogin, authority }, { isLike }] =
await Promise.all([questionData, answersData, myData, likeData]);
const [answers, { id, isLogin, authority }, { isLike }] = await Promise.all([
answersData,
myData,
likeData,
]);

const { profileImageFilePath } = isLogin
? await getUserInfo(id)
Expand Down Expand Up @@ -68,6 +76,9 @@ export default async function QuestionPage({ params: { slug } }: Props) {
export async function generateMetadata({ params: { slug } }: Props) {
const questionId = Number(slug);
const { title, description } = await getQuestionById(questionId);
if (title === undefined) {
notFound();
}

return {
title: title,
Expand Down
7 changes: 7 additions & 0 deletions src/app/series/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { getQuestionsByMemoId } from '@/service/questions';
import { getSeriesById } from '@/service/series';
import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const';
import { cookies } from 'next/headers';
import { notFound } from 'next/navigation';

type Props = {
params: {
Expand All @@ -24,6 +25,9 @@ export default async function SeriesDetailPage({ params: { slug } }: Props) {
const seriesId = Number(slug);

const { memoInfoList, likes, title } = await getSeriesById(seriesId);
if (title === undefined) {
notFound();
}

const memoData = getMemoById(memoInfoList[0].id, cookie);
const likeData = getIsLike('series', seriesId, cookie);
Expand Down Expand Up @@ -98,6 +102,9 @@ export default async function SeriesDetailPage({ params: { slug } }: Props) {
export async function generateMetadata({ params: { slug } }: Props) {
const seriesId = Number(slug);
const { title, description } = await getSeriesById(seriesId);
if (title === undefined) {
notFound();
}

return {
title: title,
Expand Down
23 changes: 11 additions & 12 deletions src/components/memo/MemoViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,18 @@ export default function MemoViewer({
{title}
</h1>
<div className="h-[0.5px] mx-3 my-4 bg-soma-grey-49"></div>
{hydrated ? (
<div className="flex-grow px-4 break-all">
<div className="flex-grow px-4 break-all">
{hydrated ? (
<EditorContent editor={editor} />
</div>
) : (
<div
className="hidden"
dangerouslySetInnerHTML={{
__html: output,
}}
></div>
)}

) : (
<div
className="hidden"
dangerouslySetInnerHTML={{
__html: output,
}}
></div>
)}
</div>
<div className="flex flex-wrap gap-1 mx-2 mt-10 mb-1">
{memoTags.map((tag, idx) => (
<TagView key={idx} tagText={tag} isLogin={isLogin} />
Expand Down
Loading