Skip to content
Open
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
9 changes: 9 additions & 0 deletions hustle_web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hustle_web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.1",
"react-icons": "^4.10.1",
"react-kakao-login": "^2.1.1",
"react-query": "^3.39.3",
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.0",
Expand Down
17 changes: 5 additions & 12 deletions hustle_web/src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import Join from './pages/Join/Join';
import Login from './pages/Login';
import SignIn from './pages/SignIn';
import MyPageMain from './pages/MyPage/MyPageMain';
import Community from './pages/Community/CommunityPage';
import QuestionForm from './components/Community/Question/QuestionForm';
import PostMatch from './components/FriendlyMatchPage/PostMatch/PostMatch';
import ApplyMatch from './components/FriendlyMatchPage/ApplyMatch/ApplyMatch';
import ForgotPage from './pages/Forgot/Forgotpage';
Expand All @@ -22,10 +20,11 @@ import CompetitionApply from './pages/Competition/CompetitionApply/CompetitionAp
import CompetitionResultPage from './pages/Competition/CompetitionResult/CompetitionResultPage';
import CompetitionDetailResult from './pages/Competition/CompetitionDetailResult/CompetitionDetailResult';
import CompetitionInput from './pages/Competition/CompetitionInputPage/CompetitionInputPage';
import CommunityList from './components/Community/Main/Lists';
import PostCompetition from './components/MainCompetition/PostCompetition/PostCompetition';
import CompetitionApplyForm from './components/MainCompetition/ApplyForm/CompetitionApplyForm';
import KakaoLoginRedirect from './components/Login/Kakao/KakaoLogin';
import ClubMain from './components/Club/ClubMain';
import ClubOpen from './components/Club/ClubOpen';

