chore: tracking info data fixes

This commit is contained in:
JesusPerez 2022-03-24 12:54:08 +00:00
parent 39b6367992
commit 8d91ba5649
5 changed files with 40 additions and 30 deletions

View File

@ -352,29 +352,30 @@ const onView = (itm: string) => {
useState().showinfo.value[itm] = !useState().showinfo.value[itm] useState().showinfo.value[itm] = !useState().showinfo.value[itm]
} }
const onNavMenu = (item: { src: string, target: string }) => { const onNavMenu = (item: { src: string, target: string }) => {
const lng = i18n.locale.value
switch (item.src) { switch (item.src) {
case 'locale': case 'locale':
track_action(null, { ref: 'locale',text: i18n.locale.value}) track_action(null, { ref: 'locale',text: i18n.locale.value, lng},routeKy.toString())
refresh() refresh()
break break
case 'infopanel': case 'infopanel':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
show_infopanel.value = !show_infopanel.value show_infopanel.value = !show_infopanel.value
break break
case 'fixmenu': case 'fixmenu':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
fixMenu.value = !fixMenu.value fixMenu.value = !fixMenu.value
break break
case 'endinput': case 'endinput':
show_input.value = false show_input.value = false
break break
case 'select': case 'select':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
message_type.value = MessageBoxType.Select message_type.value = MessageBoxType.Select
openMessageBox.value = true openMessageBox.value = true
break break
case 'save': case 'save':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
input_placeholder.value = `${t('name', 'Name')} o 'data'` input_placeholder.value = `${t('name', 'Name')} o 'data'`
show_input.value = true show_input.value = true
message_type.value = MessageBoxType.Save message_type.value = MessageBoxType.Save
@ -382,20 +383,20 @@ const onNavMenu = (item: { src: string, target: string }) => {
openMessageBox.value = true openMessageBox.value = true
break break
case 'editable': case 'editable':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
useState().authinfo.value.editable = !useState().authinfo.value.editable useState().authinfo.value.editable = !useState().authinfo.value.editable
const state = useState().authinfo.value.editable ? 'on' : 'off' const state = useState().authinfo.value.editable ? 'on' : 'off'
const msgTyp = state === 'on' ? MessageType.Warning : MessageType.Info const msgTyp = state === 'on' ? MessageType.Warning : MessageType.Info
show_message(msgTyp, `${t('saveload.editMode','Edit Mode')} ${t('cv.'+state,'')}`) show_message(msgTyp, `${t('saveload.editMode','Edit Mode')} ${t('cv.'+state,'')}`)
break break
case 'viewchange': case 'viewchange':
track_action(null, { ref: 'onNavMenu',text: 'item.src'}) track_action(null, { ref: 'onNavMenu',text: item.src, lng},routeKy.toString())
useState().authinfo.value.viewchange = !useState().authinfo.value.viewchange useState().authinfo.value.viewchange = !useState().authinfo.value.viewchange
break break
case 'goto': case 'goto':
const dom_id = document.getElementById(item.target) const dom_id = document.getElementById(item.target)
if (dom_id) { if (dom_id) {
track_action(null, { ref: 'gotp',text: item.target}) track_action(null, { ref: 'gotp',text: item.target, lng},routeKy.toString())
dom_id.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }) dom_id.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' })
setTimeout(() => window.scrollBy(0, -40), 4000) setTimeout(() => window.scrollBy(0, -40), 4000)
} }
@ -424,13 +425,13 @@ const saveData = async(mode: string,val: string) => {
if (mode == 'send' && url !== '') { if (mode == 'send' && url !== '') {
onMessageBox({src: 'done', val: ''}) onMessageBox({src: 'done', val: ''})
const res = await send_data(url, cv, true, true, () => { const res = await send_data(url, cv, true, true, () => {
track_action(null, { ref: 'saveData',text: `${url} -> ${val}`}) track_action(null, { ref: 'saveData',text: `${url} -> ${val}`, lng: i18n.locale.value },routeKy.toString())
show_message(MessageType.Success, `${t('saveload.dataSaved','Data saved')}`,2000,() => { show_message(MessageType.Success, `${t('saveload.dataSaved','Data saved')}`,2000,() => {
}) })
}) })
console.log(res) console.log(res)
} else { } else {
track_action(null, { ref: 'saveData',text: `local_json -> ${val}`}) track_action(null, { ref: 'saveData',text: `local_json -> ${val}`, lng: i18n.locale.value },routeKy.toString())
show_message(MessageType.Warning, `${t('saveload.saveData','Save data')}`,2000,() => { show_message(MessageType.Warning, `${t('saveload.saveData','Save data')}`,2000,() => {
data_url_encoded.value = `text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(cv))}` data_url_encoded.value = `text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(cv))}`
}) })
@ -477,16 +478,16 @@ const onHome = () => {
dom_body.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }) dom_body.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' })
} }
} }
const onSkills = () => { // const onSkills = () => {
show_info.value.skills = !show_info.value.skills // show_info.value.skills = !show_info.value.skills
useState().showinfo.value.skills_itms = show_info.value.skills // useState().showinfo.value.skills_itms = show_info.value.skills
// !useState().showinfo.value.skills_itms // // !useState().showinfo.value.skills_itms
} // }
const onSoftSkills = () => { // const onSoftSkills = () => {
show_info.value.soft_skills = !show_info.value.soft_skills // show_info.value.soft_skills = !show_info.value.soft_skills
useState().showinfo.value.soft_skills_itms = show_info.value.soft_skills // useState().showinfo.value.soft_skills_itms = show_info.value.soft_skills
// !useState().showinfo.value.soft_skills_itms // // !useState().showinfo.value.soft_skills_itms
} // }
const onLoadModel = (model: { id: string}) => { const onLoadModel = (model: { id: string}) => {
const url = useState().CONFURLS.value.data || '' const url = useState().CONFURLS.value.data || ''
if (useState().models.value[model.id] && url.length > 0 ) { if (useState().models.value[model.id] && url.length > 0 ) {

View File

@ -434,7 +434,8 @@ import useState from '~/hooks/useState'
import { track_action } from '~/hooks/tracking' import { track_action } from '~/hooks/tracking'
const emit = defineEmits(['onEditor', 'onItem']) const emit = defineEmits(['onEditor', 'onItem'])
const { t } = useI18n() const { t } = useI18n()
// const router = useRouter() const i18n = useI18n()
const router = useRouter()
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object as PropType<DataCoreType>, type: Object as PropType<DataCoreType>,
@ -457,6 +458,7 @@ const props = defineProps({
required: true, required: true,
}, },
}) })
const routeKy = router.currentRoute.value.params.ky || router.currentRoute.value.query.k || ''
const assets_path = useState().ASSETS_PATH.value const assets_path = useState().ASSETS_PATH.value
const showinfo = ref(props.showinfo as ShowInfoType) const showinfo = ref(props.showinfo as ShowInfoType)
const authinfo = computed(() => { const authinfo = computed(() => {
@ -513,6 +515,6 @@ const onSoftSkills = (data: { src: string, idx: number }) => {
emit('onItem', { root: 'info', src: data.src, itm: props.data[data.src][data.idx], idx: data.idx }) emit('onItem', { root: 'info', src: data.src, itm: props.data[data.src][data.idx], idx: data.idx })
} }
const onLink = (e: any) => { const onLink = (e: any) => {
track_action(e) track_action(e,{ ref: 'infoPanel',text: e.target.href || '', lng: i18n.locale.value },routeKy.toString())
} }
</script> </script>

View File

@ -272,7 +272,8 @@ import useState from '~/hooks/useState'
import { track_action } from '~/hooks/tracking' import { track_action } from '~/hooks/tracking'
const emit = defineEmits(['onEditor', 'onItem']) const emit = defineEmits(['onEditor', 'onItem'])
const { t } = useI18n() const { t } = useI18n()
// const router = useRouter() const i18n = useI18n()
const router = useRouter()
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object as PropType<DataCoreType>, type: Object as PropType<DataCoreType>,
@ -295,6 +296,7 @@ const props = defineProps({
required: true, required: true,
}, },
}) })
const routeKy = router.currentRoute.value.params.ky || router.currentRoute.value.query.k || ''
const assets_path = useState().ASSETS_PATH.value const assets_path = useState().ASSETS_PATH.value
const showinfo = ref(props.showinfo as ShowInfoType) const showinfo = ref(props.showinfo as ShowInfoType)
const authinfo = computed(() => { const authinfo = computed(() => {
@ -343,6 +345,6 @@ const onItem = (src: string, idx: number) => {
emit('onItem', { root: 'info', src, itm: props.data[src][idx], idx }) emit('onItem', { root: 'info', src, itm: props.data[src][idx], idx })
} }
const onLink = (e: any) => { const onLink = (e: any) => {
track_action(e) track_action(e,{ ref: 'infoPanelMain',text: e.target.href || '', lng: i18n.locale.value },routeKy.toString())
} }
</script> </script>

View File

@ -171,7 +171,8 @@ import useState from '~/hooks/useState'
import { track_action } from '~/hooks/tracking' import { track_action } from '~/hooks/tracking'
const emit = defineEmits(['onEditor', 'onItem']) const emit = defineEmits(['onEditor', 'onItem'])
const { t } = useI18n() const { t } = useI18n()
// const router = useRouter() const i18n = useI18n()
const router = useRouter()
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object as PropType<DataCoreType>, type: Object as PropType<DataCoreType>,
@ -194,6 +195,7 @@ const props = defineProps({
required: true, required: true,
}, },
}) })
const routeKy = router.currentRoute.value.params.ky || router.currentRoute.value.query.k || ''
// const assets_path = useState().ASSETS_PATH.value // const assets_path = useState().ASSETS_PATH.value
const showinfo = ref(props.showinfo as ShowInfoType) const showinfo = ref(props.showinfo as ShowInfoType)
const authinfo = computed(() => { const authinfo = computed(() => {
@ -222,6 +224,7 @@ const onSoftSkills = (data: { src: string, idx: number }) => {
emit('onItem', { root: 'info', src: data.src, itm: props.data[data.src][data.idx], idx: data.idx }) emit('onItem', { root: 'info', src: data.src, itm: props.data[data.src][data.idx], idx: data.idx })
} }
const onLink = (e: any) => { const onLink = (e: any) => {
track_action(e) track_action(e,{ ref: 'infoPanelSkills',text: e.target.href || '', lng: i18n.locale.value },routeKy.toString())
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div v-for="(item: any,index: number) in get_data('projects')" :key="index" class="project-item mt-2"> <div v-for="(item,index) in get_data('projects')" :key="index" class="project-item mt-2">
<div class="flex"> <div class="flex">
<span class="w-4/5 flex-grow" /> <span class="w-4/5 flex-grow" />
<button <button
@ -18,7 +18,7 @@
</button> </button>
</div> </div>
<div v-if="item.auth.show" :id="`project-${index}`"> <div v-if="item.auth.show" :id="`project-${index}`">
<div v-for="(info:any,key:any,infoindex: number) in showinfo" :key="infoindex"> <div v-for="(info,key,infoindex) in showinfo" :key="infoindex">
<section <section
v-if="info && item[key] && key !== 'img' && key !== 'features' && key !== 'builtwith' && key !== 'auth'" v-if="info && item[key] && key !== 'img' && key !== 'features' && key !== 'builtwith' && key !== 'auth'"
:class="key === 'purpose' ? 'mt-2' : 'mb-0'" :class="key === 'purpose' ? 'mt-2' : 'mb-0'"
@ -122,7 +122,7 @@
/> />
<div v-else> <div v-else>
<span <span
v-for="(built: string,builtindex: number) in item[key]" v-for="(built ,builtindex) in item[key]"
:key="builtindex" :key="builtindex"
class="tag-item font-light mb-2" class="tag-item font-light mb-2"
>{{ built }}</span> >{{ built }}</span>
@ -144,6 +144,7 @@ import useState from '~/hooks/useState'
import { track_action } from '~/hooks/tracking' import { track_action } from '~/hooks/tracking'
// import { scryptSync } from 'crypto' // import { scryptSync } from 'crypto'
const { t } = useI18n() const { t } = useI18n()
const i18n = useI18n()
const router = useRouter() const router = useRouter()
const props = defineProps({ const props = defineProps({
data: { data: {
@ -171,6 +172,7 @@ const emit = defineEmits(['onEditor', 'onItem'])
const get_data = (itm: string) => { const get_data = (itm: string) => {
return props.localedata.value && props.localedata.value[itm] ? props.localedata.value[itm] : props.data return props.localedata.value && props.localedata.value[itm] ? props.localedata.value[itm] : props.data
} }
const routeKy = router.currentRoute.value.params.ky || router.currentRoute.value.query.k || ''
const assets_path = useState().ASSETS_PATH const assets_path = useState().ASSETS_PATH
const authinfo = useState().authinfo.value const authinfo = useState().authinfo.value
// const authinfo = computed(() => { // const authinfo = computed(() => {
@ -208,7 +210,7 @@ const onItem = (idx: number) => {
// el.style.display = 'none' // el.style.display = 'none'
} }
const onLink = (e: any) => { const onLink = (e: any) => {
track_action(e) track_action(e,{ ref: 'projects',text: e.target.href || '', lng: i18n.locale.value },routeKy.toString())
} }
</script> </script>