Skip to content

Commit

Permalink
Use new filter type in analysis module pillar filters
Browse files Browse the repository at this point in the history
* Cleanup unused types
  • Loading branch information
AdityaKhatri committed Oct 17, 2024
1 parent 8b4834a commit c807549
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 324 deletions.
66 changes: 0 additions & 66 deletions app/types/analysisModule.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions app/types/analyticalFramework.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ export * from './common';
export * from './project';
export * from './lead';
export * from './entry';
export * from './analysisModule';
export * from './user';
export * from './organization';
export * from './analyticalFramework';
168 changes: 0 additions & 168 deletions app/types/project.tsx
Original file line number Diff line number Diff line change
@@ -1,173 +1,5 @@
import { ProjectRoleTypeEnum } from '#generated/types';

import { BasicElement } from '.';
import { OrganizationDetails } from './organization';

interface VisaulizationEnabledOptions {
entry: boolean;
assessment: boolean;
}

export interface Membership {
id: number;
member: number;
memberEmail: string;
memberName: string;
addedByName: string;
addedBy: number;
memberOrganization?: string;
memberStatus: 'admin' | 'member';
project: number;
role: number;
roleDetails: {
id: number;
title: string;
level: number;
};
joinedAt: string;
userGroupOptions: BasicElement[];
}

export interface ProjectDetails {
analysisFramework?: number;
analysisFrameworkTitle?: string;
assessmentTemplate?: number;
assessmentTemplateTitle?: string;

id: number;
createdAt: string;
createdBy: number;
createdByName: string;
modifiedAt: string;
modifiedBy: number;
modifiedByName: string;
startDate?: string;
endDate?: string;
isDefault?: boolean;
isPrivate: boolean;
description?: string;
title: string;
isVisualizationEnabled: VisaulizationEnabledOptions;
versionId: number;
regions: BasicRegion[];

memberStatus: 'admin' | 'member';
role: number;
status: string;
statusDisplay: string;

memberships: Membership[];
userGroups: BasicElement[];
organizations: ProjectOrganization[];
}

type OrganizationTypes = 'lead_organization' | 'international_partner' | 'national_partner' | 'donor' | 'government';

interface ProjectOrganization {
id: number;
organization: number;
organizationDetails: OrganizationDetails;
organizationType: OrganizationTypes;
organizationTypeDisplay: string;
}

interface ProjectSummaryItem {
count: number;
id: number;
title: string;
}

interface ActivitySummaryItem {
project: number;
count: number;
date: string;
}

export interface ProjectRecentActivity {
projects: ProjectSummaryItem[];
activities: ActivitySummaryItem[];
}

export interface ProjectsSummary {
projectsCount: number;
totalLeadsCount: number;
totalLeadsTaggedCount: number;
totalLeadsTaggedAndVerifiedCount: number;
recentEntriesActivity: ProjectRecentActivity;
}

interface Permission {
view?: boolean;
create?: boolean;
modify?: boolean;
delete?: boolean;
}

export interface ProjectRole {
id: number;
leadPermissions: Permission;
entryPermissions: Permission;
setupPermissions: Permission;
exportPermissions: Permission;
assessmentPermissions: Permission;
title: string;
description: string;
level: number;
isCreatorRole: boolean;
isDefaultRole: boolean;
type: string;
}

interface AdminLevel {
id: number;
title: string;
// clientId: string;
level: number;
nameProp?: string;
codeProp?: string;
parentNameProp?: string;
parentCodeProp?: string;
}

export interface BasicRegion {
id: number;
title: string;
isPublished: boolean;
}

export interface Region extends BasicRegion {
createdAt: string;
modifiedAt: string;
createdBy: number;
modifiedBy: number;
createdByName: string;
modifiedByName: string;
versionId: number;
adminLevels: AdminLevel[];
code: string;
title: string;
public: boolean;
isPublished: boolean;
}

interface GeoShapeFile {
id: number;
title: string;
file: string;
mimeType: string;
}

export interface AdminLevelGeoArea extends AdminLevel {
geoShapeFileDetails?: GeoShapeFile;
geojsonFile?: string;
boundsFile?: string;
tolerance: number;
staleGeoAreas: boolean;
region: number;
geoShapeFile: number;
parent?: number;
}

export interface GeoAreaBounds {
minX: number;
minY: number;
Expand Down
22 changes: 0 additions & 22 deletions app/types/user.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/AnalysisDashboard/Analysis/AnalysisPillar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface Props {
pendingPillarDelete: boolean;
pillarId: PillarSummary['id']; projectId: string;
className?: string;
totalEntries: number;
totalEntries: number | undefined;
analyzedEntries?: number | undefined;
}

Expand All @@ -54,7 +54,7 @@ function AnalysisPillar(props: Props) {
createdAt,
statements,
className,
totalEntries,
totalEntries = 0,
pendingPillarDelete,
analyzedEntries = 0,
} = props;
Expand Down
2 changes: 1 addition & 1 deletion app/views/AnalysisDashboard/Analysis/PillarList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Props {
activeProject: string;
onAnalysisPillarDelete: () => void;
analysisId: string;
totalEntries: number;
totalEntries: number | undefined;
pillars: PillarSummary[] | null | undefined;
pillarsPending: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import _ts from '#ts';

import { MatrixPillar } from '../utils';
import { AnalysisPillar, UserMembersType } from '..';
import { AnalysisPillarForm, UserMembersType } from '..';

import styles from './styles.css';

Expand All @@ -29,14 +29,14 @@ const labelSelector = (d: MatrixPillar) => d.altTitle ?? d.title;
const userKeySelector = (user: UserMembersType) => user.member.id;
const userLabelSelector = (user: UserMembersType) => user.member?.displayName ?? '';

type Value = PartialForm<AnalysisPillar>
type Value = PartialForm<AnalysisPillarForm>
const defaultValue: Value = {
filters: [],
};

export interface Props {
className?: string;
error: Error<AnalysisPillar> | undefined;
error: Error<AnalysisPillarForm> | undefined;
index: number;
matrixPillars?: MatrixPillar[];
onChange: (value: SetValueArg<Value>, index: number) => void;
Expand Down Expand Up @@ -100,6 +100,7 @@ function PillarAnalysisRow(props: Props) {
onChange={onFieldChange}
options={matrixPillars}
placeholder={_ts('analysis.editModal', 'matrixPillarsPlaceholder')}
// FIXME: Need to fix
value={value.filters}
disabled={pending}
optionsPopupClassName={styles.optionsPopup}
Expand Down
Loading

0 comments on commit c807549

Please sign in to comment.