Skip to content

Commit

Permalink
refactoring as part of #2
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-koenig committed Mar 4, 2024
1 parent 53b7bcf commit 28294fd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 31 deletions.
21 changes: 7 additions & 14 deletions config/breedfides/wizard.steps.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,13 @@ window.steps = [
]
},
{
title: 'Please provide all Authors of your Dataset and define their Contribution.',
fields: [
{
label: 'Authors',
type: 'people',
isaMapping: {
jsonPath: 'people'
},
explanation: 'DM-16',
componentConfig: {
showComments: false
}
}
],
title: 'Please provide the Authors of your Dataset and define their Contribution.',
component: 'People',
jsonPath: 'people',
componentConfig: {
showComments: false,
label: 'Authors'
}
},
{
hooks: [
Expand Down
19 changes: 6 additions & 13 deletions config/miappe/wizard.steps.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,12 @@ window.steps = [
},
{
title: 'Please provide the Authors of your Dataset and define their Contribution.',
fields: [
{
label: 'Authors',
type: 'people',
isaMapping: {
jsonPath: 'people'
},
explanation: 'DM-16',
componentConfig: {
showComments: false
}
}
]
component: 'People',
jsonPath: 'people',
componentConfig: {
showComments: false,
label: 'Authors'
}
},
{
hooks: [
Expand Down
6 changes: 5 additions & 1 deletion src/components/isa/generic/People.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const addPerson = async () => {
people = [...people, emptyPerson];
}
if (componentConfig.label) {
label = componentConfig.label;
}
let __person__ = 'person';
if (label === 'Authors') {
__person__ = 'Author';
Expand All @@ -32,7 +36,7 @@ function onRemovePerson(event) {
<h3>{label}</h3>

{#each people as person, index}
<Person on:change on:removePerson={onRemovePerson} bind:person wording={__person__} countPeople={people.length} {componentConfig} {index} />
<Person on:change on:removePerson={onRemovePerson} bind:person countPeople={people.length} {componentConfig} {index} />
{/each}

<button class="btn" on:click|preventDefault={() => addPerson()}>Add {__person__}</button>
Expand Down
1 change: 0 additions & 1 deletion src/components/isa/generic/Person.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script>
export let person;
export let index;
export let wording = 'person';
export let countPeople = 1;
export let componentConfig = {};
Expand Down
5 changes: 3 additions & 2 deletions src/components/questionnaire/GenericQuestionnaire.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const fieldTypes = {
'text': String,
'textarea': Textarea,
'date': Date,
'people': People,
'ror': ResearchOrganizationRegistryPicker,
'license': LicensePicker,
}
Expand All @@ -54,7 +53,8 @@ const components = {
'Materials': Materials,
'ProtocolParametersSelect': ProtocolParametersSelect,
'FactorsSelect': FactorsSelect,
'Uploader': Uploader
'Uploader': Uploader,
'People': People
}
let steps = config.steps;
Expand Down Expand Up @@ -200,6 +200,7 @@ onMount(() => {
<ComponentWrapperJsonPath
component={components[steps[currentStep].component]}
jsonPath={steps[currentStep].jsonPath}
componentConfig={steps[currentStep].componentConfig}
/>
{/if}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
export let component;
export let jsonPath = undefined;
export let componentConfig = {};
import { isaObj } from '@/stores/isa';
Expand All @@ -16,6 +17,7 @@ if (jsonPath) {
this={component}
bind:value={$value}
jsonPath={jsonPath}
{componentConfig}
/>

<style>
Expand Down

0 comments on commit 28294fd

Please sign in to comment.