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

refactor(KL-159/리팩토링): dateparser, build optimizing etc.. #60

Merged
merged 17 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to AWS S3
on:
push:
branches:
- develop
- main

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
/>
<meta
name="description"
content="Web site created using create-react-app"
content="끼룩끼룩 - 기념품의 모든 것"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block"
/>
<title>React App</title>
</head>
Expand Down
1 change: 0 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["*"],
"@components/*": ["components/*"],
"@constants/*": ["constants/*"],
"@hooks/*": ["hooks/*"],
Expand Down
1 change: 0 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'

import '@styles/font.css'
import Layout from '@pages/Layout'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/IconTextButton.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Button } from 'antd'
import PropTypes from 'prop-types'
import { Button } from 'antd'
import { IconContext } from 'react-icons'

function IconTextButton({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/PreviewLikeButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { FaHeart, FaRegHeart } from 'react-icons/fa6'
import useProductLike from '@hooks/useProductLike'
import useLoginModal from '@/hooks/useLoginModal'
import useLoginModal from '@hooks/useLoginModal'
import IconTextButton from './IconTextButton'

function PreviewLikeButton({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Carousel/Carousel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Flickity from 'react-flickity-component'
import styled from 'styled-components'
import Flickity from 'react-flickity-component'

const StyledFlickity = styled(Flickity)`
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { useParams } from 'react-router-dom'

import theme from '@styles/theme'
import useKyQuery from '@hooks/useKyQuery'
import CommentInput from './CommentInput'
Expand Down Expand Up @@ -33,6 +32,7 @@ export default function Comment({ userData }) {
</CommentSection>
)
}

Comment.propTypes = {
userData: PropTypes.shape({
id: PropTypes.number,
Expand Down
8 changes: 4 additions & 4 deletions src/components/Comment/CommentEdit.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { Input, Button, ConfigProvider } from 'antd'
import styled from 'styled-components'

import { method } from '@hooks/kyInstance'
import useKyMutation from '@hooks/useKyMutation'
import theme from '@styles/theme'
import { method } from '@utils/kyInstance'
import useKyMutation from '@hooks/useKyMutation'

const inputTheme = {
components: {
Expand Down Expand Up @@ -76,6 +75,7 @@ export default function CommentEdit({
</CommentEditBox>
)
}

CommentEdit.propTypes = {
commentId: PropTypes.number.isRequired,
commentContent: PropTypes.string.isRequired,
Expand Down
8 changes: 4 additions & 4 deletions src/components/Comment/CommentInput.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useState } from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { Input, Button, ConfigProvider } from 'antd'
import styled from 'styled-components'

import { method } from '@hooks/kyInstance'
import theme from '@styles/theme'
import { method } from '@utils/kyInstance'
import useLoginModal from '@hooks/useLoginModal'
import useKyMutation from '@hooks/useKyMutation'
import theme from '@styles/theme'
import ProfileImage from '../UserProfile/ProfileImage'

const inputTheme = {
Expand Down Expand Up @@ -73,6 +72,7 @@ export default function CommentInput({ userData }) {
</CommentInputBox>
)
}

CommentInput.propTypes = {
userData: PropTypes.shape({
image: PropTypes.shape({ url: PropTypes.string }),
Expand Down
4 changes: 2 additions & 2 deletions src/components/Comment/CommentList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { React } from 'react'
import React from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'

import CommentListContent from './CommentListContent'

export default function CommentList({ comments, userId }) {
Expand All @@ -17,6 +16,7 @@ export default function CommentList({ comments, userId }) {
</CommentListWrapper>
)
}

CommentList.propTypes = {
comments: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
9 changes: 6 additions & 3 deletions src/components/Comment/CommentListContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React, { useState } from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { useNavigate } from 'react-router-dom'

import theme from '@styles/theme'
import dateParser from '@utils/dateParser'
import CommentEdit from './CommentEdit'
import ProfileImage from '../UserProfile/ProfileImage'
import CommentOptions from './CommentOptions'
import theme from '@styles/theme'

export default function CommentListContent({ comment, canEdit }) {
const navigate = useNavigate()
Expand Down Expand Up @@ -38,7 +38,9 @@ export default function CommentListContent({ comment, canEdit }) {
>
{comment.member.name}
</span>
<span className="comment--info__date">{comment.createdAt}</span>
<span className="comment--info__date">
{dateParser(comment.createdAt)}
</span>
{canEdit && (
<CommentOptions
commentId={comment.id}
Expand All @@ -52,6 +54,7 @@ export default function CommentListContent({ comment, canEdit }) {
</CommentListContentWrapper>
)
}

CommentListContent.propTypes = {
comment: PropTypes.shape({
id: PropTypes.number,
Expand Down
8 changes: 4 additions & 4 deletions src/components/Comment/CommentOptions.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react'
import { Modal, notification } from 'antd'
import PropTypes from 'prop-types'

import { method } from '@hooks/kyInstance'
import { Modal, notification } from 'antd'
import theme from '@styles/theme'
import { method } from '@utils/kyInstance'
import useKyMutation from '@hooks/useKyMutation'
import OptionDropdown from '../OptionDropdown/OptionDropdown'
import theme from '@styles/theme'

function CommentOptions({ commentId, setEditMode }) {
const productURL = window.location.pathname.slice(1)
Expand Down Expand Up @@ -50,6 +49,7 @@ function CommentOptions({ commentId, setEditMode }) {
/>
)
}

CommentOptions.propTypes = {
commentId: PropTypes.number.isRequired,
setEditMode: PropTypes.func.isRequired,
Expand Down
3 changes: 1 addition & 2 deletions src/components/Navbar/NavBar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { createPortal } from 'react-dom'
import styled from 'styled-components'

import { createPortal } from 'react-dom'
import theme from '@styles/theme'
import NavList from './NavList'
import LoginButton from './components/LoginButton'
Expand Down
11 changes: 5 additions & 6 deletions src/components/Navbar/NavList.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from 'react'
import { styled } from 'styled-components'

import styled from 'styled-components'
import router from '@/router'
import theme from '@styles/theme'
import { navIndex, modalIndex } from '@constants/navIndex'
import { useCurrentPageStore, useModalStore } from '@stores/navbarStores'
import theme from '@styles/theme'
import router from '@/router'
import useLoginStatus from '@/stores/useLoginStatus'
import useLoginStore from '@stores/useLoginStore'
import Notification from './components/Notification'
import Icons from '../Icons/Icons'

export default function NavList() {
const isLogin = useLoginStatus((state) => state.isLogin)
const isLogin = useLoginStore((state) => state.isLogin)
const currentPage = useCurrentPageStore((state) => state.currentPage)
const { modalState, setModalState } = useModalStore()

Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/components/HomeButton.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled from 'styled-components'
import theme from '@styles/theme'
import router from '@/router'
import theme from '@styles/theme'
import PlainButton from '../../Button/PlainButton'

export default function HomeButton() {
Expand Down
17 changes: 11 additions & 6 deletions src/components/Navbar/components/LoginButton.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import React from 'react'

import { useShallow } from 'zustand/react/shallow'
import router from '@/router'
import { modalIndex } from '@constants/navIndex'
import { useModalStore } from '@stores/navbarStores'
import useUserData from '@hooks/useUserData'
import router from '@/router'
import useLoginStore from '@stores/useLoginStore'
import PlainButton from '../../Button/PlainButton'
import ProfileImage from '../../UserProfile/ProfileImage'

export default function LoginButton() {
const { data } = useUserData()
const { isLogin, loginData } = useLoginStore(
useShallow((state) => ({
isLogin: state.isLogin,
loginData: state.loginData,
}))
)
const setModalState = useModalStore((store) => store.setModalState)

return (
<PlainButton
onClick={() => {
if (!data) {
if (!isLogin) {
setModalState(modalIndex.LOGIN)
return
}
Expand All @@ -23,7 +28,7 @@ export default function LoginButton() {
}}
>
<ProfileImage
src={!data ? null : data.data.image?.url}
src={!isLogin ? null : loginData.image?.url}
$size="2.1875rem"
/>
</PlainButton>
Expand Down
5 changes: 2 additions & 3 deletions src/components/Navbar/components/LoginModal.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react'
import styled from 'styled-components'
import { Modal, Button, ConfigProvider } from 'antd'

import { KakaoLogo, NaverLogo } from '@images/logos'
import theme from '@styles/theme'
import { modalIndex } from '@constants/navIndex'
import { KakaoLogo, NaverLogo } from '@images/logos'
import { useModalStore } from '@stores/navbarStores'
import theme from '@styles/theme'

const ModalTheme = {
components: {
Expand Down
1 change: 0 additions & 1 deletion src/components/Navbar/components/Notification.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import styled from 'styled-components'
import { Dropdown, Badge } from 'antd'

import { modalIndex } from '@constants/navIndex'
import { useModalStore } from '@stores/navbarStores'
import useNotificationFetch from '@hooks/useNotificationFetch'
Expand Down
3 changes: 1 addition & 2 deletions src/components/Navbar/components/SearchModal.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react'
import styled from 'styled-components'
import { Modal, ConfigProvider } from 'antd'

import theme from '@styles/theme'
import { modalIndex } from '@constants/navIndex'
import { useModalStore } from '@stores/navbarStores'
import useDebouncedSearch from '@hooks/useDebouncedSearch'
import theme from '@styles/theme'
import Icons from '../../Icons/Icons'

const ModalTheme = {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Notification/NotificationContent.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'

import PropTypes from 'prop-types'
import router from '@/router'
import { method } from '@hooks/kyInstance'
import useKyMutation from '@hooks/useKyMutation'
import theme from '@styles/theme'
import { method } from '@utils/kyInstance'
import useKyMutation from '@hooks/useKyMutation'

function NotificationContent({ content }) {
const { mutateAsync } = useKyMutation(
Expand Down Expand Up @@ -63,6 +62,7 @@ function NotificationContent({ content }) {
</ContentWrapper>
)
}

NotificationContent.propTypes = {
content: PropTypes.shape({
id: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notification/NotificationHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import theme from '@styles/theme'

import useReadNotificationAll from '@hooks/useReadNotificationAll'
import useDeleteNotificationAll from '@hooks/useDeleteNotificationAll'

Expand Down Expand Up @@ -38,6 +37,7 @@ function NotificationHeader({ isEmpty }) {
</>
)
}

NotificationHeader.propTypes = {
isEmpty: PropTypes.bool.isRequired,
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/OptionDropdown/OptionDropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { Dropdown } from 'antd'

import Icons from '../Icons/Icons'
import theme from '@styles/theme'
import Icons from '../Icons/Icons'

function OptionDropdown({ editOnclick, deleteOnclick }) {
const items = [
Expand Down Expand Up @@ -49,6 +48,7 @@ function OptionDropdown({ editOnclick, deleteOnclick }) {
</CustomDropdown>
)
}

OptionDropdown.propTypes = {
editOnclick: PropTypes.func.isRequired,
deleteOnclick: PropTypes.func.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions src/components/PreviewContent/PreviewContent.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import PropTypes from 'prop-types'
import { StarFilled } from '@ant-design/icons'
import { FaHeart } from 'react-icons/fa6'
import { Link } from 'react-router-dom'
import { FaHeart } from 'react-icons/fa6'
import { StarFilled } from '@ant-design/icons'
import PreviewLikeButton from '../Button/PreviewLikeButton'
import { BlueTag } from '../Tags/Tags.style'
import {
Expand Down
Loading