diff --git a/src/App.vue b/src/App.vue
index 3314f74..881f1a9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -5,30 +5,60 @@
-
-
-
- Tell us about you.
-
- Write a few sentences about yourself or paste in your existing job
- summary.
-
-
-
-
- Tell us about the job.
-
- Please enter the job description and include all the requirements.
-
-
-
+
+
+
+ Oops! Looks like you forgot to tell us something.
+
+
+ Please fill in the missing information so we can keep things cookin'!
+
+ - Please provide a bio in step 3.
+ -
+ Please provide a job description in step 4.
+
+
+
+
+
-
- Your generated pitches
-
+
+
+
Your generated pitches
+
+
+ Don't forget to copy and paste your info!
+
+
+ We don't want you to have to re-type everything and risk getting
+ carpal tunnel syndrome!
+
+
+
-
import { inject } from '@vercel/analytics'
-import { onMounted, ref } from 'vue'
+import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import TheHeader from './components/TheHeader.vue'
import BaseButton from './components/BaseButton.vue'
+import BaseNotification from './components/BaseNotification.vue'
import StepInput from './components/StepInput.vue'
import ResultCardLoading from './components/ResultCardLoading.vue'
import ResultCard from './components/ResultCard.vue'
-const jobDescription = ref(
- 'Ex: A talented vegan chef who likes cooking desserts and has 78 years of experience.'
-)
-const bio = ref('Ex: A chef with 6 years of experience in cooking steaks.')
+const jobDescription = ref('')
+const bio = ref('')
const results = ref([])
const isLoading = ref(false)
+const hasAnyErrors = computed(() => {
+ return Object.values(errors).some((item) => item === true)
+})
+
+const errors = reactive({
+ jobDescription: false,
+ bio: false,
+})
+
+const calculateErrors = async () => {
+ // Reset errors so we can recalculate, since users may have since changed input values.
+ resetErrors()
+
+ // Let DOM update so assistive tech will be re-triggered.
+ await nextTick()
+
+ if (!bio.value) errors.bio = true
+ if (!jobDescription.value) errors.jobDescription = true
+}
+
+const resetErrors = () => {
+ Object.keys(errors).forEach((field) => {
+ errors[field] = false
+ })
+}
+
const getCompletion = async () => {
+ // Use may have double clicked
if (isLoading.value) return
+ await calculateErrors()
+ if (hasAnyErrors.value) return
+
isLoading.value = true
const response = await fetch('/api/generate', {
diff --git a/src/components/BaseNotification.stories.js b/src/components/BaseNotification.stories.js
new file mode 100644
index 0000000..812504a
--- /dev/null
+++ b/src/components/BaseNotification.stories.js
@@ -0,0 +1,48 @@
+import BaseNotification from './BaseNotification.vue'
+
+export default {
+ title: 'Notifications',
+ component: BaseNotification,
+}
+
+const StatusTemplate = (args) => ({
+ components: { BaseNotification },
+ setup() {
+ return { args }
+ },
+ template: `
+
+
+ Poke poke, this is a gentle reminder about something shiny.
+
+
+ In order to get the most out of this app, please adjust your phasers to stun and hold on tight to the handrails.
+
+ `,
+})
+
+export const Status = StatusTemplate.bind({})
+Status.args = {
+ role: 'status',
+}
+
+const AlertTemplate = (args) => ({
+ components: { BaseNotification },
+ setup() {
+ return { args }
+ },
+ template: `
+
+
+ Oops! This is an alert which will warn you that things have gone wonky!
+
+
+ Please do brush your unicorn a little more thorougly, so that your unicorn will keep that glossy mane and coat we've come to know and love.
+
+ `,
+})
+
+export const Alert = AlertTemplate.bind({})
+Alert.args = {
+ role: 'alert',
+}
diff --git a/src/components/BaseNotification.vue b/src/components/BaseNotification.vue
new file mode 100644
index 0000000..4c56106
--- /dev/null
+++ b/src/components/BaseNotification.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
diff --git a/src/components/StepInput.vue b/src/components/StepInput.vue
index 573a806..c0fe0c8 100644
--- a/src/components/StepInput.vue
+++ b/src/components/StepInput.vue
@@ -3,7 +3,12 @@ import BaseLabel from './BaseLabel.vue';
-
+
@@ -15,6 +20,8 @@ import BaseLabel from './BaseLabel.vue';