|
1 | 1 | import { useState, useEffect } from 'react'; |
2 | 2 | import { Container, Row, Col, Card, CardBody, Button, Input } from 'reactstrap'; |
3 | | -import './CPDashboard.css'; |
| 3 | +import styles from './CPDashboard.module.css'; |
4 | 4 | import { FaCalendarAlt, FaMapMarkerAlt, FaUserAlt } from 'react-icons/fa'; |
5 | 5 | import { ENDPOINTS } from '../../utils/URL'; |
6 | 6 | import axios from 'axios'; |
@@ -89,152 +89,101 @@ export function CPDashboard() { |
89 | 89 | ); |
90 | 90 |
|
91 | 91 | return ( |
92 | | - <Container fluid className="dashboard-container"> |
93 | | - <header className="dashboard-header"> |
| 92 | + <Container className={styles['dashboard-container']}> |
| 93 | + <header className={styles['dashboard-header']}> |
94 | 94 | <h1>All Events</h1> |
95 | | - <div className="dashboard-controls"> |
96 | | - <div className="dashboard-search-container"> |
| 95 | + <div className={styles['dashboard-controls']}> |
| 96 | + <div className={styles['dashboard-search-container']}> |
97 | 97 | <Input |
98 | 98 | type="search" |
99 | 99 | placeholder="Search events..." |
100 | 100 | value={search} |
101 | 101 | onChange={e => setSearch(e.target.value)} |
102 | | - className="dashboard-search" |
| 102 | + className={styles['dashboard-search']} |
103 | 103 | /> |
104 | 104 | </div> |
105 | 105 | </div> |
106 | 106 | </header> |
107 | 107 |
|
108 | 108 | <Row> |
109 | | - <Col md={3} className="dashboard-sidebar"> |
110 | | - <div className="filter-section"> |
| 109 | + <Col md={3} className={styles['dashboard-sidebar']}> |
| 110 | + <div className={styles['filter-section']}> |
111 | 111 | <h4>Search Filters</h4> |
112 | | - <div className="filter-item"> |
113 | | - <label htmlFor="date-tomorrow"> Dates</label> |
114 | | - <div className="filter-options-horizontal"> |
115 | | - <div> |
116 | | - <Input type="radio" name="dates" /> Tomorrow |
| 112 | + <div className={styles['filter-section-divider']}> |
| 113 | + <div className={styles['filter-item']}> |
| 114 | + <label htmlFor="date-tomorrow"> Dates</label> |
| 115 | + <div className={styles['filter-options-horizontal']}> |
| 116 | + <div> |
| 117 | + <Input type="radio" name="dates" /> Tomorrow |
| 118 | + </div> |
| 119 | + <div> |
| 120 | + <Input type="radio" name="dates" /> This Weekend |
| 121 | + </div> |
117 | 122 | </div> |
| 123 | + <Input type="date" placeholder="Ending After" className={styles['date-filter']} /> |
| 124 | + </div> |
| 125 | + <div className={styles['filter-item']}> |
| 126 | + <label htmlFor="online-only">Online</label> |
118 | 127 | <div> |
119 | | - <Input type="radio" name="dates" /> This Weekend |
| 128 | + <Input type="checkbox" /> Online Only |
120 | 129 | </div> |
121 | 130 | </div> |
122 | | - <Input |
123 | | - type="date" |
124 | | - value={selectedDate} |
125 | | - onChange={handleDateChange} |
126 | | - className="date-filter" |
127 | | - /> |
128 | | - {dateError && ( |
129 | | - <p className="date-error-message" style={{ color: 'red', marginTop: '5px' }}> |
130 | | - {dateError} |
131 | | - </p> |
132 | | - )} |
133 | | - </div> |
134 | | - <div className="filter-item"> |
135 | | - <label htmlFor="online-only">Online</label> |
136 | | - <div> |
137 | | - <Input type="checkbox" /> Online Only |
| 131 | + <div className={styles['filter-item']}> |
| 132 | + <label htmlFor="branches">Branches</label> |
| 133 | + <Input type="select"> |
| 134 | + <option>Select branches</option> |
| 135 | + </Input> |
| 136 | + </div> |
| 137 | + <div className={styles['filter-item']}> |
| 138 | + <label htmlFor="themes">Themes</label> |
| 139 | + <Input type="select"> |
| 140 | + <option>Select themes</option> |
| 141 | + </Input> |
| 142 | + </div> |
| 143 | + <div className={styles['filter-item']}> |
| 144 | + <label htmlFor="categories">Categories</label> |
| 145 | + <Input type="select"> |
| 146 | + <option>Select categories</option> |
| 147 | + </Input> |
138 | 148 | </div> |
139 | | - </div> |
140 | | - <div className="filter-item"> |
141 | | - <label htmlFor="branches">Branches</label> |
142 | | - <Input type="select"> |
143 | | - <option>Select branches</option> |
144 | | - </Input> |
145 | | - </div> |
146 | | - <div className="filter-item"> |
147 | | - <label htmlFor="themes">Themes</label> |
148 | | - <Input type="select"> |
149 | | - <option>Select themes</option> |
150 | | - </Input> |
151 | | - </div> |
152 | | - <div className="filter-item"> |
153 | | - <label htmlFor="categories">Categories</label> |
154 | | - <Input type="select"> |
155 | | - <option>Select categories</option> |
156 | | - </Input> |
157 | 149 | </div> |
158 | 150 | </div> |
159 | 151 | </Col> |
160 | 152 |
|
161 | | - <Col md={9} className="dashboard-main"> |
162 | | - <h2 className="section-title">Events</h2> |
163 | | - |
164 | | - {error && <div className="alert alert-danger">{error}</div>} |
165 | | - |
166 | | - {isLoading ? ( |
167 | | - <div className="d-flex justify-content-center mt-4"></div> |
168 | | - ) : displayedEvents.length > 0 ? ( |
169 | | - <Row> |
170 | | - {displayedEvents.map(event => ( |
171 | | - <Col md={4} key={event._id || event.id} className="event-card-col"> |
172 | | - <Card |
173 | | - className="event-card" |
174 | | - style={{ |
175 | | - display: 'flex', |
176 | | - flexDirection: 'column', |
177 | | - borderRadius: 14, |
178 | | - overflow: 'hidden', |
179 | | - }} |
180 | | - > |
181 | | - <div className="event-card-img-container"> |
182 | | - <FixedRatioImage |
183 | | - src={event.coverImage} |
| 153 | + <Col md={9} className={styles['dashboard-main']}> |
| 154 | + <h2 className={styles['section-title']}>Events</h2> |
| 155 | + <Row> |
| 156 | + {events.length > 0 ? ( |
| 157 | + events.map(event => ( |
| 158 | + <Col md={4} key={event.id} className={styles['event-card-col']}> |
| 159 | + <Card className={styles['event-card']}> |
| 160 | + <div className={styles['event-card-img-container']}> |
| 161 | + <img |
| 162 | + src={event.image} |
184 | 163 | alt={event.title} |
185 | | - fallback={FALLBACK_IMG} |
| 164 | + className={styles['event-card-img']} |
186 | 165 | /> |
187 | 166 | </div> |
188 | | - <CardBody style={{ flex: 1, display: 'flex', flexDirection: 'column' }}> |
189 | | - <h5 className="event-title">{event.title}</h5> |
190 | | - <p className="event-date"> |
191 | | - <FaCalendarAlt className="event-icon" /> {formatDate(event.date)} |
| 167 | + <CardBody> |
| 168 | + <h5 className={styles['event-title']}>{event.title}</h5> |
| 169 | + <p className={styles['event-date']}> |
| 170 | + <FaCalendarAlt className={styles['event-icon']} /> {event.date} |
192 | 171 | </p> |
193 | | - <p className="event-location"> |
194 | | - <FaMapMarkerAlt className="event-icon" /> {event.location || 'TBD'} |
| 172 | + <p className={styles['event-location']}> |
| 173 | + <FaMapMarkerAlt className={styles['event-icon']} /> {event.location} |
195 | 174 | </p> |
196 | | - <p className="event-organizer"> |
197 | | - <FaUserAlt className="event-icon" /> {event.maxAttendees || 'No limit'}{' '} |
198 | | - Attendees limit |
| 175 | + <p className={styles['event-organizer']}> |
| 176 | + <FaUserAlt className={styles['event-icon']} /> {event.organizer} |
199 | 177 | </p> |
200 | 178 | </CardBody> |
201 | 179 | </Card> |
202 | 180 | </Col> |
203 | | - ))} |
204 | | - </Row> |
205 | | - ) : ( |
206 | | - <div className="no-events">No events available</div> |
207 | | - )} |
208 | | - |
209 | | - <div className="d-flex justify-content-center mt-4"> |
210 | | - <div className="pagination-controls"> |
211 | | - <Button |
212 | | - color="secondary" |
213 | | - disabled={pagination.currentPage === 1} |
214 | | - onClick={() => |
215 | | - setPagination(prev => ({ ...prev, currentPage: prev.currentPage - 1 })) |
216 | | - } |
217 | | - > |
218 | | - Previous |
219 | | - </Button> |
220 | | - |
221 | | - <span className="mx-3"> |
222 | | - Page {pagination.currentPage} of {totalPages} |
223 | | - </span> |
224 | | - |
225 | | - <Button |
226 | | - color="secondary" |
227 | | - disabled={pagination.currentPage === totalPages} |
228 | | - onClick={() => |
229 | | - setPagination(prev => ({ ...prev, currentPage: prev.currentPage + 1 })) |
230 | | - } |
231 | | - > |
232 | | - Next |
233 | | - </Button> |
234 | | - </div> |
235 | | - </div> |
236 | | - |
237 | | - <div className="dashboard-actions text-center mt-4"> |
| 181 | + )) |
| 182 | + ) : ( |
| 183 | + <div className={styles['no-events']}>No events available</div> |
| 184 | + )} |
| 185 | + </Row> |
| 186 | + <div className={styles['dashboard-actions']}> |
238 | 187 | <Button color="primary">Show Past Events</Button> |
239 | 188 | </div> |
240 | 189 | </Col> |
|
0 commit comments