Skip to content

Commit

Permalink
chore: scorecard lib
Browse files Browse the repository at this point in the history
Updated scorecard lib from analytics to scorecard
  • Loading branch information
nnkogift committed Oct 17, 2024
1 parent 4da06be commit 636c837
Show file tree
Hide file tree
Showing 66 changed files with 875 additions and 803 deletions.
6 changes: 0 additions & 6 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 2 additions & 44 deletions packages/app/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-10-08T14:34:24.142Z\n"
"PO-Revision-Date: 2024-10-08T14:34:24.142Z\n"
"POT-Creation-Date: 2024-10-16T17:18:55.649Z\n"
"PO-Revision-Date: 2024-10-16T17:18:55.649Z\n"

msgid "Scorecard deleted successfully"
msgstr "Scorecard deleted successfully"
Expand Down Expand Up @@ -520,9 +520,6 @@ msgstr "and {{number}} more"
msgid "Select organisation unit(s) and period(s) to start"
msgstr "Select organisation unit(s) and period(s) to start"

msgid "Download"
msgstr "Download"

msgid "All"
msgstr "All"

Expand Down Expand Up @@ -565,45 +562,6 @@ msgstr "Show Data in Rows"
msgid "Reset"
msgstr "Reset"

msgid "Increased from last period"
msgstr "Increased from last period"

msgid "Decreased from last period"
msgstr "Decreased from last period"

msgid "Min"
msgstr "Min"

msgid "Max"
msgstr "Max"

msgid "Data Source"
msgstr "Data Source"

msgid "Period(s)"
msgstr "Period(s)"

msgid "Organisation Units Specific targets"
msgstr "Organisation Units Specific targets"

msgid "Period Specific targets"
msgstr "Period Specific targets"

msgid "Organisation unit level targets"
msgstr "Organisation unit level targets"

msgid "Specific targets"
msgstr "Specific targets"

msgid "Close"
msgstr "Close"

msgid "Specific Targets Library"
msgstr "Specific Targets Library"

msgid "Select organisation unit and period to view scorecard"
msgstr "Select organisation unit and period to view scorecard"

msgid "Create a new scorecard in the scorecard app to see it here."
msgstr "Create a new scorecard in the scorecard app to see it here."

Expand Down
7 changes: 4 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
"@dhis2/app-service-datastore": "^1.0.0-alpha.2",
"@dhis2/multi-calendar-dates": "^1.2.4",
"@dhis2/ui": "^9.11.0",
"@hisptz/dhis2-analytics": "^2.0.42",
"@hisptz/dhis2-ui": "^2.0.25",
"@hisptz/dhis2-analytics": "^2.0.46",
"@hisptz/dhis2-scorecard": "^1.0.9",
"@hisptz/dhis2-ui": "^2.0.27",
"@hisptz/dhis2-utils": "^2.0.8",
"@hookform/resolvers": "^3.9.0",
"@iapps/function-analytics": "^1.0.0-beta.23",
Expand Down Expand Up @@ -80,7 +81,7 @@
"react-js-loading-shimmer": "^1.0.10",
"react-jsx-parser": "^1.28.4",
"react-router-dom": "^6.25.1",
"react-to-print": "^2.14.0",
"react-to-print": "^3.0.1",
"react-web-vitals": "^1.0.1",
"recoil": "^0.7.7",
"usehooks-ts": "^2.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/hooks/navigate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from "react-router-dom";
import { useCallback } from "react";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { compact, isEmpty } from "lodash";
import { getOrgUnitIdsFromOrgUnitSelection } from "@scorecard/shared";
import { OrgUnitSelection } from "@hisptz/dhis2-utils";
Expand Down
14 changes: 0 additions & 14 deletions packages/app/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
"Selection is limited to period of type": "Selection is limited to period of type",
"and {{number}} more": "and {{number}} more",
"Select organisation unit(s) and period(s) to start": "Select organisation unit(s) and period(s) to start",
"Download": "Download",
"All": "All",
"Below Average": "Below Average",
"Above Average": "Above Average",
Expand All @@ -179,19 +178,6 @@
"Arrows": "Arrows",
"Show Data in Rows": "Show Data in Rows",
"Reset": "Reset",
"Increased from last period": "Increased from last period",
"Decreased from last period": "Decreased from last period",
"Min": "Min",
"Max": "Max",
"Data Source": "Data Source",
"Period(s)": "Period(s)",
"Organisation Units Specific targets": "Organisation Units Specific targets",
"Period Specific targets": "Period Specific targets",
"Organisation unit level targets": "Organisation unit level targets",
"Specific targets": "Specific targets",
"Close": "Close",
"Specific Targets Library": "Specific Targets Library",
"Select organisation unit and period to view scorecard": "Select organisation unit and period to view scorecard",
"Create a new scorecard in the scorecard app to see it here.": "Create a new scorecard in the scorecard app to see it here.",
"Confirm scorecard selection": "Confirm scorecard selection",
"Are you sure you want to select this scorecard for this dashboard?": "Are you sure you want to select this scorecard for this dashboard?",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/modules/ScorecardList/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";

