Skip to content

Commit

Permalink
Debug launch context
Browse files Browse the repository at this point in the history
  • Loading branch information
vesnushka committed Aug 16, 2023
1 parent 56aae57 commit 5e4789b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web/src/components/LaunchContextEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,30 @@ interface Param {

function useLaunchContext(questionnaire: Questionnaire) {
const launchContextParams = groupLaunchContextParams(questionnaire);
console.log('LaunchContextEditor useLaunchContext launchContextParams', launchContextParams);
const allParams = launchContextParams
.map((ext) => ({
name: ext.extension?.find((ext) => ext?.url === 'name')?.valueCoding?.code,
types: ext.extension?.filter((ext) => ext?.url === 'type').map((t) => t.valueCode),
}))
.filter(({ name, types }) => typeof name !== 'undefined' || types?.length) as Param[];
console.log('LaunchContextEditor useLaunchContext allParams', allParams);

return { allParams };
}

export function LaunchContextEditor(props: Props) {
const { questionnaire, launchContext, onChange, onRemove } = props;
console.log('LaunchContextEditor questionnaire', questionnaire);
console.log('LaunchContextEditor launchContext', launchContext);
const { allParams } = useLaunchContext(questionnaire);
const [activeTab, setActiveTab] = useState(allParams[0]);

const activeParam = useMemo(
() => launchContext.parameter?.find((p) => p.name === activeTab?.name),
[launchContext, activeTab],
);
console.log('LaunchContextEditor activeParam', activeParam);

const renderTabContent = () => {
if (!activeTab) {
Expand Down

0 comments on commit 5e4789b

Please sign in to comment.