Skip to content

Commit

Permalink
Merge pull request #294 from ODOICHON/develop
Browse files Browse the repository at this point in the history
농가거래 서비스 배포
  • Loading branch information
JunJongHun authored Aug 21, 2024
2 parents 84a296f + 86dcefd commit 81cb551
Show file tree
Hide file tree
Showing 33 changed files with 353 additions and 129 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
if: contains(github.ref, 'develop')
run: |
aws deploy create-deployment \
--application-name duaily-dev-deploy \
--application-name ${{ secrets.DEPLOY_APPLICATION_NAME_DEV }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ secrets.DEPLOY_GROUP_DEV }} \
--s3-location bucket=${{ secrets.S3_BUCKET_NAME_DEV }},bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip
Expand All @@ -96,7 +96,7 @@ jobs:
if: contains(github.ref, 'main')
run: |
aws deploy create-deployment \
--application-name duaily-deploy \
--application-name ${{ secrets.DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ secrets.DEPLOY_GROUP }} \
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"react-quill": "^2.0.0",
"react-router-dom": "^6.8.1",
"sass": "^1.58.1",
"swiper": "^9.0.5",
"swiper": "^11.1.4",
"uuid": "^9.0.0",
"vite": "^4.1.0",
"vite-tsconfig-paths": "^4.0.5",
Expand Down
9 changes: 3 additions & 6 deletions src/apis/reissue.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import axios, { AxiosError } from 'axios';
import {
ApiResponseType,
ApiResponseWithDataType,
} from '@/types/apiResponseType';
import axios from 'axios';
import { ApiResponseWithDataType } from '@/types/apiResponseType';

