-
Notifications
You must be signed in to change notification settings - Fork 104
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
Reinstate Breadcrumbs #2023
Merged
anth-volk
merged 4 commits into
PolicyEngine:master
from
rachel-lawrie:lawrie_breadcrumbs
Oct 7, 2024
Merged
Reinstate Breadcrumbs #2023
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import { Helmet } from "react-helmet"; | |
import SearchParamNavButton from "../controls/SearchParamNavButton"; | ||
import style from "../style"; | ||
import DeprecationModal from "../modals/DeprecationModal"; | ||
import { impactKeys } from "../pages/policy/output/ImpactTypes.jsx"; | ||
|
||
export function ParameterSearch(props) { | ||
const { metadata, callback } = props; | ||
|
@@ -155,17 +156,88 @@ export default function PolicyPage(props) { | |
</FolderPage> | ||
); | ||
} else if (isOutput) { | ||
middle = ( | ||
<> | ||
// eslint-disable-next-line no-console | ||
console.log("focus:" + focus); | ||
const POLICY_OUTPUT_TREE = getPolicyOutputTree(metadata.countryId); | ||
const validFocusValues = impactKeys; | ||
const stripped_focus = focus.replace("policyOutput.", ""); | ||
// eslint-disable-next-line no-console | ||
console.log("stripped_focus:" + stripped_focus); | ||
// eslint-disable-next-line no-console | ||
console.log("valid values:" + validFocusValues); | ||
|
||
// Check if the current focus is within validFocusValues | ||
if ( | ||
focus === "policyOutput.policyBreakdown" || | ||
focus === "policyOutput.codeReproducibility" || | ||
validFocusValues.includes(stripped_focus) | ||
) { | ||
middle = ( | ||
<PolicyOutput | ||
metadata={metadata} | ||
policy={policy} | ||
userProfile={userProfile} | ||
/> | ||
</> | ||
); | ||
); | ||
} else { | ||
// Find the node in the tree where the name matches the focus | ||
const findNodeByName = (node, name) => { | ||
if (node.name === name) { | ||
return node; | ||
} | ||
if (node.children) { | ||
for (let child of node.children) { | ||
const result = findNodeByName(child, name); | ||
if (result) { | ||
return result; | ||
} | ||
} | ||
} | ||
return null; | ||
}; | ||
|
||
const node = findNodeByName(POLICY_OUTPUT_TREE[0], focus); | ||
|
||
// Render FolderPage with its children if the node is found | ||
if (node) { | ||
middle = ( | ||
<FolderPage label={node.label} metadata={metadata}> | ||
{node.children} | ||
</FolderPage> | ||
); | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.log("no node"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you remove this console log, as well? |
||
middle = <div>No matching node found.</div>; | ||
} | ||
} | ||
} | ||
|
||
// This code works | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit unclear as to what this commented code block is for |
||
// else if (isOutput && focus === "policyOutput") { | ||
// const POLICY_OUTPUT_TREE = getPolicyOutputTree(metadata.countryId); | ||
// // eslint-disable-next-line no-console | ||
// console.log('POLICY_OUTPUT_TREE:', POLICY_OUTPUT_TREE); | ||
|
||
// middle = ( | ||
// <FolderPage label="Policy output results" metadata={metadata}> | ||
// {POLICY_OUTPUT_TREE[0].children} | ||
// </FolderPage> | ||
// ); | ||
// } | ||
|
||
// else if (isOutput && focus !== "policyOutput") { | ||
// middle = ( | ||
// <> | ||
// <PolicyOutput | ||
// metadata={metadata} | ||
// policy={policy} | ||
// userProfile={userProfile} | ||
// /> | ||
// </> | ||
// ); | ||
// } | ||
|
||
if (mobile) { | ||
return ( | ||
<> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this and the below console statements?