Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how it works and user manual link added in the card #1570

Merged
merged 4 commits into from
Oct 19, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export const RoleBasedEmployeeHome = ({ modules, additionalComponent }) => {
? "Edit"
: linkUrl.includes("dss")
? "Dashboard"
: linkUrl.includes("user-manual")
Copy link
Collaborator

Choose a reason for hiding this comment

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

clean it up

    // link: linkUrl,
    link: linkUrl,
    icon: linkUrl.includes("create")
      ? "Person"
      : linkUrl.includes("inbox")
      ? "AllInbox"
      : linkUrl.includes("search")
      ? "Search"
      : linkUrl.includes("edit")
      ? "Edit"
      : linkUrl.includes("dss")
      ? "Dashboard"
      : linkUrl.includes("user-manual")
      ? "SpeakerNotes"
      : linkUrl.includes("functional-specifications")
      ? "Book"
      : "PhonelinkSetup",
      
      
      it should be separate master

Copy link
Collaborator

Choose a reason for hiding this comment

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

downt have hardcoded into system

? "SpeakerNotes"
: linkUrl.includes("functional-specifications")
? "Book"
: "PhonelinkSetup",
// link: queryParamIndex === -1 ? linkUrl : linkUrl.substring(0, queryParamIndex),
queryParams: queryParamIndex === -1 ? null : linkUrl.substring(queryParamIndex),
Expand Down Expand Up @@ -140,12 +144,24 @@ export const RoleBasedEmployeeHome = ({ modules, additionalComponent }) => {
const children = Object.keys(sortedConfigEmployeesSidebar)?.map((current, index) => {
const moduleData = sortedConfigEmployeesSidebar?.[current];
const configureData = moduleData?.links?.find((item) => item?.label === "Configure");
const howItWorks = moduleData?.links?.find((item) => item?.label === "How it works");
const userManual = moduleData?.links?.find((item) => item?.label === "Read User Manual");
const propsForModuleCard = {
icon: "SupervisorAccount",
moduleName: t(moduleData?.label),
metrics: [],
links: Digit.Utils.getMultiRootTenant() ? moduleData.links?.filter((item) => item.label !== "Configure") : moduleData.links,
centreChildren: [<div>{t(Digit.Utils.locale.getTransformedLocale(`MODULE_CARD_DESC_${current}`))}</div>],
links: Digit.Utils.getMultiRootTenant() ? moduleData.links?.filter((item) => item.label !== "Configure" && item.label !== "How it works" && item.label !== "Read User Manual") : moduleData.links,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why directly add the message ?
u will have to compare the message only

centreChildren: [<div>{t(Digit.Utils.locale.getTransformedLocale(`MODULE_CARD_DESC_${current}`))}</div>,
<Button
variation="teritiary"
label={userManual?.label}
icon={userManual?.icon}
type="button"
size={"medium"}
onClick={() => window.open(userManual?.link, "_blank")}
style={{ padding: "0px" }}
/>,
],
Comment on lines +185 to +195
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add key prop to React elements in centreChildren array.

The new button for the user manual has been added correctly and aligns with the PR objectives. However, React elements in an array should have a unique key prop to help React identify which items have changed, been added, or been removed.

Please add a unique key prop to each element in the centreChildren array. For example:

centreChildren: [
  <div key="description">{t(Digit.Utils.locale.getTransformedLocale(`MODULE_CARD_DESC_${current}`))}</div>,
  <Button
    key="userManual"
    variation="teritiary"
    label={userManual?.label}
    icon={userManual?.icon}
    type="button"
    size={"medium"}
    onClick={() => window.open(userManual?.link, "_blank")}
    style={{ padding: "0px" }}
  />,
],
🧰 Tools
🪛 Biome

[error] 154-154: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)


[error] 155-163: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

endChildren: Digit.Utils.getMultiRootTenant()
? [
<Button
Expand All @@ -157,6 +173,15 @@ export const RoleBasedEmployeeHome = ({ modules, additionalComponent }) => {
onClick={() => history?.push(configureData?.link)}
style={{ padding: "0px" }}
/>,
<Button
variation="teritiary"
label={howItWorks?.label}
icon={howItWorks?.icon}
type="button"
size={"medium"}
onClick={() => window.open(howItWorks?.link, "_blank")}
style={{ padding: "0px" }}
/>,
Comment on lines +207 to +215
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

LGTM with minor improvements: New "How it works" button added

The addition of the "How it works" button to the endChildren array is a good improvement and aligns with the PR objectives. The button is correctly implemented to open the link in a new tab.

However, there's a minor issue to address:

Add key props to the React elements in the endChildren array to help React identify which items have changed, been added, or been removed. For example:

endChildren: Digit.Utils.getMultiRootTenant()
  ? [
      <Button
        key="configure"
        variation="teritiary"
        label={configureData?.label}
        icon={configureData?.icon}
        type="button"
        size={"medium"}
        onClick={() => history?.push(configureData?.link)}
        style={{ padding: "0px" }}
      />,
      <Button
        key="howItWorks"
        variation="teritiary"
        label={howItWorks?.label}
        icon={howItWorks?.icon}
        type="button"
        size={"medium"}
        onClick={() => window.open(howItWorks?.link, "_blank")}
        style={{ padding: "0px" }}
      />,
    ]
  : null,
🧰 Tools
🪛 Biome

[error] 207-215: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

]
: null,
};
Expand Down