Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new “Import Beneficiary” flow in rahat-ui, backed by new query hooks for listing imports, viewing import details/files, starting an import, and streaming import progress. It also updates Community Tool targeting export usage and improves beneficiary form behavior around extras, phone status, and banked status.
Changes:
- Bump
@rahataid/community-tool-sdkand@rahataid/sdkversions. - Add new query hooks and TAGS for imports, including SSE-based progress streaming and CSV/error download helpers.
- Add new UI routes/views for import list + import detail (CSV preview, start import, progress, download errors), and adjust navigation/paths accordingly.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates SDK dependency versions used by the apps/libs. |
| libs/query/src/lib/imports/index.ts | Adds barrel export for the new imports query hooks. |
| libs/query/src/lib/imports/imports.service.ts | Implements imports list/get/file/start + progress SSE + download errors hooks. |
| libs/query/src/index.ts | Exposes the new imports hooks to consumers of @rahat-ui/query. |
| libs/query/src/config.ts | Adds new TAGS for imports query caching/invalidations. |
| libs/community-query/src/targeting/targeting.query.ts | Switches export call to use the new export client API. |
| apps/rahat-ui/src/sections/import-beneficiary/useImportColumns.tsx | Adds table column renderers + actions (start import, progress, errors, detail link). |
| apps/rahat-ui/src/sections/import-beneficiary/importListView.tsx | Adds list view with pagination + filters wired to imports list hook. |
| apps/rahat-ui/src/sections/import-beneficiary/importListTable.tsx | Adds table rendering + search UI for imports list. |
| apps/rahat-ui/src/sections/import-beneficiary/importDetailView.tsx | Adds detail page with CSV preview, progress UI, start import, downloads. |
| apps/rahat-ui/src/sections/beneficiary/beneficiary.view.tsx | Updates “Import beneficiaries” navigation destinations. |
| apps/rahat-ui/src/routes/paths.tsx | Adds a new route constant for /import-beneficiary. |
| apps/rahat-ui/src/app/import-beneficiary/* | Adds Next.js App Router pages/layout for the new import UI. |
| apps/community-tool-ui/src/sections/dashboard/populatioInsights.tsx | Fixes a variable name. |
| apps/community-tool-ui/src/sections/beneficiary/editBeneficiary.tsx | Enables client component and sets phone/banked status based on form + extras. |
| apps/community-tool-ui/src/sections/beneficiary/add/addBeneficiary.tsx | Adds resetExtras, auto-updates phone/banked status, and adjusts selects to controlled values. |
| apps/community-tool-ui/src/formBuilder/form.store.ts | Adds resetExtras() to the zustand store. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </DropdownMenuItem> | ||
| <DropdownMenuItem | ||
| onClick={() => router.push('/beneficiary/import')} | ||
| onClick={() => router.push('/beneficiary-import')} |
There was a problem hiding this comment.
router.push('/beneficiary-import') points to a route that doesn’t exist in the app router (there is apps/rahat-ui/src/app/beneficiary/import/, which maps to /beneficiary/import). This click will navigate to a 404; update the path to the actual route (or add the missing route if /beneficiary-import is intended).
| onClick={() => router.push('/beneficiary-import')} | |
| onClick={() => router.push('/beneficiary/import')} |
| @@ -0,0 +1,245 @@ | |||
| import { ColumnDef } from '@tanstack/react-table'; | |||
| import { AlertCircle, Download, Eye, Loader2, FolderDown } from 'lucide-react'; | |||
There was a problem hiding this comment.
Download is imported from lucide-react but never used in this file. This will trip noUnusedLocals/lint in many TS configs; remove the unused import or use it.
| import { AlertCircle, Download, Eye, Loader2, FolderDown } from 'lucide-react'; | |
| import { AlertCircle, Eye, Loader2, FolderDown } from 'lucide-react'; |
| import { toast } from 'react-toastify'; | ||
| import { Button } from '@rahat-ui/shadcn/components/button'; | ||
| import { Progress } from '@rahat-ui/shadcn/src/components/ui/progress'; | ||
| import { useEffect } from 'react'; |
There was a problem hiding this comment.
useEffect is imported but not used. Please remove the unused import to avoid unused-import lint/TS warnings.
| import { useEffect } from 'react'; |
| <TooltipProvider delayDuration={100}> | ||
| <Tooltip> | ||
| <TooltipTrigger> | ||
| <Link | ||
| href={`/import-beneficiary/${uuid}?name=${row.getValue('groupName')}&count=${row.getValue('beneficiaryCount')}&date=${row.getValue('createdAt')}`} | ||
| > | ||
| <Eye size={18} strokeWidth={2} /> | ||
| </Link> | ||
| </TooltipTrigger> |
There was a problem hiding this comment.
TooltipTrigger without asChild renders a <button> wrapper; wrapping a Next.js <Link> inside it produces nested interactive elements and can break accessibility/semantics. Use TooltipTrigger asChild for the <Link> (similar to the other tooltip triggers in this file), and URL-encode the querystring values (e.g., groupName) to avoid broken links when values contain spaces/special characters.
| @@ -121,6 +121,7 @@ export const useDownloadPinnedListBeneficiary = () => { | |||
| export const useExportPinnedListBeneficiary = () => { | |||
| const { queryClient, rumsanService } = useRSQuery(); | |||
| const targetingClient = getTargetClient(rumsanService.client); | |||
There was a problem hiding this comment.
targetingClient is declared in useExportPinnedListBeneficiary but no longer used after switching to exportClient. Remove the unused variable to avoid unused-variable lint/TS warnings.
| const targetingClient = getTargetClient(rumsanService.client); |
|
|
||
| const nonEmptyFields = selectNonEmptyFields(formData); | ||
|
|
||
| console.log(extras); |
There was a problem hiding this comment.
Leftover console.log(extras) in the submit handler will leak potentially sensitive form context to the browser console and adds noise in production. Please remove it (or gate behind an explicit dev-only debug flag).
| console.log(extras); |
No description provided.