export const reissue = async () => {
try {
Expand All @@ -16,6 +13,6 @@ export const reissue = async () => {
);
return data;
} catch (err) {
alert((err as AxiosError<ApiResponseType>).response?.data.message);
console.error(err);
}
};
Binary file added src/assets/trade/example1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/trade/example1.png
Binary file not shown.
Binary file added src/assets/trade/example2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/trade/example2.png
Binary file not shown.
Binary file added src/assets/trade/example3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/trade/example3.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Common/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Footer() {
);
}}
>
빈집거래 서비스 관련
농가거래 서비스 관련
</button>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function DesktopNavbar({
오도이촌 소개
</Link>
<Link className={isFocus('trade')} ref={tradeRef} to="/trade">
빈집거래
농가거래
</Link>
<Link
className={isFocus('community')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/ToggleMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function ToggleMenu() {
alt="close"
/>
<Link to="/introduce">오도이촌 소개</Link>
<Link to="/trade">빈집거래</Link>
<Link to="/trade">농가거래</Link>
<Link to="/community/free_board">커뮤니티</Link>
{token ? <AfterLogin /> : <BeforeLogin />}
</div>
Expand Down
15 changes: 13 additions & 2 deletions src/components/Trade/AddressModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect, useRef } from 'react';
import DaumPostcodeEmbed, { Address } from 'react-daum-postcode';
import styles from './styles.module.scss';

Expand All @@ -8,6 +8,7 @@ type AddressModalProps = {
};

function AddressModal({ callback, setIsPostcodeOpen }: AddressModalProps) {
const modalRef = useRef<HTMLDivElement>(null);
const handleComplete = (data: Address) => {
let fullAddress = data.address;
let extraAddress = '';
Expand All @@ -25,9 +26,19 @@ function AddressModal({ callback, setIsPostcodeOpen }: AddressModalProps) {
callback(fullAddress, data.zonecode);
setIsPostcodeOpen((pre) => !pre);
};
useEffect(() => {
const handleCloseModal = (e: Event | React.MouseEvent) => {
if (!modalRef.current || !modalRef.current!.contains(e.target as Node))
setIsPostcodeOpen(false);
};
window.addEventListener('mousedown', handleCloseModal);
return () => {
window.removeEventListener('mousedown', handleCloseModal);
};
}, [modalRef]);
return (
<div className={styles.background}>
<section className={styles.container}>
<section ref={modalRef} className={styles.container}>
<DaumPostcodeEmbed onComplete={handleComplete} autoClose={false} />
</section>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/components/Trade/Board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import dayjs from 'dayjs';
import { RentalType, TradeBoardType } from '@/types/Board/tradeType';
import { convertRentalTypeName, priceCount } from '@/utils/utils';
import { convertRentalTypeName, getHouseName, priceCount } from '@/utils/utils';
import styles from './styles.module.scss';

type TradeBoardProps = Omit<TradeBoardType, 'recommendedTag'>;

export default function TradeBoard({
houseId,
houseType,
rentalType,
city,
price,
Expand Down Expand Up @@ -97,7 +98,9 @@ export default function TradeBoard({
)}
</div>
<div className={styles.contentsWrapper}>
<h1>{title}</h1>
<h1>
[{getHouseName(houseType)}] {title}
</h1>
<p>
<strong>위치</strong> : {city}
</p>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Trade/Dropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { motion } from 'framer-motion';
import { MenuType } from '@/types/Board/tradeType';
import { TradeCategoryType, TradeCityType } from '@/constants/trade';
import {
TradeCategoryType,
TradeCityType,
TradeHouseType,
} from '@/constants/trade';
import { tradeDropdownVariants } from '@/constants/variants';
import styles from './styles.module.scss';

type DropdownProps = {
menu: TradeCategoryType[] | TradeCityType[];
menu: TradeHouseType[] | TradeCategoryType[] | TradeCityType[];
setMenu: React.Dispatch<React.SetStateAction<string>>;
setSelectedMenu: React.Dispatch<React.SetStateAction<MenuType>>;
};
Expand Down
38 changes: 15 additions & 23 deletions src/components/Trade/Info/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs';
import { TradeBoardDetailType } from '@/types/Board/tradeType';
import { getRentalName } from '@/utils/utils';
import { getHouseName, getRentalName, priceCount } from '@/utils/utils';
import styles from './styles.module.scss';

// TODO: undefined 처리하기
Expand All @@ -12,43 +12,35 @@ function TradeBoardInfo({ info }: TradeBoardInfoProps) {
return (
<section className={styles.infoContainer}>
<article>
<span>기본정보</span>
<span>임대정보 및 판매자 정보</span>
<div>
유형 <p>{info?.houseType && getHouseName(info?.houseType)}</p>
</div>
<div>
위치 <p>{info?.city}</p>
</div>
<div>
면적{' '}
가격{' '}
<p>
{info?.size}m<sup>2</sup>
{info?.rentalType && getRentalName(info?.rentalType)}{' '}
{info?.price && priceCount(info?.price)}
</p>
</div>
<div>
용도 <p>{info?.purpose}</p>
</div>
<div>
준공연도 <p>{dayjs(info?.createdDate).format('YYYY')}</p>
</div>
<div>
층수 <p>{info?.floorNum === 0 ? '-' : `${info?.floorNum}층`}</p>
전화번호 <p>{info?.contact}</p>
</div>
</article>
<article>
<span>임대정보 및 판매자 정보</span>
<span>기본정보</span>
<div>
가격{' '}
<p>
{info?.rentalType && getRentalName(info?.rentalType)} {info?.price}
만원
</p>
면적 <p>{info?.size}</p>
</div>
<div>
전화번호 <p>{info?.contact}</p>
준공연도 <p>{dayjs(info?.createdDate).format('YYYY')}</p>
</div>
<div>
용도 <p>{info?.purpose}</p>
</div>
{info?.userType === 'AGENT' && (
<div>
공인중개사명 <p>{info?.agentName !== '' ? info?.agentName : 'X'}</p>
</div>
)}
</article>
</section>
);
Expand Down
46 changes: 40 additions & 6 deletions src/components/Trade/SearchBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { useEffect, useRef, useState } from 'react';
import { GoTriangleDown } from 'react-icons/go';
import { AnimatePresence } from 'framer-motion';
import { MenuType, RentalType } from '@/types/Board/tradeType';
import { convertRentalTypeName } from '@/utils/utils';
import { tradeCategory, tradeCity } from '@/constants/trade';
import { HouseType, MenuType, RentalType } from '@/types/Board/tradeType';
import { convertHouseTypeName, convertRentalTypeName } from '@/utils/utils';
import { houseCategory, tradeCategory, tradeCity } from '@/constants/trade';
import styles from './styles.module.scss';
import Dropdown from '../Dropdown';

type SearchBarProps = {
houseType: string;
rentalType: string;
city: string;
search: string;
setHouseType: React.Dispatch<React.SetStateAction<string>>;
setRentalType: React.Dispatch<React.SetStateAction<string>>;
setCity: React.Dispatch<React.SetStateAction<string>>;
setSearch: React.Dispatch<React.SetStateAction<string>>;
Expand All @@ -19,9 +21,11 @@ type SearchBarProps = {
};

export default function SearchBar({
houseType,
rentalType,
city,
search,
setHouseType,
setRentalType,
setCity,
setSearch,
Expand Down Expand Up @@ -60,8 +64,38 @@ export default function SearchBar({
<section
ref={dropdownRef}
className={styles.selectItem}
style={{ flexGrow: '2' }}
style={{ flexGrow: '1' }}
>
<span
role="presentation"
className={
selectedMenu === 'houseType'
? styles.selectedSearchItem
: styles.searchItem
}
onClick={() => setSelectedMenu('houseType')}
>
<div>
<p style={{ color: houseType !== '' ? 'black' : '' }}>
{houseType === ''
? '유형'
: convertHouseTypeName(houseType as HouseType)}
</p>
<GoTriangleDown color="#d9d9d9" size="1.25rem" />
</div>
<AnimatePresence>
{selectedMenu === 'houseType' && (
<Dropdown
menu={houseCategory}
setMenu={setHouseType}
setSelectedMenu={setSelectedMenu}
/>
)}
</AnimatePresence>
</span>

<div className={styles.divider} />

<span
role="presentation"
className={
Expand All @@ -74,7 +108,7 @@ export default function SearchBar({
<div>
<p style={{ color: rentalType !== '' ? 'black' : '' }}>
{rentalType === ''
? '유형'
? '거래'
: convertRentalTypeName(rentalType as RentalType)}
</p>
<GoTriangleDown color="#d9d9d9" size="1.25rem" />
Expand Down Expand Up @@ -126,7 +160,7 @@ export default function SearchBar({
? styles.selectedSearchItem
: styles.searchItem
}
style={{ flexGrow: '3' }}
style={{ flexGrow: '1' }}
onClick={() => setSelectedMenu('search')}
>
<form onSubmit={handleSubmit}>
Expand Down
18 changes: 17 additions & 1 deletion src/constants/trade.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import { RecommendedTagType, RentalType } from '@/types/Board/tradeType';
import {
HouseType,
RecommendedTagType,
RentalType,
} from '@/types/Board/tradeType';

export type TradeCategoryType = {
content: string;
type: RentalType | '';
};

export type TradeHouseType = {
content: string;
type: HouseType | '';
};

export const houseCategory: TradeHouseType[] = [
{ content: '전체', type: '' },
{ content: '토지', type: 'LAND' },
{ content: '주택', type: 'HOUSE' },
{ content: '농가', type: 'FARM_HOUSE' },
];

export const tradeCategory: TradeCategoryType[] = [
{ content: '전체', type: '' },
{ content: '매매', type: 'SALE' },
Expand Down
14 changes: 14 additions & 0 deletions src/hooks/useSwiperRef.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useState, useRef, useEffect } from 'react';

const useSwiperRef = <T extends HTMLElement>() => {
const [wrapper, setWrapper] = useState<T | null>(null);
const ref = useRef<T>(null);

useEffect(() => {
setWrapper(ref.current);
}, []);

return [wrapper, ref] as const;
};

export default useSwiperRef;
2 changes: 1 addition & 1 deletion src/pages/Introduce/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { motion } from 'framer-motion';
import { Scrollbar } from 'swiper';
import { Scrollbar } from 'swiper/modules';
import { Swiper, SwiperSlide } from 'swiper/react';
import ReviewBoard from '@/components/Introduce/ReviewBoard';
import TrendBoard from '@/components/Introduce/TrendBoard';
Expand Down
Loading

0 comments on commit 81cb551

Please sign in to comment.