Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
[WOLFPAL-53] Added basic page for yearly goals. (#85)
Browse files Browse the repository at this point in the history
Currently commented out on the pages as it needs to be doced and more to be added.
  • Loading branch information
Nathan Henniges authored May 18, 2021
1 parent d675d4a commit 7b68367
Show file tree
Hide file tree
Showing 12 changed files with 3,481 additions and 6,039 deletions.
9 changes: 4 additions & 5 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ module.exports = {
root: true,
env: {
browser: true,
node: true,
node: true
},
parserOptions: {
parser: 'babel-eslint',
parser: 'babel-eslint'
},
extends: [
'@nuxtjs',
'prettier',
'prettier/vue',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
'plugin:nuxt/recommended'
],
plugins: ['prettier'],
// add your custom rules here
rules: {},
rules: { 'prettier/prettier': 0 }
}
4 changes: 3 additions & 1 deletion client/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"semi": false,
"singleQuote": true
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "none"
}
44 changes: 25 additions & 19 deletions client/components/Goals/Weekly.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ export default {
methods: {
async addGoal() {
try {
await this.$store.dispatch('goals/ADD_WEEKLY_GOAL', this.newGoal)
if (this.$store.state.goals.messages.success) {
await this.$store.dispatch('goals/weekly/ADD_GOAL', this.newGoal)
if (this.$store.state.goals.weekly.messages.success) {
this.newGoal.title = ''
this.newGoal.isCompleted = false
return this.$toast.success(this.$store.state.goals.messages.success, {
return this.$toast.success(this.$store.state.goals.weekly.messages.success, {
position: 'bottom-right',
})
}
if (this.$store.state.goals.messages.error) {
return this.$toast.error(this.$store.state.goals.messages.error, {
if (this.$store.state.goals.weekly.messages.error) {
return this.$toast.error(this.$store.state.goals.weekly.messages.error, {
position: 'bottom-right',
})
}
if (this.$store.state.goals.messages.errors) {
const { title } = this.$store.state.goals.messages.errors
if (this.$store.state.goals.weekly.messages.errors) {
const { title } = this.$store.state.goals.weekly.messages.errors
if (title) {
return this.$toast.error(title, {
position: 'bottom-right',
Expand All @@ -108,14 +108,14 @@ export default {
},
async removeGoal(index) {
try {
await this.$store.dispatch('goals/REMOVE_WEEKLY_GOAL', index)
await this.$store.dispatch('goals/weekly/REMOVE_GOAL', index)
if (this.$store.state.goals.messages.success) {
return this.$toast.success(this.$store.state.goals.messages.success, {
if (this.$store.state.goals.weekly.messages.success) {
return this.$toast.success(this.$store.state.goals.weekly.messages.success, {
position: 'bottom-right',
})
}
this.$toast.error(this.$store.state.goals.messages.error, {
this.$toast.error(this.$store.state.goals.weekly.messages.error, {
position: 'bottom-right',
})
} catch (e) {
Expand All @@ -126,13 +126,16 @@ export default {
},
async markGoalComplete(index) {
try {
await this.$store.dispatch('goals/MODIFY_GOAL_IS_COMPLETE', index)
if (this.$store.state.goals.messages.success) {
this.$toast.success(this.$store.state.goals.messages.success, {
await this.$store.dispatch(
'goals/weekly/MODIFY_GOAL_IS_COMPLETE',
index
)
if (this.$store.state.goals.weekly.messages.success) {
this.$toast.success(this.$store.state.goals.weekly.messages.success, {
position: 'bottom-right',
})
}
this.$toast.error(this.$store.state.goals.messages.error, {
this.$toast.error(this.$store.state.goals.weekly.messages.error, {
position: 'bottom-right',
})
} catch (e) {
Expand All @@ -143,13 +146,16 @@ export default {
},
async markGoalNotComplete(index) {
try {
await this.$store.dispatch('goals/MODIFY_GOAL_IS_NOT_COMPLETE', index)
if (this.$store.state.goals.messages.success) {
this.$toast.success(this.$store.state.goals.messages.success, {
await this.$store.dispatch(
'goals/weekly/MODIFY_GOAL_IS_NOT_COMPLETE',
index
)
if (this.$store.state.goals.weekly.messages.success) {
this.$toast.success(this.$store.state.goals.weekly.messages.success, {
position: 'bottom-right',
})
}
this.$toast.error(this.$store.state.goals.messages.error, {
this.$toast.error(this.$store.state.goals.weekly.messages.error, {
position: 'bottom-right',
})
} catch (e) {
Expand Down
82 changes: 82 additions & 0 deletions client/components/Goals/Yearly.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<template>
<div class="px-6 py-2 rounded shadow bg-gray-50 dark:bg-gray-200">
<div
v-if="goals.length === 0"
class="flex flex-wrap items-center justify-between"
>
<div class="flex items-center flex-1 w-0">
<fa
:icon="['fas', 'exclamation-triangle']"
class="mr-3 text-xl align-middle text-primary-800"
/>
<span
class="ml-3 text-base font-medium text-white dark:text-gray-900 font-roboto"
>
Uh oh looks like you have not made any yearly goals yet.
</span>
</div>
<div
class="flex-shrink-0 order-3 w-full mt-2 sm:order-2 sm:mt-0 sm:w-auto"
>
<a
href="#"
class="flex items-center justify-center px-4 py-2 text-sm font-medium text-white border border-transparent rounded-md shadow-sm bg-primary-600 hover:bg-primary-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"
>
Create
</a>
</div>
</div>
<div v-for="(goal, index) in goals" :key="index">
<div class="flex items-center mb-4">
<p
:class="{ 'text-green-500 dark:text-green-400': goal.isCompleted }"
class="w-full text-xl font-medium leading-5 text-gray-900 break-all font-montserrat"
>
{{ goal.title }}
</p>
<button
:class="{
'border-green-500': goal.isCompleted,
'border-gray-400 dark:border-gray-500': !goal.isCompleted
}"
class="p-2 ml-4 mr-2 text-green-500 border-2 rounded flex-no-shrink hover:text-white hover:bg-green-500 hover:border-green-500 dark-hover:border-green-500 toggle-complete-goal focus:outline-none"
>
<fa
:class="{ invisible: !goal.isCompleted }"
:icon="['fas', 'check']"
class="w-6 h-6 ml-1 mr-1 text-2xl align-middle"
/>
</button>

<button
class="p-2 ml-2 text-red-500 border-2 border-red-500 rounded flex-no-shrink hover:text-white hover:bg-red-500 focus:outline-none"
>
<fa
:icon="['fas', 'trash']"
class="w-6 h-6 ml-1 mr-1 text-xl align-middle"
/>
</button>
</div>
</div>
</div>
</template>

<script>
export default {
props: {
goals: {
type: Array,
default: () => []
}
},
data() {
return {}
}
}
</script>

<style scoped>
.toggle-complete-goal:hover svg {
visibility: visible !important;
}
</style>
20 changes: 10 additions & 10 deletions client/layouts/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ import HeroIconOutLineMenuAlt2 from '@/assets/vectors/heroicon/outline/menu-alt-
export default {
components: {
HeroIconOutLineMenuAlt2,
HeroIconOutLineMenuAlt2
},
data() {
return {
links: [
{
url: '/dashboard',
text: 'Dashboard',
text: 'Dashboard'
},
{
url: '/dashboard/goals/weekly',
text: 'Weekly Goals',
},
],
url: '/dashboard/weekly',
text: 'Weekly Goals'
}
]
}
},
Expand All @@ -71,7 +71,7 @@ export default {
await this.$store.commit('dashboard/SET_SIDEBAR_OPEN', false)
} catch (e) {
this.$toast.error('Oops.. Something Went Wrong..', {
position: 'bottom-right',
position: 'bottom-right'
})
}
},
Expand All @@ -81,10 +81,10 @@ export default {
await this.$store.commit('dashboard/SET_SIDEBAR_OPEN', true)
} catch (e) {
this.$toast.error('Oops.. Something Went Wrong..', {
position: 'bottom-right',
position: 'bottom-right'
})
}
},
},
}
}
}
</script>
Loading

0 comments on commit 7b68367

Please sign in to comment.