Skip to content

Commit

Permalink
Merge pull request #24 from weni-ai/feature/flow-trigger-page
Browse files Browse the repository at this point in the history
[ENGAGE-644] -  Add new page flow trigger
  • Loading branch information
mariana-morais authored Mar 26, 2024
2 parents 3dc6f02 + 2d3e0b3 commit 43b74a5
Show file tree
Hide file tree
Showing 6 changed files with 455 additions and 2 deletions.
105 changes: 105 additions & 0 deletions src/components/BarChart.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!-- eslint-disable vue/component-name-in-template-casing -->
<template>
<apexchart
type="bar"
:options="options"
:series="series"
/>
</template>

<script>
export default {
name: 'BarChart',
props: {
chartData: {
type: Object,
required: true,
},
},
data: () => ({
options: {
colors: ['var(--unnnic-color-neutral-clean)'],
chart: {
id: 'bar-chart',
toolbar: {
show: false,
},
fontFamily: '$unnnic-font-family-secondary',
fontWeight: '$unnnic-font-weight-regular;',
},
stroke: {
colors: ['transparent'],
width: 0,
},
dataLabels: {
enabled: true,
style: {
fontSize: '$unnnic-font-size-body-md',
fontWeight: '$unnnic-font-weight-regular;',
},
formatter: function (val) {
return val + ' runs';
},
},
plotOptions: {
bar: {
horizontal: true,
barHeight: '80%',
},
},
grid: {
show: false,
xaxis: {
lines: {
show: false,
},
},
yaxis: {
lines: {
show: false,
},
},
},
xaxis: {
categories: [],
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
labels: {
show: false,
},
},
yaxis: {
labels: {
show: true,
align: 'left',
minWidth: 0,
maxWidth: 160,
style: {
fontSize: '$unnnic-font-size-body-md',
fontWeight: '$unnnic-font-weight-regular;',
},
},
},
},
series: [
{
name: 'Runs',
data: [],
},
],
}),
created() {
this.importData();
},
methods: {
importData() {
this.options.xaxis.categories = this.chartData.categories;
this.series[0].data = this.chartData.data;
},
},
};
</script>
15 changes: 15 additions & 0 deletions src/mocks/barChartData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"categories": [
"Fluxo principal",
"Pós compra",
"Recuperar carrinho",
"Busca de produtos",
"Fechamento de pedidos",
"Disparo fornecedores",
"[Zero shot] Classificação",
"Ofertas",
"Carrinho abandonado",
"Pesquisa satisfação"
],
"data": ["759", "623", "589", "511", "416", "387", "234", "215", "189", "146"]
}
3 changes: 1 addition & 2 deletions src/mocks/dashboards.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[
{ "id": 1, "title": "Atendimento humano" },
{ "id": 2, "title": "Chatbot" },
{ "id": 3, "title": "Disparo de fluxos" }
{ "id": 2, "title": "Chatbot" }
]
6 changes: 6 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import store from '@/store';
import Home from '@/views/insights/Home/index.vue';
import Dashboards from '@/views/dashboards/Home/index.vue';
import Dashboard from '@/views/dashboards/Dashboard/index.vue';
import FlowTrigger from '@/views/dashboards/Dashboard/FlowTrigger.vue';

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
Expand Down Expand Up @@ -33,6 +34,11 @@ const router = createRouter({
cardId: route.params.cardId,
}),
},
{
path: '/dashboards/flow-trigger',
name: 'flow',
component: FlowTrigger,
},
],
});

Expand Down
Loading

0 comments on commit 43b74a5

Please sign in to comment.