Skip to content

feat: Pilot Survey#101

Merged
anantmittal merged 13 commits intouw-ssec:mainfrom
natalierobbins:feat/fa-2025-pilot-survey
Nov 7, 2025
Merged

feat: Pilot Survey#101
anantmittal merged 13 commits intouw-ssec:mainfrom
natalierobbins:feat/fa-2025-pilot-survey

Conversation

@natalierobbins
Copy link
Collaborator

@natalierobbins natalierobbins commented Nov 4, 2025

📄 Description

Fetching from API

  • Created useApi hook, which wraps its fetchers in useSWR. Under useApi, there are currently three services: userService, surveyService, and locationService. All requests to the API have been moved to this framework
    • Just the GET fetch requests are wrapped in useSWR. These fetchers usually handle some kind of business logic that is hidden from the overlying useSWR version
    • Mutations (create/update/delete) have not been wrapped yet, but it may be worthwhile to look into useSWRMutation

Contexts & Hooks

  • The only thing stored in our zustand auth store is the JWT token; our useAuthContext is responsible for serving all user related data (ex. latest location).
  • The useAuth hooks pass through login/logout handlers instead of prop drilling
  • useAbility hook serves our user's permissions, which we can use inside of a component to show/not show certain elements, disable certain elements, or redirect users. ex:
{ability.can(
					ACTIONS.CUSTOM.CREATE_WITHOUT_REFERRAL,
					SUBJECTS.SURVEY
				) && (
					<SensitiveDivHere />
)}

Combined views

  • Combined AdminEditProfile and ViewProfile pages into one consolidated Profile page -- view/permissions change based on ability
  • Combined EditSurvey and SurveyComponent into one Survey page -- changes based on URL params
  • Combined SurveyEntryDashboard and PastEntries into one SurveyEntryDashboard -- may have to review how permissions change the views

Shared components

  • Created new components directory for components shared across different forms/routes

MUI updates

  • Moved dashboard views and form views to MUI, also broke down the dashboard views into subcomponents for legibility

✅ Checklist

  • Tests added/updated where needed
  • Docs added/updated if applicable
  • I have linked the issue this PR closes (if any)

🔗 Related Issues

Resolves #65
Resolves #52
Resolves #62

💡 Type of change

Type Checked?
🐞 Bug fix [ ]
✨ New feature [ ]
📝 Documentation [ ]
♻️ Refactor [ ]
🛠️ Build/CI [ ]
Other (explain) [ ]

🧪 How to test

📝 Notes to reviewers

  • Need to fully test/make sure permissions are fully enforced. I left some TODOs about this, but will need to be revisited thoroughly at both the route level (i.e. may need to redirect if user does not have permission) and component/request level (should disable/hide forbidden actions).
    • Biggest thing is handling how users are allowed to interact with surveys (new, in-progress, and completed) -- specifically in survey dashboard, may want to change how users can see certain actions/fields based on their roles.
  • Some other TODOs include implementing delete buttons on both the user and the survey views

@natalierobbins natalierobbins force-pushed the feat/fa-2025-pilot-survey branch from fe8321c to 06821e5 Compare November 4, 2025 04:04
@natalierobbins natalierobbins marked this pull request as ready for review November 7, 2025 16:03
@anantmittal anantmittal merged commit c23b0e8 into uw-ssec:main Nov 7, 2025
0 of 3 checks passed
@anantmittal anantmittal mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Responsive Frontend to Custom User Permissions [Feature]: Implement pilot survey questions [Feature]: Youth survey

2 participants