Env swap #21

Merged
danieljsummers merged 30 commits from env-swap into help-wanted 2021-08-10 03:23:50 +00:00
4 changed files with 51 additions and 6 deletions
Showing only changes of commit 0679fe04ef - Show all commits

View File

@ -9,14 +9,19 @@
<component :is="Component" /> <component :is="Component" />
</transition> </transition>
</router-view> </router-view>
<button @click.prevent="showToast('howdy', 'danger')">Show toast</button>
</main> </main>
<app-footer /> <app-footer />
<div aria-live="polite" aria-atomic="true">
<div class="toast-container position-absolute p-3 bottom-0 start-50 translate-middle-x" id="toasts"></div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { Toast } from 'bootstrap'
import AppFooter from './components/layout/AppFooter.vue' import AppFooter from './components/layout/AppFooter.vue'
import AppNav from './components/layout/AppNav.vue' import AppNav from './components/layout/AppNav.vue'
import TitleBar from './components/layout/TitleBar.vue' import TitleBar from './components/layout/TitleBar.vue'
@ -30,6 +35,11 @@ export default defineComponent({
AppFooter, AppFooter,
AppNav, AppNav,
TitleBar TitleBar
},
setup () {
return {
showToast
}
} }
}) })
@ -42,6 +52,33 @@ export default defineComponent({
export function yesOrNo (cond : boolean) : string { export function yesOrNo (cond : boolean) : string {
return cond ? 'Yes' : 'No' return cond ? 'Yes' : 'No'
} }
/**
* Show a toast notification
*
* @param text The text of the notification
* @param type The type of notification to show (defaults to 'success')
* @param heading The optional text to use for the heading
*/
export function showToast (text : string, type = 'success', heading : string | undefined) : void {
let header : HTMLDivElement | undefined
if (heading) {
header = document.createElement('div')
header.className = 'toast-header'
header.innerHTML = 'The Header'
}
const body = document.createElement('div')
body.className = 'toast-body'
body.innerHTML = text
const toast = document.createElement('div')
if (header) toast.appendChild(header)
toast.appendChild(body)
toast.className = `toast bg-${type} text-white`
;(document.getElementById('toasts') as HTMLDivElement).appendChild(toast)
new Toast(toast).show()
}
</script> </script>
<style lang="sass"> <style lang="sass">

View File

@ -1,14 +1,16 @@
<template> <template>
<article class="container"> <article class="container">
<page-title title="Dashboard" /> <page-title title="Dashboard" />
<h3>Welcome, {{user.name}}</h3> <h3 class="pb-4">Welcome, {{user.name}}</h3>
<load-data :load="retrieveData"> <load-data :load="retrieveData">
<div class="row row-cols-1 row-cols-md-2"> <div class="row row-cols-1 row-cols-md-2">
<div class="col"> <div class="col">
<div class="card h-100"> <div class="card h-100">
<h5 class="card-header">Your Profile</h5> <h5 class="card-header">Your Profile</h5>
<div class="card-body"> <div class="card-body">
<h6 class="card-subtitle mb-3 text-muted">Last updated <full-date :date="profile.lastUpdatedOn" /></h6> <h6 class="card-subtitle mb-3 text-muted fst-italic">
Last updated <full-date :date="profile.lastUpdatedOn" />
</h6>
<p v-if="profile" class="card-text"> <p v-if="profile" class="card-text">
Your profile currently lists {{profile.skills.length}} Your profile currently lists {{profile.skills.length}}
skill<template v-if="profile.skills.length !== 1">s</template>. skill<template v-if="profile.skills.length !== 1">s</template>.
@ -36,7 +38,7 @@
<div class="card h-100"> <div class="card h-100">
<h5 class="card-header">Other Citizens</h5> <h5 class="card-header">Other Citizens</h5>
<div class="card-body"> <div class="card-body">
<h6 class="card-subtitle mb-3 text-muted"> <h6 class="card-subtitle mb-3 text-muted fst-italic">
<template v-if="profileCount === 0">No</template><template v-else>{{profileCount}} Total</template> <template v-if="profileCount === 0">No</template><template v-else>{{profileCount}} Total</template>
Employment Profile<template v-if="profileCount !== 1">s</template> Employment Profile<template v-if="profileCount !== 1">s</template>
</h6> </h6>

View File

@ -111,8 +111,8 @@ import { useRouter } from 'vue-router'
import api, { Citizen, LogOnSuccess, Profile, ProfileForm } from '@/api' import api, { Citizen, LogOnSuccess, Profile, ProfileForm } from '@/api'
import { useStore } from '@/store' import { useStore } from '@/store'
import MarkdownEditor from '@/components/MarkdownEditor.vue'
import LoadData from '@/components/LoadData.vue' import LoadData from '@/components/LoadData.vue'
import MarkdownEditor from '@/components/MarkdownEditor.vue'
import ProfileSkillEdit from '@/components/profile/SkillEdit.vue' import ProfileSkillEdit from '@/components/profile/SkillEdit.vue'
export default defineComponent({ export default defineComponent({
@ -197,6 +197,11 @@ export default defineComponent({
profile.value = form profile.value = form
} }
/** Save the current profile values */
const saveProfile = async () => {
// TODO
}
return { return {
retrieveData, retrieveData,
user, user,
@ -205,6 +210,7 @@ export default defineComponent({
continents: computed(() => store.state.continents), continents: computed(() => store.state.continents),
addSkill, addSkill,
removeSkill, removeSkill,
saveProfile,
viewProfile: () => router.push(`/profile/view/${user.citizenId}`) viewProfile: () => router.push(`/profile/view/${user.citizenId}`)
} }
} }

View File

@ -3,8 +3,8 @@
<page-title title="Success Story" /> <page-title title="Success Story" />
<load-data :load="retrieveStory"> <load-data :load="retrieveStory">
<h3>{{citizenName}}&rsquo;s Success Story</h3> <h3>{{citizenName}}&rsquo;s Success Story</h3>
<h4><full-date-time :date="story.recordedOn" /></h4> <h4 class="text-muted"><full-date-time :date="story.recordedOn" /></h4>
<p v-if="story.fromHere"><em><strong>Found via Jobs, Jobs, Jobs</strong></em></p> <p v-if="story.fromHere" class="fst-italic"><strong>Found via Jobs, Jobs, Jobs</strong></p>
<hr> <hr>
<div v-if="story.story" v-html="successStory"></div> <div v-if="story.story" v-html="successStory"></div>
</load-data> </load-data>