Skip to content

feature/preparedness#6

Merged
crsstha merged 1 commit into
developfrom
feature/preparedness
Jun 24, 2026
Merged

feature/preparedness#6
crsstha merged 1 commit into
developfrom
feature/preparedness

Conversation

@AmritBhusal

@AmritBhusal AmritBhusal commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Changes

  • add preparedness tables and table actions
  • add table filters and search
  • add new route

This PR doesn't introduce any

  • temporary files, auto-generated files or secret keys
  • build works
  • eslint issues
  • typescript issues
  • codegen errors
  • console.log meant for debugging
  • typos
  • unwanted comments
  • conflict markers

@AmritBhusal AmritBhusal requested review from crsstha, shreeyash07 and subinasr and removed request for crsstha, shreeyash07 and subinasr June 22, 2026 06:42
@AmritBhusal AmritBhusal requested a review from crsstha June 22, 2026 08:06
Comment thread app/views/OurWorks/WorksForm/index.tsx Outdated
Comment on lines 106 to 112
const pageOptions = useMemo(
() => enumsData?.enums?.DashboardPage?.filter(
(option) => option.key !== DashboardPage.EmergencyAlerts
&& option.key !== DashboardPage.DisasterResponse,
(option) => option.key === DashboardPage.ProjectMapping
|| option.key === DashboardPage.EmergencyResponse,
),
[enumsData],
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we can simply hardcode this pageOptions as long as it is typesafe.

Comment on lines 29 to 34
const pageOptions = useMemo(
() => enumsData?.enums?.DashboardPage?.filter(
(option) => option.key !== DashboardPage.EmergencyAlerts
&& option.key !== DashboardPage.DisasterResponse,
(option) => option.key === DashboardPage.ProjectMapping
|| option.key === DashboardPage.EmergencyResponse,
),
[enumsData],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same here.

Comment thread app/views/OurWorks/index.tsx
}),
};

const defaultEditFormValue: PartialFormType = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
const defaultEditFormValue: PartialFormType = {
const defaultFormValue: PartialFormType = {

Comment on lines +135 to +141
if (isDefined(result) && result.ok) {
navigate(redirectPath);
alert.show(alertMessage, { variant: 'success' });
} else if (isDefined(result) && isDefined(result.errors)) {
setError(result.errors);
alert.show(result.errors[0]?.messages, { variant: 'danger' });
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We also need to handle for cases when the result object is returned empty from the server. It shouldn't happen but we need to handle it too.


const pending = createPending || updatePending || detailFetching;

const handleMutation = useCallback(async (mutationData: PartialFormType) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we separate out the create and update handler functions rather than using multiple ifs on the same function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

createSubmitHandler takes a single callback, so let's keep it as one handler rather than separating create/update.

Comment thread app/views/Preparedness/PreparednessFilter/index.tsx
Comment thread app/views/Preparedness/index.tsx
(id: string) => {
deleteExternalDashboard({ id }).then((resp) => {
const result = resp.data?.deleteExternalDashboard;
if (isDefined(result) && 'ok' in result && result.ok) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why are we using 'in' here instead of simply checking for result.ok?

alert.show('Dashboard deleted successfully', { variant: 'success' });
return;
}
const message = isDefined(result) && 'messages' in result

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why use 'in' here?

@crsstha crsstha force-pushed the feature/preparedness branch from dde735d to 1ba7f74 Compare June 24, 2026 04:54
@crsstha crsstha merged commit 4c6b1cd into develop Jun 24, 2026
3 checks passed
@crsstha crsstha deleted the feature/preparedness branch June 24, 2026 04:56
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.

4 participants