Skip to content

Commit

Permalink
[fix] kdt-8-4#4 mypage 백엔드 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
kr-nius committed Apr 3, 2024
1 parent 5184ce9 commit b3207fe
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 402 deletions.
3 changes: 2 additions & 1 deletion weatherfit_refactoring/@types/feed/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ interface UserData {
nickname: string
name: string
email: string
pw: string
password: string
image: string | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { confirmAlert } from '@/utils/function/utilFunction'
import InputStore, { InputStyle } from '../../Atoms/Input/InputStore'
import ButtonStore, { ButtonStyle } from '../../Atoms/Button/ButtonStore'
import { AuthTokenStore } from '@/Store/AuthToken'
import { AuthUserNickStore } from '@/Store/AuthUserNick'

interface Props {
comment: CommentType
Expand All @@ -23,7 +24,7 @@ export default function Comment({
const [isEditing, setIsEditing] = useState<boolean>(false)
const [editContent, setEditContent] = useState<string>('')
const { accesstoken, setAccessToken } = AuthTokenStore()
const decoded_nickname = '황동준'
const { userNick } = AuthUserNickStore()

useEffect(() => {
setAccessToken()
Expand Down Expand Up @@ -223,7 +224,7 @@ export default function Comment({
{comment.createdDate}
</p>
{/* 수정 부분 */}
{comment.nickname === decoded_nickname && !isEditing ? (
{comment.nickname === userNick && !isEditing ? (
<div className="text-[12px] absolute right-[5px]">
<ButtonStore
buttonStyle={ButtonStyle.TEXT_BTN}
Expand Down Expand Up @@ -273,7 +274,7 @@ export default function Comment({
style="my-[5px]"
inputStyle="w-[285px] h-[30px]"
btnText="게시"
place="황동준(으)로 작성..."
place={`${userNick}으로 작성...`}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import ProfileEditModal from '../../Organisms/mypage/ProfileEditModal'
import Header from './Header'
import { IconStyle } from '../../Atoms/Icon/IconStore'

export default function ProfileHeader() {
interface Props {
userInfo: UserData
}

export default function ProfileHeader({ userInfo }: Props) {
const [isModalOpen, setIsModalOpen] = useState(false)

const handleModalOpen = () => {
Expand All @@ -23,7 +27,12 @@ export default function ProfileHeader() {
iconStyleCase={IconStyle.SETTING}
onClickFunction2={handleModalOpen}
/>
{isModalOpen && <ProfileEditModal onClickFunction={handleModalClose} />}
{isModalOpen && (
<ProfileEditModal
onClickFunction={handleModalClose}
userInfo={userInfo}
/>
)}
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ export default function MainLogo() {
router.push('/')
}
return (
<section className="font-semibold mb-[40px] cursor-pointer">
<TextStore textStyle={TextStyle.NANUM_TEXT} style="text-center mb-[5px]">
<section className="mb-[40px] cursor-pointer">
<TextStore
textStyle={TextStyle.NANUM_TEXT}
style="text-center font-semibold mb-[5px]">
기온별 옷차림은,
</TextStore>
<BoxStore
Expand Down
290 changes: 36 additions & 254 deletions weatherfit_refactoring/src/Components/Molecules/post/ProfilePost.tsx
Original file line number Diff line number Diff line change
@@ -1,264 +1,46 @@
import TextStore, { TextStyle } from '@/Components/Atoms/Text/TextStore'
import Image from 'next/image'
import { useRouter } from 'next/navigation'

interface Props {
postData: FEEDDATA[]
}

export default function ProfilePost({ postData }: Props) {
const router = useRouter()

const goDetail = async (board_id: number) => {
localStorage.setItem('getBoardId_local', JSON.stringify(board_id))
router.push('/detail')
}
return (
// <div>
// <div className="grid grid-rows-[25vh_25vh_25vh] grid-cols-[1fr_1fr_1fr] gap-[1%] p-[10px]">
<div className="relative grid auto-rows-[180px] grid-cols-[1fr_1fr_1fr] gap-[3px] p-[10px]">
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi2.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
<div className="relative w-full h-full">
<Image
src={'/images/codi1.jpg'}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
</div>
</div>
// <>
// {postData.length > 0 ? (
// <div className="grid grid-rows-[25vh_25vh_25vh] grid-cols-[1fr_1fr_1fr] gap-[1%] p-[10px]">
// {postData.map(item => (
// <div key={item.boardId} className="rounded-lg w-[120px] h-[180px]">
// {item.images && (
// <Image
// src={item.images.imageUrl}
// alt="게시물 이미지"
// width={120}
// height={180}
// className="rounded-lg"
// />
// )}
// </div>
// ))}
// </div>
// ) : (
// <p className="post_box_p">게시물이 없습니다.</p>
// )}
// </>
// <div className="grid grid-rows-[25vh_25vh_25vh] grid-cols-[1fr_1fr_1fr] gap-[1%] p-[10px]">
// {postData.length > 0 ? (
// postData.map(item => (
// <div key={item.boardId} className="rounded-lg">
// {item.images && (
// <Image
// src={item.images.imageUrl}
// alt="게시물 이미지"
// width={120}
// height={180}
// className="rounded-lg"
// />
// )}
// </div>
// ))
// ) : (
// <>
// <p className="post_box_p">게시물이 없습니다.</p>
// </>
// )}
// {/* <div className="bg-[salmon] rounded-lg"></div> */}
// </div>
<>
{postData.length > 0 ? (
<div className="relative grid auto-rows-[180px] grid-cols-[1fr_1fr_1fr] gap-[3px] p-[10px]">
{postData.map(item => (
<div
key={item.boardId}
className="relative w-full h-full cursor-pointer"
onClick={() => goDetail(item.boardId)}>
{item.images && (
<Image
src={item.images.imageUrl}
alt="게시물 이미지"
layout="fill"
objectFit="cover"
className="rounded-lg"
/>
)}
</div>
))}
</div>
) : (
<TextStore
textStyle={TextStyle.CAFE_TEXT}
style="pt-[10%] text-center text-lg font-bold">
게시물이 없습니다.
</TextStore>
)}
</>
)
}
Loading

0 comments on commit b3207fe

Please sign in to comment.