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
31 changes: 27 additions & 4 deletions src/components/CommunityPortal/CPDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,29 +213,34 @@ export function CPDashboard() {
};

const filteredEvents = events.filter(event => {
// 🔹 Online filter
if (onlineOnly) {
const isOnlineEvent = event.location?.toLowerCase() === 'virtual';
const isOnlineEvent = (event.location || '').toLowerCase() === 'virtual';
if (!isOnlineEvent) return false;
}

// 🔹 Date filters
if (dateFilter === 'tomorrow') {
if (!isTomorrow(event.date)) return false;
} else if (dateFilter === 'weekend') {
if (!isComingWeekend(event.date)) return false;
}

// 🔹 Specific selected date
const eventDate = event.date ? parseEventDate(event.date) : null;
if (selectedDate && eventDate !== selectedDate) {
return false;
}

// 🔹 Search
if (!searchQuery) return true;

const term = searchQuery.toLowerCase();

return (
fuzzySearch(event.title, term, 0.6) ||
fuzzySearch(event.location, term, 0.6) ||
fuzzySearch(event.organizer, term, 0.6)
fuzzySearch(event.title || '', term, 0.6) ||
fuzzySearch(event.location || '', term, 0.6) ||
fuzzySearch(event.organizer || '', term, 0.6)
);
});

