Skip to content

Commit 78b9649

Browse files
ilmartyrkDiverVM
andauthored
1.3.10 (#2323)
* #2034 (#2322) * add filters * update filter --------- Co-authored-by: Viktar Maslouski <[email protected]> * update age filter * fix styles * wip mobile * update with multiple ages * add not items found text * updated * update check * chore:Update CHANGELOG.md * 1.3.10 --------- Co-authored-by: Viktar Maslouski <[email protected]>
1 parent 5468801 commit 78b9649

File tree

9 files changed

+332
-9
lines changed

9 files changed

+332
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2025-06-18 - v1.3.10
2+
* Fix: Issue #2034 -IDEAS: Add filters for demographic data
3+
* Fix: Issue #2302 -IDEAS: Allow users to select multiple ages in age filter
4+
* Fix: Issue #2303 -IDEAS: Display no results found message for idea filters
5+
* Fix: Issue #2308 -IDEA GATHERING: Default no results found message when there are 0 ideas
6+
17
## 2025-06-18 - v1.3.9
28
* Fix: Issue #1487 - SEARCH: Add 'No results found" message to search, and signpost to Help
39
* Fix: Issue #1490 - TOPICS: 'Read more' button not as it should look - text pokes out underneath and margins too big

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "citizenos-fe",
3-
"version": "1.3.9",
3+
"version": "1.3.10",
44
"scripts": {
55
"dev": "node ./prebuild.js && ng serve --host",
66
"ng": "ng",

src/app/ideation/components/topic-ideation/topic-ideation.component.html

Lines changed: 230 additions & 1 deletion
Large diffs are not rendered by default.

src/app/ideation/components/topic-ideation/topic-ideation.component.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,18 @@
219219
.idea_filters_wrap {
220220
display: flex;
221221
gap: 16px;
222-
flex-direction: row;
222+
flex-direction: column;
223223
padding: 24px 0;
224224
width: 100%;
225225

226226
.options_row {
227227
display: flex;
228+
flex-wrap: wrap;
228229
gap: 24px;
229230
width: 100%;
230231

231232
.dropdown_input {
232-
width: 100%;
233+
width: calc(100% / 3 - 16px);
233234
}
234235
}
235236
}

src/app/ideation/components/topic-ideation/topic-ideation.component.ts

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { of, take, map, BehaviorSubject, combineLatest, switchMap } from 'rxjs';
99
import { ConfirmDialogComponent } from '@shared/components/confirm-dialog/confirm-dialog.component';
1010
import { TopicIdeaService } from '@services/topic-idea.service';
1111
import { Component, Input, NgZone } from '@angular/core';
12+
import { municipalities } from '@services/municipalitiy.service';
1213

1314
import { CreateIdeaFolderComponent } from '../create-idea-folder/create-idea-folder.component';
1415
import { ActivatedRoute } from '@angular/router';
@@ -34,6 +35,7 @@ export class TopicIdeationComponent {
3435
@Input() ideation!: any;
3536
@Input() topic!: Topic;
3637

38+
AGE_LIMIT = 110;
3739
public FILTERS_ALL = 'all';
3840
STATUSES = this.TopicService.STATUSES;
3941
VISIBILITY = this.TopicService.VISIBILITY;
@@ -51,6 +53,9 @@ export class TopicIdeationComponent {
5153
allIdeas$: Idea[] = [];
5254
tabSelected = 'ideas';
5355
ideaFilters = {
56+
age: <string[]>[],
57+
gender: '',
58+
residence: '',
5459
type: '',
5560
orderBy: '',
5661
participants: <User | any>''
@@ -59,12 +64,23 @@ export class TopicIdeationComponent {
5964
mobileIdeaFiltersList = false;
6065

6166
mobileIdeaFilters: any = {
67+
age: <string[]>[],
68+
gender: '',
69+
residence: '',
6270
type: '',
6371
orderBy: '',
6472
participants: <User | any>''
6573
}
6674

75+
mobileAges = <string[]>[];
76+
77+
78+
municipalities = municipalities;
79+
6780
ideaTypeFilter$ = new BehaviorSubject('');
81+
ageFilter$ = new BehaviorSubject<(number | string)[]>([]);
82+
genderFilter$ = new BehaviorSubject('');
83+
residenceFilter$ = new BehaviorSubject('');
6884
orderFilter$ = new BehaviorSubject('');
6985
ideaParticipantsFilter$ = new BehaviorSubject(<User | string>'');
7086
searchIdeasInput = '';
@@ -90,9 +106,9 @@ export class TopicIdeationComponent {
90106
) { }
91107

92108
ngOnInit(): void {
93-
this.ideas$ = combineLatest([this.ideaTypeFilter$, this.orderFilter$, this.ideaParticipantsFilter$, this.folderFilter$, this.ideaSearchFilter$, this.TopicIdeaService.reload$])
109+
this.ideas$ = combineLatest([this.ideaTypeFilter$, this.orderFilter$, this.ideaParticipantsFilter$, this.folderFilter$, this.ideaSearchFilter$, this.TopicIdeaService.reload$, this.ageFilter$, this.genderFilter$, this.residenceFilter$])
94110
.pipe(
95-
switchMap(([typeFilter, orderFilter, participantFilter, folderFilter, search, load]) => {
111+
switchMap(([typeFilter, orderFilter, participantFilter, folderFilter, search, load, age, gender, residence]) => {
96112
this.TopicIdeaService.reset();
97113
this.TopicIdeaService.setParam('topicId', this.topic.id);
98114
this.TopicIdeaService.setParam('ideationId', this.topic.ideationId);
@@ -122,7 +138,15 @@ export class TopicIdeationComponent {
122138
this.TopicIdeaService.setParam('search', search);
123139
}
124140

125-
if (typeFilter || orderFilter || participantFilter || folderFilter || search) {
141+
if (age || gender || residence) {
142+
this.TopicIdeaService.setParam('demographics', JSON.stringify({
143+
...(age && Array.isArray(age) && age.length && { age: age.map(String) }),
144+
...(gender && { gender }),
145+
...(residence && { residence })
146+
}));
147+
}
148+
149+
if (typeFilter || orderFilter || participantFilter || folderFilter || search || age?.length > 0 || gender || residence) {
126150
this.filtersSet = true;
127151
} else {
128152
this.filtersSet = false;
@@ -172,12 +196,62 @@ export class TopicIdeationComponent {
172196
})
173197
}
174198

199+
get isCountryEstonia() {
200+
return this.topic.country === 'Estonia';
201+
}
202+
203+
get hasDemograficsField() {
204+
return {
205+
age: this.ideation.demographicsConfig?.age,
206+
gender: this.ideation.demographicsConfig?.gender,
207+
residence: this.ideation.demographicsConfig?.residence
208+
};
209+
}
210+
211+
get sortedSelectedAges() {
212+
return this.ideaFilters.age.sort((a, b) => {
213+
const ageA = parseInt(a, 10);
214+
const ageB = parseInt(b, 10);
215+
return ageA - ageB;
216+
}
217+
).join(', ');
218+
}
219+
175220
setType(type: string) {
176221
if (type === 'all' || typeof type !== 'string') type = '';
177222
this.ideaTypeFilter$.next(type);
178223
this.ideaFilters.type = type;
179224
}
180225

226+
setAge(_age: number | string) {
227+
const age = _age.toString();
228+
if (age === 'all' || age === '') {
229+
this.ageFilter$.next([]);
230+
this.ideaFilters.age = [];
231+
return;
232+
}
233+
234+
const idx = this.ideaFilters.age.indexOf(age);
235+
if (idx > -1) {
236+
this.ideaFilters.age.splice(idx, 1);
237+
} else {
238+
this.ideaFilters.age.push(age);
239+
}
240+
this.ageFilter$.next([...this.ideaFilters.age]);
241+
}
242+
243+
setGender(value: string) {
244+
if (value === 'all') value = '';
245+
this.genderFilter$.next(value);
246+
this.ideaFilters.gender = value;
247+
}
248+
249+
setResidence(value: string) {
250+
if (value === 'all') value = '';
251+
this.residenceFilter$.next(value);
252+
this.ideaFilters.residence = value;
253+
}
254+
181255
userIndex() {
182256
let userIndex = this.users.findIndex((user) => user.id === this.ideaFilters.participants?.id)
183257
return userIndex + 1;
@@ -233,8 +307,12 @@ export class TopicIdeationComponent {
233307
doClearFilters() {
234308
this.setType('');
235309
this.orderBy('');
310+
this.setAge('');
311+
this.setGender('');
312+
this.setResidence('');
236313
this.setParticipant();
237314
this.filtersSet = false;
315+
this.mobileAges = [];
238316
}
239317

240318
saveIdeation() {
@@ -405,6 +483,9 @@ export class TopicIdeationComponent {
405483

406484
showMobileOverlay() {
407485
const filtersShow = Object.entries(this.mobileIdeaFilters).find(([key, value]) => {
486+
if (key === 'age') {
487+
return Array.isArray(value) && value.length > 0;
488+
}
408489
return !!value;
409490
});
410491

src/app/services/topic-idea.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class TopicIdeaService extends ItemsListService {
4242
showModerated: <boolean | string | null>null,
4343
favourite: <boolean | string | null>null,
4444
limit: <number>15,
45+
demographics: <null>null,
4546
};
4647

4748
params$ = new BehaviorSubject(this.params);

src/assets/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@
815815
"OPTION_DELETE_FOLDER": "Delete folder",
816816
"BTN_CREATE_NEW_FOLDER": "Create new folder",
817817
"NO_FOLDERS_HEADING": "There are no idea folders yet",
818+
"NO_ITEMS_FOUND": "No results found with these filters. Try adjusting your filters and search again.",
818819
"NO_FOLDERS_DESC": "Topic admins can create folders to group ideas that fit in the same category."
819820
},
820821
"TOUR": {
@@ -2363,9 +2364,11 @@
23632364
"DEMOGRAPHICS_DATA_GENDER_FEMALE": "Female",
23642365
"DEMOGRAPHICS_DATA_GENDER_PLACEHOLDER": "Your gender (optional)",
23652366
"DEMOGRAPHICS_DATA_GENDER_OTHER": "Other - please specify",
2367+
"DEMOGRAPHICS_DATA_GENDER_OTHER_PLACEHOLDER": "Other",
23662368
"DEMOGRAPHICS_DATA_RESIDENCE": "Municipality",
23672369
"DEMOGRAPHICS_DATA_RESIDENCE_OTHER": "Other - please specify",
23682370
"DEMOGRAPHICS_DATA_RESIDENCE_PLACEHOLDER": "Your municipality (optional)",
2371+
"DEMOGRAPHICS_DATA_RESIDENCE_OTHER_PLACEHOLDER": "Other",
23692372
"PREVIEW_INFO": "<b>This is a preview of your topic!</b> You can still edit your topic at any point prior to starting a vote.",
23702373
"BTN_IDEATION_ACTIONS": "Manage idea gathering",
23712374
"NO_IDEAS_HEADING": "There are no ideas yet",

src/styles.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ input {
361361
justify-content: space-between;
362362
background-color: var(--color-background);
363363
border-radius: 16px;
364+
gap: 8px;
365+
text-align: right;
364366

365367
.filter_option_text {
366368
color: var(--color-text);

0 commit comments

Comments
 (0)