const loadingPage = <div>ํ™”๋ฉด ๋กœ๋”ฉ์ค‘...</div>;
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'));
Expand Down Expand Up @@ -61,15 +60,9 @@ const Router = () => {
element={<CompetitionApplyForm />}
/>
<Route path='/mypage' element={<MyPageMain />} />
<Route path='/community' element={<Community />} />
<Route path='/community/club' element={<CommunityList />} />
<Route path='/join' element={<Join />} />
<Route path='/community/question' element={<CommunityList />} />
<Route path='/community' element={<Community/>}/>
<Route
path='/community/question/write'
element={<QuestionForm />}
/>
<Route path='/club' element={<ClubMain />} />
<Route path='/clubOpen' element={<ClubOpen />} />

<Route path='/friendly' element={<FriendlyMatch />} />
<Route path='/friendly/invite' element={<FriendlyLists />} />
<Route path='/friendly/match' element={<FriendlyLists />} />
Expand Down
52 changes: 52 additions & 0 deletions hustle_web/src/components/Club/ClubList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, { useState } from 'react';
import { Arrow } from '../../stories/Icons/svg';
import * as CL from './ClubListStyle';
import { useRecoilState, useRecoilValue } from 'recoil';
import { clubState } from '../../recoil/community';


const ClubList = ({posts, loading }: any) => {
const [selectedQuestion, setSelectedQuestion] = useState(null);
const arrowButton: boolean[] = useRecoilValue(clubState);
const setArrowButton = useRecoilState(clubState)[1];

const handleQuestionClick = (id: any) => {
setSelectedQuestion(id);
};

const handleClick = (index: number) => {
const newIcons = [...arrowButton];
newIcons[index] = !newIcons[index];
setArrowButton(newIcons);
};

return (
<CL.listLayout>
{loading && <div>loading...</div>}
<CL.listContainer>
{posts.map((post: any, index: number) => (
<div key={post.id}>
<CL.Box onClick={() => handleQuestionClick(post.id)}>
<CL.List>{post.title}</CL.List>
<CL.IconWrap onClick={() => handleClick(index)}>
{arrowButton[index] ? (
<Arrow transform='rotate(180)' />
) : (
<Arrow />
)}
</CL.IconWrap>
</CL.Box>
<div>
{selectedQuestion === post.id && arrowButton[index] && (
<CL.detail>{post.detail}</CL.detail>
)}
</div>
</div>
))}
</CL.listContainer>
</CL.listLayout>
);
};


export default ClubList;
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import styled from 'styled-components';
import { Input } from '../../../stories/Inputs/Input';
import { Link } from 'react-router-dom';
import Colors from '../../../styles/Color';
import emoji from '../../../assets/images/competition_logoimg.png';
import FONT from '../../../styles/Font';
import Colors from '../../styles/Color';
import FONT from '../../styles/Font';

export const Container = styled.div`
width: 1440px;
Expand All @@ -14,10 +12,6 @@ export const FirstDiv = styled.div`
justify-content: space-between;
`;

export const Search = styled(Input)`
align-items: center;
`;

export const preparingImg = styled.div`
display: flex;
justify-content: center;
Expand Down
91 changes: 91 additions & 0 deletions hustle_web/src/components/Club/ClubMain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import * as C from './ClubStyle';
import { useState, useEffect } from 'react';
import SportsMenu from '../SportsMenu/SportsMenu';
import PostMatchButton from '../../components/PostMatchButton/PostMatchButton';
import { useNavigate } from 'react-router-dom';
import { useRecoilValue, useRecoilState } from 'recoil';
import { getClubSelector } from '../../recoil/community';
import ClubList from './ClubList';
import UniversitySearch from '../SignIn/UniversitySearch';

const ClubMain = () => {
const navigate = useNavigate();
const postList = useRecoilValue(getClubSelector);
const [inputValue, setInputValue] = useState('');
// const clubList = useRecoilValue(getLectureSelector);

// const handleInputChange = (value: string) => {
// setInputValue(value);
// };

const [loading, setLoading] = useState(false);
const [searchQuery, setSearchQuery] = useState('');
const [filteredPosts, setFilteredPosts] = useState([]); // ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ์ €์žฅ
const [selectedUniversity, setSelectedUniversity] = useState('');

function PostClick() {
navigate('/clubOpen');
}

const handleInputChange = (value: string) => {
setSearchQuery(value.toLowerCase());
};

const searchPosts = () => {
const filter = postList.filter((post: any) =>
post.title.toLowerCase().includes(searchQuery)
);
setFilteredPosts(filter);
console.log('๊ฒ€์ƒ‰์–ด: ', searchQuery);
};

const handleEnterKey = () => {
searchPosts();
};

const handleUniversitySelection = (universityId: number) => {
const university = `${universityId}`;
setSelectedUniversity(university);
console.log(selectedUniversity);
};

useEffect(() => {
if (postList.data) {
setLoading(false);
}
}, [postList.data]);

return (
<>
<SportsMenu/>
<div>
<C.Search
size='small'
type='text'
value={searchQuery}
onChange={handleInputChange}
onEnter={handleEnterKey}
placeholder='๊ถ๊ธˆํ•œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”'
/>
</div>
<div>
<UniversitySearch onSelecteUniversity={handleUniversitySelection} />
</div>
<C.Container>
<C.Div>๋™์•„๋ฆฌ ๋ชฉ๋ก</C.Div>
<div>
<PostMatchButton
type='small'
label='๋™์•„๋ฆฌ ๊ฐœ์„ค'
onClick={PostClick}
/>
</div>
<div>
<ClubList posts={filteredPosts.length > 0 ? filteredPosts : postList.data} loading={loading}/>
</div>
</C.Container>
</>
);
};

export default ClubMain;
11 changes: 11 additions & 0 deletions hustle_web/src/components/Club/ClubOpen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

const ClubOpen = () => {
return (
<>
๋™์•„๋ฆฌ ๊ฐœ์„ค ํŽ˜์ด์ง€์ž…๋‹ˆ๋‹ค.
</>
)
}

export default ClubOpen;
21 changes: 21 additions & 0 deletions hustle_web/src/components/Club/ClubStyle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styled from 'styled-components';
import FONT from '../../styles/Font';

import { Input } from '../../stories/Inputs/Input';

export const Container = styled.div`
display: flex;
justify-content: space-between;
margin-top: 5rem;
`;

export const Div = styled.div`
display: flex;
align-items: center;
font-size: ${FONT.SIZE.BODY1};
font-weight: ${FONT.WEIGHT.MEDIUM};
`;

export const Search = styled(Input)`
align-items: center;
`;
26 changes: 0 additions & 26 deletions hustle_web/src/components/Community/Club/ClubMain.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions hustle_web/src/components/Community/Club/ClubStyle.ts

This file was deleted.

20 changes: 0 additions & 20 deletions hustle_web/src/components/Community/Main/Lists.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions hustle_web/src/components/Community/Main/MainCommunity.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions hustle_web/src/components/Community/Main/MatchList.tsx

This file was deleted.

Loading