Skip to content

Commit

Permalink
some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hadijahkyampeire committed Sep 25, 2024
1 parent 96307ee commit 4183b23
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const PackageModal: React.FC<PackageModalProps> = ({ closeModal, schema, onSchem
},
};

onSchemaChange(updatedSchema);
onSchemaChange(JSON.parse(JSON.stringify(updatedSchema, null, 2)));

setTitle('');
setSlotName('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
};

if (!schema) {
onSchemaChange({ ...dummySchema });
onSchemaChange(dummySchema);
return dummySchema;
}

return schema || dummySchema;
Expand Down
17 changes: 0 additions & 17 deletions src/components/schema-editor/dummy-schema.ts

This file was deleted.

10 changes: 6 additions & 4 deletions src/components/view-editor/view-editor.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ContentPackagesEditorContent: React.FC<TranslationFnProps> = ({ t }) => {

const updateSchema = useCallback((updatedSchema: Schema) => {
setSchema(updatedSchema);
const stringfiedJson: string = JSON.stringify(updatedSchema);
const stringfiedJson: string = JSON.stringify(updatedSchema, null, 2);
setStringifiedSchema(stringfiedJson);
}, []);

Expand Down Expand Up @@ -144,7 +144,7 @@ const ContentPackagesEditorContent: React.FC<TranslationFnProps> = ({ t }) => {
].title;
}
}
return 'default_schema_name';
return '';
};

const handleSavePackage = () => {
Expand Down Expand Up @@ -181,7 +181,7 @@ const ContentPackagesEditorContent: React.FC<TranslationFnProps> = ({ t }) => {
};

const navGroupTitle = getNavGroupTitle(schema);
const sanitizedTitle = navGroupTitle.replace(/\s+/g, '_');
const sanitizedTitle = navGroupTitle?.replace(/\s+/g, '_');

const responsiveSize = isMaximized ? 16 : 8;
const defaultEnterDelayInMs = 300;
Expand Down Expand Up @@ -263,7 +263,9 @@ const ContentPackagesEditorContent: React.FC<TranslationFnProps> = ({ t }) => {
<span className={styles.tabHeading}>{t('interactiveBuilder', 'Interactive Builder')}</span>
<div className={styles.topBtns}>
<Button disabled={!navGroupTitle || isSaving} onClick={handleSavePackage}>
{schema && schema.id ? t('updateSchema', 'Update Schema') : t('saveClinicalView', 'Save clinical view')}
{schema && clinicalViewId
? t('updateSchema', 'Update Schema')
: t('saveClinicalView', 'Save clinical view')}
</Button>
</div>
</div>
Expand Down

0 comments on commit 4183b23

Please sign in to comment.