Skip to content

Commit

Permalink
Merge pull request #30 from pknu-wap/develop
Browse files Browse the repository at this point in the history
[release] v0.1.2 배포
  • Loading branch information
wkdghdwns199 authored Sep 13, 2024
2 parents 56a71f0 + ba22383 commit 3876393
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
4 changes: 3 additions & 1 deletion client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import {BrowserRouter, Routes, Route} from 'react-router-dom';
import './App.css';
import MainQrCheckIn from './pages/QrCheckIn/MainQrCheckIn';
import EventDetail from './pages/EventDetail/EventDetail';
import MainEventList from './pages/MainEventList/MainEventList';

function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<MainEventList />} />
<Route path="/eventDetail" element={<EventDetail />} />
<Route path="/qrScan" element={<MainQrCheckIn />} />
<Route path="/" element={<EventDetail />} />
</Routes>
</BrowserRouter>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import React from 'react';
import * as Styled from './CheckInTable.styles';
import useCheckInStudent from '../../../hooks/useCheckInStudent';

const CheckInTable = () => {
const {students} = useCheckInStudent('8');
interface CheckInTableProps {
eventId: string;
}

const CheckInTable: React.FC<CheckInTableProps> = ({eventId}) => {
const {students} = useCheckInStudent(eventId);

const eventStudentStatusImage = (rowEventStudentStatus: string) => {
if (rowEventStudentStatus === 'CHECK_IN') {
Expand All @@ -13,6 +17,7 @@ const CheckInTable = () => {
<img src="images/notCheckInDot.png" alt="Not Check In" width={'16px'} />
);
};

return (
<>
<Styled.Table>
Expand Down
10 changes: 7 additions & 3 deletions client/src/pages/EventDetail/EventDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import React from 'react';
import * as Styled from './EventDetail.styles';
import {useNavigate} from 'react-router-dom';
import {useNavigate, useLocation} from 'react-router-dom';
import CheckInTable from '../../components/event_detail/CheckInTable/CheckInTable';
import Header from '../../components/common/Header/Header';
import SearchAndButtonFrame from '../../components/common/SearchAndButtonFrame/SearchAndButtonFrame';

const EventDetail = () => {
const navigate = useNavigate();
const location = useLocation();
const eventId: string = location.state?.eventId || 'No Event ID'; // 전달된 eventId 받기

const navigateToQrScanner = () => {
navigate('/qrScan');
};

return (
<Styled.Wrapper>
<Header />
<div>
<SearchAndButtonFrame>
<div>검색 박스 준비 중... 🙇🏻‍♂️</div>

<p>Event ID: {eventId}</p> {/* 전달받은 eventId 표시 */}
<img
src="images/qrCheckInButton.png"
alt={'qrCheckIn'}
style={{width: '150px', height: '50px'}}
onClick={navigateToQrScanner}
/>
</SearchAndButtonFrame>
<CheckInTable />
<CheckInTable eventId={eventId} />
</div>
</Styled.Wrapper>
);
Expand Down
33 changes: 33 additions & 0 deletions client/src/pages/MainEventList/MainEventList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import {useNavigate} from 'react-router-dom';

const MainEventList = () => {
const [eventId, setEventId] = React.useState<string | null>(null);
const navigate = useNavigate();

// Handle changes in the input field and update the state
const handleEventIdChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setEventId(event.target.value);
};

// Navigate to event detail with eventId
const navigateToEventDetail = () => {
if (eventId) {
navigate('/eventDetail', {state: {eventId}});
}
};

return (
<div>
<input
type="text"
value={eventId || ''}
onChange={handleEventIdChange}
placeholder="Enter Event ID"
/>
<button onClick={navigateToEventDetail}>Go to Event</button>
</div>
);
};

export default MainEventList;

0 comments on commit 3876393

Please sign in to comment.