export type ScorecardListItem = Pick<
ScorecardConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { OrgUnitSelector } from "@hisptz/dhis2-ui";
import { ContainerLoader } from "@scorecard/shared";
import React, { Suspense } from "react";
import { useController } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";


export default function OrgUnit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { find, has, unset } from "lodash";
import i18n from "@dhis2/d2-i18n";
import { useDialog } from "@hisptz/dhis2-ui";
import { ACCESS_TYPES_LABELLED, AccessTypes } from "@scorecard/shared";
import { ScorecardConfig, ScorecardSharing } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardSharing } from "@hisptz/dhis2-scorecard";

export default function useManageAccess(): {
publicAccess: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "./sharing.css";
import i18n from "@dhis2/d2-i18n";
import { SharingDialog } from "./components/CustomSharingDialog/SharingDialog";
import { colors, IconError24 } from "@dhis2/ui";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { useController } from "react-hook-form";

export default function Sharing() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from "react";
import { useBoolean } from "usehooks-ts";
import EditTitle from "./EditTitle";
import { useFormContext, useWatch } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { ErrorIcon } from "@scorecard/shared";

export default function GroupTitle({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Instructions from "../../../../Instructions";
import DataSourceConfiguration from "../../DataSourceConfiguration";
import React from "react";
import { useWatch } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";


export function InstructionArea() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UnlinkIcon from "@material-ui/icons/LinkOff";
import React from "react";
import useLinkManage from "../../../../../hooks/useLinkManage";
import DataSourceHolder from "../../DataSourceHolder";
import { ScorecardDataHolder } from "@hisptz/dhis2-analytics";
import { ScorecardDataHolder } from "@hisptz/dhis2-scorecard";

export function LinkingContainer({
chunk,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PreviewScorecardTable from "../../../../PreviewScorecardTable";
import React from "react";
import { useWatch } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { isEmpty } from "lodash";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScorecardDataHolder } from "@hisptz/dhis2-analytics";
import { ScorecardDataHolder } from "@hisptz/dhis2-scorecard";

export function getChunkChildIndex(
chunkSize = 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from "@dhis2/d2-i18n";
import { Button, colors, IconDragHandle24, UserAvatar } from "@dhis2/ui";
import { IconDelete16 } from "@dhis2/ui-icons";
import React from "react";
import { ScorecardDataSource } from "@hisptz/dhis2-analytics";
import { ScorecardDataSource } from "@hisptz/dhis2-scorecard";
import { FieldError, useFormContext } from "react-hook-form";

export default function DataSource({ dataSource, index, onDelete, groupIndex, holderIndex }: { groupIndex: number; holderIndex: number; dataSource: ScorecardDataSource, index: number, onDelete: (index: number) => void }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { Suspense, useMemo } from "react";
import { useFormContext } from "react-hook-form";
import DataSourceConfigurationForm from "../../../../../DataSourceConfigurationForm";
import { useSelectedData } from "../../../../../../states/selectionState";
import { ScorecardDataSource } from "@hisptz/dhis2-analytics";
import { ScorecardDataSource } from "@hisptz/dhis2-scorecard";

export default function SelectedDataSourceConfigurationForm() {
const { getValues } = useFormContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useFormContext, useWatch } from "react-hook-form";
import { useRecoilValue } from "recoil";
import { getNonDefaultLegendDefinitions } from "../../../../../../../General/utils/utils";
import LegendsField from "../TargetsArea/components/LegendsField";
import { ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-analytics";
import { ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-scorecard";

function OrgUnitSelector({ target, setTarget }: { target: SpecificTarget, setTarget: Dispatch<SetStateAction<SpecificTarget>> }) {
const [periodSelectorOpen, setPeriodSelectorOpen] = useState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useFormContext } from "react-hook-form";
import { getNonDefaultLegendDefinitions } from "../../../../../../../General/utils/utils";
import LegendsField from "../TargetsArea/components/LegendsField";
import { createFixedPeriodFromPeriodId } from "@dhis2/multi-calendar-dates";
import { ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-analytics";
import { ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-scorecard";

export default function PeriodSpecificTargetsModal({
open,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DHIS2FormField } from "@hisptz/dhis2-ui";
import { set } from "lodash";
import React from "react";
import { LegendDefinition, ScorecardLegend } from "@hisptz/dhis2-analytics";
import { LegendDefinition, ScorecardLegend } from "@hisptz/dhis2-scorecard";

function autoSetAdjacentValues(data: { startValue: number; endValue: number }[], index: number, highIsGood: boolean) {
const newData = [...data];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { head, isEmpty } from "lodash";
import PeriodSpecificTargetsModal from "../../PeriodSpecificTargetsModal";
import OrgUnitSpecificTargetsModal from "../../OrgUnitSpecificTargetsModal";
import OrgUnitLevelSpecificTargets from "../../OrgUnitLevelSpecificTargetsModal";
import { SpecificTarget } from "@hisptz/dhis2-analytics";
import { SpecificTarget } from "@hisptz/dhis2-scorecard";
import { useFormContext, useWatch } from "react-hook-form";
import { getNonDefaultLegendDefinitions } from "../../../../../../../../General/utils/utils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFixedPeriodFromPeriodId } from "@dhis2/multi-calendar-dates";
import { SelectedOrgUnits, useCalendar } from "@scorecard/shared";
import { find } from "lodash";
import React from "react";
import { LegendDefinition, ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-analytics";
import { LegendDefinition, ScorecardLegend, SpecificTarget } from "@hisptz/dhis2-scorecard";
import { useRecoilValue } from "recoil";

function LegendsView({ legends, legendDefinitions }: { legends: ScorecardLegend[], legendDefinitions: LegendDefinition[] }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { colors } from "@dhis2/ui";
import React from "react";
import { Draggable } from "react-beautiful-dnd";
import DataSource from "../DataSource";
import { ScorecardConfig, ScorecardDataHolder, ScorecardDataSource } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardDataHolder, ScorecardDataSource } from "@hisptz/dhis2-scorecard";
import { useFormContext } from "react-hook-form";
import { useSelectedDataState } from "../../../../states/selectionState";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useDataItemSearchState } from "../../states/searchState";
import { useFieldArray } from "react-hook-form";
import { ScorecardConfig, ScorecardDataGroup } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardDataGroup } from "@hisptz/dhis2-scorecard";
import { isEmpty } from "lodash";
import EmptyDataGroups from "../EmptyDataGroups";
import { uid } from "@hisptz/dhis2-utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from "@dhis2/d2-i18n";
import { Input } from "@dhis2/ui";
import React, { useRef, useState } from "react";
import { debounce, isEmpty } from "lodash";
import { ScorecardConfig, ScorecardDataGroup } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardDataGroup } from "@hisptz/dhis2-scorecard";
import { useWatch } from "react-hook-form";
import { useDataItemSearchState } from "../states/searchState";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useBoolean } from "usehooks-ts";
import { useFieldArray, useFormContext, useWatch } from "react-hook-form";
import { ScorecardConfig, ScorecardLegend } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardLegend } from "@hisptz/dhis2-scorecard";
import { useCallback, useMemo } from "react";
import { customChunk } from "../components/DataGroups/components/DataGroup/utils";
import { DropResult } from "react-beautiful-dnd";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { findIndex, head, last } from "lodash";
import { useFormContext } from "react-hook-form";
import { ScorecardConfig, ScorecardDataHolder } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardDataHolder } from "@hisptz/dhis2-scorecard";
import { useCallback } from "react";
import { useClearSelectedDataState } from "../states/selectionState";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { InstructionArea } from "./components/DataGroups/components/DataGroup/co
import { SelectedDataStateProvider } from "./states/selectionState";
import { colors, Field } from "@dhis2/ui";
import { useController } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";

export default function DataConfigurationScorecardForm() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useController, useWatch } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { Button, Field } from "@dhis2/ui";
import i18n from "@dhis2/d2-i18n";
import { PeriodTypeCategory, PeriodUtility } from "@hisptz/dhis2-utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from "prop-types";
import React, { useEffect, useMemo } from "react";
import { useController } from "react-hook-form";
import classes from "../styles/PeriodTypeSelector.module.css";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";

export function PeriodTypeSelector() {
const { field, fieldState } = useController<ScorecardConfig>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DATASTORE_NAMESPACE, generateLegendDefaults } from "@scorecard/shared";
import { cloneDeep, isEmpty, set } from "lodash";
import { LegendDefinition, ScorecardDataGroup, ScorecardDataHolder, ScorecardDataSource, SpecificTarget } from "@hisptz/dhis2-analytics";
import { LegendDefinition, ScorecardDataGroup, ScorecardDataHolder, ScorecardDataSource, SpecificTarget } from "@hisptz/dhis2-scorecard";
import { useDataEngine } from "@dhis2/app-runtime";

export function resetLegends(groups: ScorecardDataGroup[], legendDefinitions: LegendDefinition[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Help, HIGHLIGHTED_TABLE_HELP_STEPS } from "@scorecard/shared";
import { IconDelete16 } from "@dhis2/ui-icons";
import { capitalize, get, isEmpty } from "lodash";
import { FieldError, useController } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { useBoolean } from "usehooks-ts";
import HighlightedDataSourceConfigurationForm from "../HighlightedDataSourceConfigurationForm";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DataSourceSelectorModal from "../DataConfiguration/components/DataGroups/
import { getNonDefaultLegendDefinitions } from "../General/utils/utils";
import HighlightedIndicatorsTable from "./Table";
import { SelectedDataItem } from "@hisptz/dhis2-ui";
import { ScorecardConfig, ScorecardDataSource } from "@hisptz/dhis2-analytics";
import { ScorecardConfig, ScorecardDataSource } from "@hisptz/dhis2-scorecard";

export default function HighlightedIndicatorsScorecardForm() {
const { getValues, setValue } = useFormContext<ScorecardConfig>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useScorecardManagerNavigate from "../hooks/navigate";
import { useNavigate, useParams } from "react-router-dom";
import { useAlert } from "@dhis2/app-runtime";
import { useSaveScorecard } from "../hooks/save";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { useDialog } from "@hisptz/dhis2-ui";
import { useRecoilState } from "recoil";
import { FormLoadingState } from "../state/loading";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from "@dhis2/d2-i18n";
import { Button } from "@dhis2/ui";
import React from "react";
import { useFormContext } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { useAlert } from "@dhis2/app-runtime";
import { useNavigate } from "react-router-dom";
import useScorecardManagerNavigate from "../hooks/navigate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRecoilState } from "recoil";
import { FormLoadingState } from "../state/loading";
import useScorecardManagerNavigate from "../hooks/navigate";
import { useFormContext } from "react-hook-form";
import { ScorecardConfig } from "@hisptz/dhis2-analytics";
import { ScorecardConfig } from "@hisptz/dhis2-scorecard";
import { useNavigate } from "react-router-dom";
import { useAlert } from "@dhis2/app-runtime";

Expand Down
Loading

0 comments on commit 636c837

Please sign in to comment.