Skip to content

Commit d759fbb

Browse files
Merge pull request #5300 from OneCommunityGlobal/sphurthy-no-show-rate-insights-filter
Sphurthy - fix:fixed no show rate insightsfilter controls
2 parents a040b11 + ee6160b commit d759fbb

2 files changed

Lines changed: 14344 additions & 14317 deletions

File tree

src/components/CommunityPortal/Reports/Participation/NoShowInsights.jsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import styles from './Participation.module.css';
88
import { filterEventsByDate } from './FilterByDate';
99

1010
function NoShowInsights() {
11-
const [dateFilter, setDateFilter] = useState('All');
11+
const [dateFilter, setDateFilter] = useState('This Week');
12+
const [scopeFilter, setScopeFilter] = useState('My Event');
1213
const [activeTab, setActiveTab] = useState('Event type');
1314
const [sortOrder, setSortOrder] = useState('none');
1415
const darkMode = useSelector(state => state.theme.darkMode);
@@ -55,7 +56,12 @@ function NoShowInsights() {
5556
};
5657

5758
const renderStats = () => {
58-
const filteredEvents = filterEventsByDate(mockEvents, dateFilter);
59+
const dateFilteredEvents = filterEventsByDate(mockEvents, dateFilter);
60+
// Placeholder until real ownership/user context is wired in: treat even-id events as "mine".
61+
const filteredEvents =
62+
scopeFilter === 'My Event'
63+
? dateFilteredEvents.filter(event => event.id % 2 === 0)
64+
: dateFilteredEvents;
5965
const stats = calculateStats(filteredEvents);
6066
const finalStats =
6167
sortOrder === 'none'
@@ -129,7 +135,7 @@ function NoShowInsights() {
129135
const getPdfFilename = () => {
130136
const now = new Date();
131137
const localDate = now.toLocaleDateString('en-CA');
132-
const filename = `no-show-insights_${dateFilter}_${activeTab}_${localDate}.pdf`;
138+
const filename = `no-show-insights_${scopeFilter}_${dateFilter}_${activeTab}_${localDate}.pdf`;
133139
return filename.replace(/\s+/g, '_').toLowerCase();
134140
};
135141

@@ -165,7 +171,7 @@ function NoShowInsights() {
165171

166172
await navigator.share({
167173
title: 'No-show rate insights',
168-
text: `Insights (${dateFilter}, ${activeTab})`,
174+
text: `Insights (${scopeFilter}, ${dateFilter}, ${activeTab})`,
169175
files: [file],
170176
});
171177

@@ -208,6 +214,9 @@ function NoShowInsights() {
208214

209215
<div className={styles.modalBody}>
210216
<div className={styles.modalMeta}>
217+
<div>
218+
<strong>Scope:</strong> {scopeFilter}
219+
</div>
211220
<div>
212221
<strong>Filter:</strong> {dateFilter}
213222
</div>
@@ -254,6 +263,10 @@ function NoShowInsights() {
254263
<div
255264
className={`${styles.insightsFilters} ${darkMode ? styles.insightsFiltersDark : ''}`}
256265
>
266+
<select value={scopeFilter} onChange={e => setScopeFilter(e.target.value)}>
267+
<option value="My Event">My Event</option>
268+
<option value="All Events">All Events</option>
269+
</select>
257270
<select value={dateFilter} onChange={e => setDateFilter(e.target.value)}>
258271
<option value="All Time">All Time</option>
259272
<option value="Today">Today</option>

0 commit comments

Comments
 (0)