Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/weni-ai/insights-webapp int…
Browse files Browse the repository at this point in the history
…o feature/widget-vtex
  • Loading branch information
MarcusviniciusLsantos committed Oct 18, 2024
2 parents 559adf8 + 5557122 commit 22ba843
Show file tree
Hide file tree
Showing 13 changed files with 1,059 additions and 1,357 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/crowdin-download.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Crowdin Download
on:
schedule:
- cron: '0 20 * * *' # Run the workflow every day at 20:00 UTC
permissions:
contents: write
pull-requests: write
jobs:
crowdin-download:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Synchronize with Crowdin
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: crowdin_translations
create_pull_request: true
pull_request_title: "[CROWDIN] - New translations"
pull_request_body: New Crowdin pull request with translations
pull_request_base_branch_name: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/crowdin-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Crowdin Upload

on:
push:
paths: [ 'src/locales/**' ]
branches: [ main ]

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Crowdin push
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: true
download_translations: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
3 changes: 0 additions & 3 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
npm install -g yarn
yarn install
- name: Run build translations
run: yarn translations:build

- name: Run lint
run: yarn lint

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ coverage
*.tsbuildinfo

# Locales files
**/locales/*.json
!**/locales/translations.json
# **/locales/*.json
# !**/locales/translations.json
14 changes: 14 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path": "."
"base_url": "https://api.crowdin.com"

"preserve_hierarchy": true


files: [
{
"source": "src/locales/en.json",
"translation": "src/locales/%locale%.json",
}
]
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "yarn translations:build && vite",
"build": "yarn translations:build && vite build",
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test": "vitest",
"test:ui": "vitest --ui",
Expand All @@ -16,7 +16,7 @@
},
"dependencies": {
"@vueuse/core": "^10.11.0",
"@weni/unnnic-system": "^2.10.0",
"@weni/unnnic-system": "^2.14.1",
"axios": "^1.7.2",
"chart.js": "^4.4.2",
"chartjs-plugin-datalabels": "^2.2.0",
Expand Down Expand Up @@ -53,12 +53,11 @@
"sass": "^1.69.7",
"sass-loader": "^13.3.3",
"typescript": "^5.4.5",
"unified-translations": "^1.1.1",
"vite": "^5.0.10",
"vitest": "^2.0.5",
"vue-eslint-parser": "^9.4.2"
},
"resolutions": {
"strip-ansi": "6.0.1"
}
}
}
20 changes: 18 additions & 2 deletions src/components/insights/charts/FunnelChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/>
<UnnnicChartFunnel
v-else
:data="chartData"
:data="formattedChartData"
/>
</section>
</template>
Expand All @@ -22,10 +22,26 @@ export default {
props: {
isLoading: Boolean,
chartData: {
type: Object,
type: Array,
required: true,
},
},
computed: {
formattedChartData() {
if (!Array.isArray(this.chartData)) return [];
return this.chartData.map((item) => {
return {
description: item.description,
title: `${parseFloat(item.percentage).toLocaleString(
this.$i18n.locale || 'en-US',
{
minimumFractionDigits: 2,
},
)}% (${item.total.toLocaleString(this.$i18n.locale || 'en-US')})`,
};
});
},
},
};
</script>

Expand Down
Loading

0 comments on commit 22ba843

Please sign in to comment.