Skip to content

Ct/import v2#1908

Open
manjik-rumsan wants to merge 9 commits intodev-v2from
ct/import-v2
Open

Ct/import v2#1908
manjik-rumsan wants to merge 9 commits intodev-v2from
ct/import-v2

Conversation

@manjik-rumsan
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-sdk and @rahataid/sdk versions.
  • 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')}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
onClick={() => router.push('/beneficiary-import')}
onClick={() => router.push('/beneficiary/import')}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,245 @@
import { ColumnDef } from '@tanstack/react-table';
import { AlertCircle, Download, Eye, Loader2, FolderDown } from 'lucide-react';
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
import { AlertCircle, Download, Eye, Loader2, FolderDown } from 'lucide-react';
import { AlertCircle, Eye, Loader2, FolderDown } from 'lucide-react';

Copilot uses AI. Check for mistakes.
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';
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useEffect is imported but not used. Please remove the unused import to avoid unused-import lint/TS warnings.

Suggested change
import { useEffect } from 'react';

Copilot uses AI. Check for mistakes.
Comment on lines +161 to +169
<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>
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@@ -121,6 +121,7 @@ export const useDownloadPinnedListBeneficiary = () => {
export const useExportPinnedListBeneficiary = () => {
const { queryClient, rumsanService } = useRSQuery();
const targetingClient = getTargetClient(rumsanService.client);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetingClient is declared in useExportPinnedListBeneficiary but no longer used after switching to exportClient. Remove the unused variable to avoid unused-variable lint/TS warnings.

Suggested change
const targetingClient = getTargetClient(rumsanService.client);

Copilot uses AI. Check for mistakes.

const nonEmptyFields = selectNonEmptyFields(formData);

console.log(extras);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
console.log(extras);

Copilot uses AI. Check for mistakes.
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.

2 participants