Skip to content

Commit c675a4c

Browse files
committed
Refactor finish minimum and advance into a single finish screen
1 parent e78b711 commit c675a4c

8 files changed

Lines changed: 70 additions & 145 deletions

File tree

cypress/e2e/spec.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('Basic usage', () => {
7474
cy.dataCy('btn-next')
7575
.click()
7676

77-
// Finish Minimum screen
77+
// Finish screen (minimum version)
7878
cy.url().should('include', '/finish')
7979
cy.dataCy('btn-download')
8080
.click()
@@ -130,7 +130,7 @@ describe('Basic usage', () => {
130130
cy.dataCy('btn-next')
131131
.click()
132132

133-
// Finish Minimum screen
133+
// Finish screen (minimum version)
134134
cy.url().should('include', '/finish')
135135
cy.dataCy('btn-add-more')
136136
.click()
@@ -240,7 +240,7 @@ describe('Basic usage', () => {
240240
cy.dataCy('btn-next')
241241
.click()
242242

243-
// Finish Advanced screen
243+
// Finish screen (advanced version)
244244
cy.url().should('include', '/finish')
245245
cy.dataCy('btn-download')
246246
.click()

src/components/LayoutStepper.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default defineComponent({
9494
return {
9595
isNotFinish: computed(() => {
9696
const currentPath = useRoute().path
97-
return currentPath !== '/finish-minimum' && currentPath !== '/finish-advanced'
97+
return currentPath !== '/finish'
9898
}),
9999
isPreviewDrawerEnabled,
100100
onTogglePreview: () => { isPreviewDrawerEnabled.value = !isPreviewDrawerEnabled.value }
Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,36 @@
1313
</h1>
1414

1515
<div v-if="isValidCFF">
16-
<p class="finish-paragraph">
16+
<p
17+
v-if="!showAdvanced"
18+
class="finish-paragraph"
19+
>
20+
You now have a minimal CITATION.cff file. Use the buttons below to download your CITATION.cff file, continue adding more properties, or reset the form.
21+
</p>
22+
<p
23+
v-else
24+
class="finish-paragraph"
25+
>
1726
Use the buttons below to download your CITATION.cff file, or reset the form to start over.
1827
</p>
1928
<p class="finish-paragraph">
2029
Distribute the CITATION.cff with your project, for instance, by adding it to the root of your GitHub repository.
2130
</p>
2231
<div class="row">
2332
<DownloadButton class="col-4 q-ma-lg" />
33+
<q-btn
34+
v-if="!showAdvanced"
35+
class="col-4 q-ma-lg"
36+
color="primary"
37+
data-cy="btn-add-more"
38+
icon="workspace_premium"
39+
label="Add more"
40+
no-caps
41+
size="xl"
42+
to="/identifiers"
43+
v-on:click="setupAdvanced"
44+
v-bind:class="q.platform.is.mobile ? 'full-width' : ''"
45+
/>
2446
</div>
2547
<div class="row">
2648
<q-btn
@@ -51,18 +73,17 @@ import { useStepperErrors } from 'src/store/stepper-errors'
5173
import { useValidation } from 'src/store/validation'
5274
5375
export default defineComponent({
54-
name: 'ScreenFinishAdvanced',
76+
name: 'ScreenFinish',
5577
components: {
5678
DownloadButton
5779
},
5880
setup () {
59-
const { setStepName, setShowAdvanced } = useApp()
81+
const { setStepName, setShowAdvanced, showAdvanced } = useApp()
6082
const { reset: resetCffData } = useCff()
6183
const { reset: resetStepperErrorState } = useStepperErrors()
6284
const { errors } = useValidation()
6385
const q = useQuasar()
6486
return {
65-
isValidCFF: computed(() => errors.value.length === 0),
6687
confirmAndReset: () => {
6788
q.dialog({
6889
title: 'Confirm',
@@ -75,7 +96,14 @@ export default defineComponent({
7596
setShowAdvanced(false)
7697
await setStepName('start')
7798
})
78-
}
99+
},
100+
isValidCFF: computed(() => errors.value.length === 0),
101+
q,
102+
setupAdvanced: async () => {
103+
setShowAdvanced(true)
104+
await setStepName('identifiers')
105+
},
106+
showAdvanced
79107
}
80108
}
81109
})

src/components/ScreenFinishMinimum.vue

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/components/Stepper.vue

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,13 @@
3232
v-on:click="setStepName('authors')"
3333
/>
3434

35-
<q-step
36-
active-icon="navigate_next"
37-
data-cy="step-finish-minimum"
38-
name="finish-minimum"
39-
title="Finish"
40-
v-bind:order="2"
41-
v-if="!showAdvanced"
42-
v-on:click="setStepName('finish-minimum')"
43-
/>
44-
4535
<q-step
4636
data-cy="step-identifiers"
4737
name="identifiers"
4838
title="Identifiers"
4939
v-bind:active-icon="errorStateScreenIdentifiers ? 'warning' : 'edit'"
5040
v-bind:error="errorStateScreenIdentifiers"
51-
v-bind:order="3"
41+
v-bind:order="2"
5242
v-if="showAdvanced"
5343
v-on:click="setStepName('identifiers')"
5444
/>
@@ -59,7 +49,7 @@
5949
title="Related resources"
6050
v-bind:active-icon="errorStateScreenRelatedResources ? 'warning' : 'edit'"
6151
v-bind:error="errorStateScreenRelatedResources"
62-
v-bind:order="4"
52+
v-bind:order="3"
6353
v-if="showAdvanced"
6454
v-on:click="setStepName('related-resources')"
6555
/>
@@ -68,7 +58,7 @@
6858
data-cy="step-abstract"
6959
name="abstract"
7060
title="Abstract"
71-
v-bind:order="5"
61+
v-bind:order="4"
7262
v-if="showAdvanced"
7363
v-on:click="setStepName('abstract')"
7464
/>
@@ -79,7 +69,7 @@
7969
title="Keywords"
8070
v-bind:active-icon="errorStateScreenKeywords ? 'warning' : 'edit'"
8171
v-bind:error="errorStateScreenKeywords"
82-
v-bind:order="6"
72+
v-bind:order="5"
8373
v-if="showAdvanced"
8474
v-on:click="setStepName('keywords')"
8575
/>
@@ -88,7 +78,7 @@
8878
data-cy="step-license"
8979
name="license"
9080
title="License"
91-
v-bind:order="7"
81+
v-bind:order="6"
9282
v-if="showAdvanced"
9383
v-on:click="setStepName('license')"
9484
/>
@@ -99,19 +89,18 @@
9989
title="Version specific"
10090
v-bind:active-icon="errorStateScreenVersionSpecific ? 'warning' : 'edit'"
10191
v-bind:error="errorStateScreenVersionSpecific"
102-
v-bind:order="8"
92+
v-bind:order="7"
10393
v-if="showAdvanced"
10494
v-on:click="setStepName('version-specific')"
10595
/>
10696

10797
<q-step
10898
active-icon="navigate_next"
109-
data-cy="step-finish-advanced"
110-
name="finish-advanced"
99+
data-cy="step-finish"
100+
name="finish"
111101
title="Finish"
112-
v-bind:order="9"
113-
v-if="showAdvanced"
114-
v-on:click="setStepName('finish-advanced')"
102+
v-bind:order="showAdvanced ? 8 : 2"
103+
v-on:click="setStepName('finish')"
115104
/>
116105
</q-stepper>
117106
</template>

src/components/StepperActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
label="Finish"
2323
no-caps
2424
v-bind:class="!showAdvanced ? 'hidden' : ''"
25-
v-bind:to="showAdvanced === true ? '/finish-advanced' : '/finish-minimum'"
25+
to="/finish"
2626
/>
2727
<q-btn
2828
color="primary"

src/router/routes.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const routes: RouteRecordRaw[] = [
1919
component: () => import('src/components/LayoutStepper.vue'),
2020
children: [{ path: '', component: () => import('src/components/ScreenAuthors.vue') }]
2121
},
22-
{
23-
path: '/finish-minimum',
24-
component: () => import('src/components/LayoutStepper.vue'),
25-
children: [{ path: '', component: () => import('src/components/ScreenFinishMinimum.vue') }]
26-
},
2722
{
2823
path: '/identifiers',
2924
component: () => import('src/components/LayoutStepper.vue'),
@@ -55,9 +50,9 @@ const routes: RouteRecordRaw[] = [
5550
children: [{ path: '', component: () => import('src/components/ScreenVersionSpecific.vue') }]
5651
},
5752
{
58-
path: '/finish-advanced',
53+
path: '/finish',
5954
component: () => import('src/components/LayoutStepper.vue'),
60-
children: [{ path: '', component: () => import('src/components/ScreenFinishAdvanced.vue') }]
55+
children: [{ path: '', component: () => import('src/components/ScreenFinish.vue') }]
6156
},
6257
{
6358
path: '/404',

0 commit comments

Comments
 (0)