Implement notification preferences (Task 16)

- Create NotificationSettings component with map-based area selector
- Add radius configuration slider (1-50km range)
- Implement notification type toggles (email, in-app)
- Add notifications tab to user profile page (visible only to profile owner)
- Update backend to parse and return areasOfInterest JSON
- Save and load user notification preferences
- Requirements: 10.1, 10.4
This commit is contained in:
2025-11-16 22:01:01 +00:00
parent 515e85b1eb
commit 86169f6141
7 changed files with 366 additions and 6 deletions

View File

@@ -98,8 +98,21 @@ export class UserService {
throw new Error('User not found');
}
// Parse areasOfInterest from JSON string if it exists
let areasOfInterest = [];
if (user.areasOfInterest) {
try {
areasOfInterest = typeof user.areasOfInterest === 'string'
? JSON.parse(user.areasOfInterest)
: user.areasOfInterest;
} catch (e) {
console.error('Error parsing areasOfInterest:', e);
}
}
return {
...user,
areasOfInterest,
reportCount: user._count.reports,
eventCount: user._count.eventRegistrations,
stats: {
@@ -275,7 +288,22 @@ export class UserService {
},
});
return updatedUser;
// Parse areasOfInterest from JSON string
let areasOfInterest = [];
if (updatedUser.areasOfInterest) {
try {
areasOfInterest = typeof updatedUser.areasOfInterest === 'string'
? JSON.parse(updatedUser.areasOfInterest)
: updatedUser.areasOfInterest;
} catch (e) {
console.error('Error parsing areasOfInterest:', e);
}
}
return {
...updatedUser,
areasOfInterest,
};
}
/**