Expand Down Expand Up @@ -385,6 +390,22 @@ export function CPDashboard() {
<div className={styles.filterSection}>
<h4>Search Filters</h4>

<div className={`${styles.filterItem} ${styles.searchFilter}`}>
<label htmlFor="search-events">Search Events</label>
<div className={styles.inputGroup}>
<span className={styles.inputGroupText}>
<FaSearch />
</span>
<input
type="text"
id="search-events"
placeholder="Search events..."
value={searchInput}
onChange={e => setSearchInput(e.target.value)}
/>
</div>
</div>

<div className={styles.filterSectionDivider}>
<div className={styles.filterItem}>
<label htmlFor="date-tomorrow"> Dates</label>
Expand Down Expand Up @@ -425,6 +446,7 @@ export function CPDashboard() {
</Label>
</FormGroup>
</div>

<div className={styles.dashboardActions}>
<Button
color="primary"
Expand All @@ -436,6 +458,7 @@ export function CPDashboard() {
Clear date filter
</Button>
</div>

<div className={styles.filterItem}>
<div className={styles.dateFilterContainer}>
<DatePicker
Expand Down
206 changes: 160 additions & 46 deletions src/components/CommunityPortal/CPDashboard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
padding: 40px 20px;
max-width: 1400px;
margin: 0 auto;
background: #ffffff;
background: #fff;
border-radius: 16px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
Expand All @@ -11,9 +11,10 @@
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin-bottom: 30px;
padding: 20px;
background: linear-gradient(120deg, #ffffff, #f8f9fa);
background: linear-gradient(120deg, #fff, #f8f9fa);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
Expand All @@ -27,6 +28,7 @@

.darkHeader {
background: #1b2a41;
color: #fff
}

.dashboardClearBtn {
Expand Down Expand Up @@ -72,14 +74,6 @@
background: #1b2a41;
}

.dashboardSearchInput {
width: 100%;
border-radius: 999px;
border: none;
background: transparent;
box-sizing: border-box;
}

.dashboardSearchTextarea {
width: 100%;
resize: none;
Expand Down Expand Up @@ -167,6 +161,35 @@
box-shadow: none;
}

.dashboardControls {
display: flex;
align-items: flex-end;
align-items: center;
gap: 15px;
}

.dashboardSearchContainer {

Check warning on line 171 in src/components/CommunityPortal/CPDashboard.module.css

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected duplicate selector ".dashboardSearchContainer", first used at line 63

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ1425nw44PnsT_gO3OJ&open=AZ1425nw44PnsT_gO3OJ&pullRequest=4372
flex: 1;
width:260px;
max-width: 600px;
}

.dashboardSearch {
border: 1px solid #d1d5db;
border-radius: 25px !important;
padding: 10px 16px;
font-size: 0.95rem;
width: 100%;
background-color: #fff;
transition: all 0.2s ease;
}

.dashboardSearch:focus {
border-color: #2c3e50;
box-shadow: 0 0 4px rgba(44, 62, 80, 0.2);
outline: none;
}

.dashboardSidebar {
padding: 30px;
background: #f9f9f9;
Expand All @@ -193,6 +216,23 @@
color-scheme: dark;
}

.darkSidebar .inputGroup {
background-color: #34495e;
border-color: #4da3ff;
}

.darkSidebar .inputGroup input {
color: #ffffff;
}

.darkSidebar .inputGroup input::placeholder {
color: #cbd5e1;
}

.darkSidebar .inputGroupText {
color: #cbd5e1;
}

.filterSection h4 {
font-size: 1.8rem;
color: #2c3e50;
Expand Down Expand Up @@ -229,6 +269,26 @@

.filterItem input:not([type="checkbox"]):not([type="radio"]),
.filterItem select {
padding: 12px 15px;
margin-top: 10px;
border: 1px solid #ddd;
border-radius: 8px;
width: 100%;
font-size: 1rem;
background: #fff;
transition: all 0.3s ease;
}

.filterOptionsVertical {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
margin-top: 10px;
}

.dateFilter {
margin-top: 10px;
padding: 12px 15px;
border: 1px solid #ddd;
border-radius: 8px;
Expand All @@ -251,6 +311,8 @@
font-weight: 600;
color: #34495e;
margin-bottom: 8px;
background: #fff;
transition: all 0.3s ease;
}

.dateFilter:focus {
Expand All @@ -259,6 +321,18 @@
outline: none;
}

.filterItem input:not(#search-events),
.filterItem select {
padding: 12px 15px;
margin-top: 10px;
border: 1px solid #ddd;
border-radius: 8px;
width: 100%;
font-size: 1rem;
background: #fff;
transition: all 0.3s ease;
}

.filterItem input:focus,
.filterItem select:focus {
border-color: #2c3e50;
Expand All @@ -268,7 +342,7 @@

.dashboardMain {
padding: 30px;
background: #ffffff;
background: #fff;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
Expand Down Expand Up @@ -330,13 +404,28 @@
border-bottom: 3px solid #34495e;
}

.eventCardImg {
width: 100%;
height: auto;
}

.eventIcon {
margin-right: 8px;
}

.noEvents {
text-align: center;
padding: 40px;
color: #555;
font-size: 1.2rem;
}

.eventTitle {
text-align: center;
color: #2c3e50;
margin: 0 0 15px 0;
margin: 10px 0;
font-weight: bold;
font-size: 1.3rem;
line-height: 1.4;
font-size: 1.5rem;
}

.eventDate,
Expand All @@ -350,33 +439,9 @@
margin: 5px 0;
}

.organizerLogo {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
background-color: #f0f0f0;
border: 1px solid #e0e0e0;
}

.eventIcon {
color: #2c3e50;
margin-top: 2px;
flex-shrink: 0;
font-size: 1rem;
}

.noEvents {
text-align: center;
padding: 40px;
color: #888;
font-size: 1.2rem;
}

.showPastEventsBtn {
background-color: #2c3e50;
color: #ffffff;
color: #fff;
border: none;
padding: 12px 25px;
font-size: 1rem;
Expand All @@ -392,13 +457,6 @@
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dateFilter {
padding-left: 10px;
margin-top: 15px;
padding-top: 0px;
padding-bottom: 0px;
}

.dateFilterContainer {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -461,4 +519,60 @@
}
.darkMain .noEvents {
color: #9ca3af;
}
.searchFilter {
margin-bottom: 1.5rem;
}

.radioOption {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-weight: 600;
color: #2c3e50;
}

.radioOption input[type='radio'] {
accent-color: #2c3e50;
width: 16px;
height: 16px;
margin: 0;
transform: translateY(1px);
}

/* --- Fix Search Input Alignment with Icon --- */
.inputGroup {
display: flex;
align-items: center;
border: 2px solid #d1d5db;
border-radius: 999px;
overflow: hidden;
background-color: #fff;
padding: 0 10px;
}

.inputGroupText {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
background-color: #fff;
border: none;
color: #555;
font-size: 1.1rem;
}

.inputGroup input[type='text'] {
flex: 1;
border: none !important;
outline: none !important;
padding: 10px 12px;
font-size: 1rem;
background: transparent !important;
}

.inputGroup input[type='text']:focus {
box-shadow: none;
border: none;
}
Loading