diff --git a/cypress.config.ts b/cypress.config.ts index 5bed49b8..4b01931b 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -4,4 +4,9 @@ export default defineConfig({ e2e: { baseUrl: 'http://localhost:3000', }, + // default username / password on init + env: { + umami_user: 'admin', + umami_password: 'umami', + }, }); diff --git a/cypress/docker-compose.yml b/cypress/docker-compose.yml index 3cd8f546..01a47bd8 100644 --- a/cypress/docker-compose.yml +++ b/cypress/docker-compose.yml @@ -43,9 +43,10 @@ services: - CYPRESS_umami_user=admin - CYPRESS_umami_password=umami volumes: - - ../tsconfig.json:/tsconfig.json + - ./tsconfig.json:/tsconfig.json - ../cypress.config.ts:/cypress.config.ts - ./:/cypress - ../node_modules/:/node_modules + - ../src/lib/crypto.ts:/src/lib/crypto.ts volumes: umami-db-data: diff --git a/cypress/e2e/login.cy.ts b/cypress/e2e/login.cy.ts index 288d5c51..5831c81d 100644 --- a/cypress/e2e/login.cy.ts +++ b/cypress/e2e/login.cy.ts @@ -6,8 +6,12 @@ describe('Login tests', () => { }, () => { cy.visit('/login'); - cy.getDataTest('input-username').find('input').type(Cypress.env('umami_user')); - cy.getDataTest('input-password').find('input').type(Cypress.env('umami_password')); + cy.getDataTest('input-username').find('input').click(); + cy.getDataTest('input-username').find('input').type(Cypress.env('umami_user'), { delay: 50 }); + cy.getDataTest('input-password').find('input').click(); + cy.getDataTest('input-password') + .find('input') + .type(Cypress.env('umami_password'), { delay: 50 }); cy.getDataTest('button-submit').click(); cy.url().should('eq', Cypress.config().baseUrl + '/dashboard'); cy.getDataTest('button-profile').click(); diff --git a/cypress/e2e/website.cy.ts b/cypress/e2e/website.cy.ts index feec39de..b60d8e7a 100644 --- a/cypress/e2e/website.cy.ts +++ b/cypress/e2e/website.cy.ts @@ -10,8 +10,10 @@ describe('Website tests', () => { cy.visit('/settings/websites'); cy.getDataTest('button-website-add').click(); cy.contains(/Add website/i).should('be.visible'); - cy.getDataTest('input-name').find('input').wait(500).type('Add test', { delay: 50 }); - cy.getDataTest('input-domain').find('input').wait(500).type('addtest.com', { delay: 50 }); + cy.getDataTest('input-name').find('input').click(); + cy.getDataTest('input-name').find('input').type('Add test', { delay: 50 }); + cy.getDataTest('input-domain').find('input').click(); + cy.getDataTest('input-domain').find('input').type('addtest.com', { delay: 50 }); cy.getDataTest('button-submit').click(); cy.get('td[label="Name"]').should('contain.text', 'Add test'); cy.get('td[label="Domain"]').should('contain.text', 'addtest.com'); @@ -26,10 +28,10 @@ describe('Website tests', () => { cy.deleteWebsite(websiteId); }); cy.visit('/settings/websites'); - cy.contains('Add test').should('not.exist'); + cy.contains(/Add test/i).should('not.exist'); }); - it.only('Edit a website', () => { + it('Edit a website', () => { // prep data cy.addWebsite('Update test', 'updatetest.com'); cy.visit('/settings/websites'); @@ -37,16 +39,12 @@ describe('Website tests', () => { // edit website cy.getDataTest('link-button-edit').first().click(); cy.contains(/Details/i).should('be.visible'); - cy.getDataTest('input-name') - .find('input') - .wait(500) - .clear() - .type('Updated website', { delay: 50 }); - cy.getDataTest('input-domain') - .find('input') - .wait(500) - .clear() - .type('updatedwebsite.com', { delay: 50 }); + cy.getDataTest('input-name').find('input').click(); + cy.getDataTest('input-name').find('input').clear(); + cy.getDataTest('input-name').find('input').type('Updated website', { delay: 50 }); + cy.getDataTest('input-domain').find('input').click(); + cy.getDataTest('input-domain').find('input').clear(); + cy.getDataTest('input-domain').find('input').type('updatedwebsite.com', { delay: 50 }); cy.getDataTest('button-submit').click({ force: true }); cy.getDataTest('input-name').find('input').should('have.value', 'Updated website'); cy.getDataTest('input-domain').find('input').should('have.value', 'updatedwebsite.com'); @@ -69,7 +67,7 @@ describe('Website tests', () => { cy.deleteWebsite(websiteId); }); cy.visit('/settings/websites'); - cy.contains('Add test').should('not.exist'); + cy.contains(/Add test/i).should('not.exist'); }); it('Delete a website', () => { @@ -86,6 +84,6 @@ describe('Website tests', () => { cy.contains(/Type DELETE in the box below to confirm./i).should('be.visible'); cy.get('input[name="confirm"').type('DELETE'); cy.get('button[type="submit"]').click(); - cy.contains('Delete test').should('not.exist'); + cy.contains(/Delete test/i).should('not.exist'); }); }); diff --git a/package.json b/package.json index 35cdd730..9cea8cbe 100644 --- a/package.json +++ b/package.json @@ -66,14 +66,14 @@ "dependencies": { "@clickhouse/client": "^0.2.2", "@fontsource/inter": "^4.5.15", - "@prisma/client": "5.9.1", + "@prisma/client": "5.10.2", "@prisma/extension-read-replicas": "^0.3.0", "@react-spring/web": "^9.7.3", "@tanstack/react-query": "^5.12.2", "@umami/prisma-client": "^0.14.0", "@umami/redis-client": "^0.18.0", "chalk": "^4.1.1", - "chart.js": "^4.2.1", + "chart.js": "^4.4.2", "chartjs-adapter-date-fns": "^3.0.0", "classnames": "^2.3.1", "colord": "^2.9.2", @@ -98,11 +98,11 @@ "maxmind": "^4.3.6", "md5": "^2.3.0", "moment-timezone": "^0.5.35", - "next": "14.1.0", + "next": "14.1.3", "next-basics": "^0.39.0", "node-fetch": "^3.2.8", "npm-run-all": "^4.1.5", - "prisma": "5.9.1", + "prisma": "5.10.2", "react": "^18.2.0", "react-basics": "^0.123.0", "react-beautiful-dnd": "^13.1.0", diff --git a/public/intl/messages/am-ET.json b/public/intl/messages/am-ET.json index 5ed37497..21a8e79f 100644 --- a/public/intl/messages/am-ET.json +++ b/public/intl/messages/am-ET.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/be-BY.json b/public/intl/messages/be-BY.json index dd9d1000..def58386 100644 --- a/public/intl/messages/be-BY.json +++ b/public/intl/messages/be-BY.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/bn-BD.json b/public/intl/messages/bn-BD.json index e75da8f3..0f32ba3b 100644 --- a/public/intl/messages/bn-BD.json +++ b/public/intl/messages/bn-BD.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ca-ES.json b/public/intl/messages/ca-ES.json index 89daf8a1..0f441e0c 100644 --- a/public/intl/messages/ca-ES.json +++ b/public/intl/messages/ca-ES.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/cs-CZ.json b/public/intl/messages/cs-CZ.json index 8495aea0..1b91d247 100644 --- a/public/intl/messages/cs-CZ.json +++ b/public/intl/messages/cs-CZ.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/da-DK.json b/public/intl/messages/da-DK.json index 63da5bea..a53d93a3 100644 --- a/public/intl/messages/da-DK.json +++ b/public/intl/messages/da-DK.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/de-CH.json b/public/intl/messages/de-CH.json index 9120e8c3..e7abed6b 100644 --- a/public/intl/messages/de-CH.json +++ b/public/intl/messages/de-CH.json @@ -215,6 +215,12 @@ "value": "Erstellt" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/de-DE.json b/public/intl/messages/de-DE.json index 8268f5d7..2477f0e6 100644 --- a/public/intl/messages/de-DE.json +++ b/public/intl/messages/de-DE.json @@ -215,6 +215,12 @@ "value": "Erstellt" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/el-GR.json b/public/intl/messages/el-GR.json index 598f7b6f..dd78c971 100644 --- a/public/intl/messages/el-GR.json +++ b/public/intl/messages/el-GR.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/en-GB.json b/public/intl/messages/en-GB.json index c3465092..e035770e 100644 --- a/public/intl/messages/en-GB.json +++ b/public/intl/messages/en-GB.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/en-US.json b/public/intl/messages/en-US.json index c666b361..68a3e1f7 100644 --- a/public/intl/messages/en-US.json +++ b/public/intl/messages/en-US.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/es-ES.json b/public/intl/messages/es-ES.json index 86965289..b1ce8d8a 100644 --- a/public/intl/messages/es-ES.json +++ b/public/intl/messages/es-ES.json @@ -32,7 +32,7 @@ "label.add-member": [ { "type": 0, - "value": "Add member" + "value": "Añadir miembro" } ], "label.add-website": [ @@ -215,6 +215,12 @@ "value": "Creado" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, @@ -272,7 +278,7 @@ "label.delete-report": [ { "type": 0, - "value": "Delete report" + "value": "Eliminar reporte" } ], "label.delete-team": [ @@ -464,7 +470,7 @@ "label.insights-description": [ { "type": 0, - "value": "Dive deeper into your data by using segments and filters." + "value": "Profundice en sus datos mediante el uso de segmentos y filtros." } ], "label.is": [ @@ -482,7 +488,7 @@ "label.is-not-set": [ { "type": 0, - "value": "Is not set" + "value": "No está establecido" } ], "label.is-set": [ @@ -588,7 +594,7 @@ "label.manage": [ { "type": 0, - "value": "Manage" + "value": "Administrar" } ], "label.max": [ @@ -600,7 +606,7 @@ "label.member": [ { "type": 0, - "value": "Member" + "value": "Miembro" } ], "label.members": [ @@ -630,7 +636,7 @@ "label.my-account": [ { "type": 0, - "value": "My account" + "value": "Mi cuenta" } ], "label.my-websites": [ @@ -842,7 +848,7 @@ "label.remove-member": [ { "type": 0, - "value": "Remove member" + "value": "Eliminar miembro" } ], "label.reports": [ @@ -926,7 +932,7 @@ "label.select-role": [ { "type": 0, - "value": "Select role" + "value": "Seleccionar rol" } ], "label.select-website": [ @@ -1004,7 +1010,7 @@ "label.team-view-only": [ { "type": 0, - "value": "Team view only" + "value": "Vista solo del equipo" } ], "label.team-websites": [ @@ -1088,13 +1094,13 @@ "label.transfer": [ { "type": 0, - "value": "Transfer" + "value": "Transferir" } ], "label.transfer-website": [ { "type": 0, - "value": "Transfer website" + "value": "Transferir sitio web" } ], "label.true": [ @@ -1232,7 +1238,7 @@ "message.action-confirmation": [ { "type": 0, - "value": "Type " + "value": "Escriba " }, { "type": 1, @@ -1240,7 +1246,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": " en el cuadro a continuación para confirmar." } ], "message.active-users": [ @@ -1308,7 +1314,7 @@ "message.confirm-remove": [ { "type": 0, - "value": "Are you sure you want to remove " + "value": "¿Estás seguro de que desea eliminar " }, { "type": 1, @@ -1336,7 +1342,7 @@ "message.delete-team-warning": [ { "type": 0, - "value": "Deleting a team will also delete all team websites." + "value": "Al eliminar un equipo, también se eliminarán todos los sitios web del equipo." } ], "message.delete-website-warning": [ @@ -1532,7 +1538,7 @@ "message.transfer-team-website-to-user": [ { "type": 0, - "value": "Transfer this website to your account?" + "value": "¿Transferir este sitio web a su cuenta?" } ], "message.transfer-user-website-to-team": [ @@ -1544,13 +1550,13 @@ "message.transfer-website": [ { "type": 0, - "value": "Transfer website ownership to your account or another team." + "value": "Seleccione el equipo al que transferir este sitio web." } ], "message.triggered-event": [ { "type": 0, - "value": "Triggered event" + "value": "Evento lanzado" } ], "message.user-deleted": [ @@ -1562,7 +1568,7 @@ "message.viewed-page": [ { "type": 0, - "value": "Viewed page" + "value": "Página vista" } ], "message.visitor-log": [ @@ -1602,7 +1608,7 @@ "message.visitors-dropped-off": [ { "type": 0, - "value": "Visitors dropped off" + "value": "Los visitantes salieron" } ] } diff --git a/public/intl/messages/fa-IR.json b/public/intl/messages/fa-IR.json index 221879c5..a680492c 100644 --- a/public/intl/messages/fa-IR.json +++ b/public/intl/messages/fa-IR.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/fi-FI.json b/public/intl/messages/fi-FI.json index d4c39d62..5c9b7611 100644 --- a/public/intl/messages/fi-FI.json +++ b/public/intl/messages/fi-FI.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/fo-FO.json b/public/intl/messages/fo-FO.json index 32c36503..29d1eb5f 100644 --- a/public/intl/messages/fo-FO.json +++ b/public/intl/messages/fo-FO.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/fr-FR.json b/public/intl/messages/fr-FR.json index 6ab90a03..c8ba44c3 100644 --- a/public/intl/messages/fr-FR.json +++ b/public/intl/messages/fr-FR.json @@ -32,7 +32,7 @@ "label.add-member": [ { "type": 0, - "value": "Add member" + "value": "Ajouter un membre" } ], "label.add-website": [ @@ -215,6 +215,12 @@ "value": "Créé" } ], + "label.created-by": [ + { + "type": 0, + "value": "Crée par" + } + ], "label.current-password": [ { "type": 0, @@ -272,7 +278,7 @@ "label.delete-report": [ { "type": 0, - "value": "Delete report" + "value": "Supprimer le rapport" } ], "label.delete-team": [ @@ -362,7 +368,7 @@ "label.edit-member": [ { "type": 0, - "value": "Edit member" + "value": "Modifier le membre" } ], "label.enable-share-url": [ @@ -580,7 +586,7 @@ "label.manage": [ { "type": 0, - "value": "Manage" + "value": "Gérer" } ], "label.max": [ @@ -592,7 +598,7 @@ "label.member": [ { "type": 0, - "value": "Member" + "value": "Membre" } ], "label.members": [ @@ -622,7 +628,7 @@ "label.my-account": [ { "type": 0, - "value": "My account" + "value": "Mon compte" } ], "label.my-websites": [ @@ -646,7 +652,7 @@ "label.none": [ { "type": 0, - "value": "Aucun·e" + "value": "Aucun" } ], "label.number-of-records": [ @@ -834,7 +840,7 @@ "label.remove-member": [ { "type": 0, - "value": "Remove member" + "value": "Retirer le membre" } ], "label.reports": [ @@ -918,7 +924,7 @@ "label.select-role": [ { "type": 0, - "value": "Select role" + "value": "Choisir un rôle" } ], "label.select-website": [ @@ -1080,13 +1086,13 @@ "label.transfer": [ { "type": 0, - "value": "Transfer" + "value": "Transférer" } ], "label.transfer-website": [ { "type": 0, - "value": "Transfer website" + "value": "Transférer le site" } ], "label.true": [ @@ -1224,7 +1230,7 @@ "message.action-confirmation": [ { "type": 0, - "value": "Type " + "value": "Taper " }, { "type": 1, @@ -1232,7 +1238,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": " ci-dessous pour confirmer." } ], "message.active-users": [ @@ -1304,7 +1310,7 @@ "message.confirm-remove": [ { "type": 0, - "value": "Are you sure you want to remove " + "value": "Êtes-vous sûr de vouloir retirer " }, { "type": 1, @@ -1312,7 +1318,7 @@ }, { "type": 0, - "value": "?" + "value": " ?" } ], "message.confirm-reset": [ @@ -1332,7 +1338,7 @@ "message.delete-team-warning": [ { "type": 0, - "value": "Deleting a team will also delete all team websites." + "value": "Supprimer une équipe supprimera aussi tous les sites de cette équipe." } ], "message.delete-website-warning": [ @@ -1520,19 +1526,19 @@ "message.transfer-team-website-to-user": [ { "type": 0, - "value": "Transfer this website to your account?" + "value": "Transférer ce site sur votre compte ?" } ], "message.transfer-user-website-to-team": [ { "type": 0, - "value": "Select the team to transfer this website to." + "value": "Choisir l'équipe à laquelle transférer ce site." } ], "message.transfer-website": [ { "type": 0, - "value": "Transfer website ownership to your account or another team." + "value": "Transférer la propriété du site sur votre compte ou à une autre équipe." } ], "message.triggered-event": [ @@ -1550,7 +1556,7 @@ "message.viewed-page": [ { "type": 0, - "value": "Viewed page" + "value": "Page vue" } ], "message.visitor-log": [ @@ -1590,7 +1596,7 @@ "message.visitors-dropped-off": [ { "type": 0, - "value": "Visitors dropped off" + "value": "Visiteurs ont abandonné" } ] } diff --git a/public/intl/messages/ga-ES.json b/public/intl/messages/ga-ES.json index ea32f939..926294ea 100644 --- a/public/intl/messages/ga-ES.json +++ b/public/intl/messages/ga-ES.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/he-IL.json b/public/intl/messages/he-IL.json index c6fadb62..b3cdfeeb 100644 --- a/public/intl/messages/he-IL.json +++ b/public/intl/messages/he-IL.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/hi-IN.json b/public/intl/messages/hi-IN.json index 0411eb3b..985ed537 100644 --- a/public/intl/messages/hi-IN.json +++ b/public/intl/messages/hi-IN.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/hr-HR.json b/public/intl/messages/hr-HR.json index 468e823a..ff3ca36c 100644 --- a/public/intl/messages/hr-HR.json +++ b/public/intl/messages/hr-HR.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/hu-HU.json b/public/intl/messages/hu-HU.json index 48e86d58..28450892 100644 --- a/public/intl/messages/hu-HU.json +++ b/public/intl/messages/hu-HU.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/id-ID.json b/public/intl/messages/id-ID.json index 911dd915..d2b5a98c 100644 --- a/public/intl/messages/id-ID.json +++ b/public/intl/messages/id-ID.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/it-IT.json b/public/intl/messages/it-IT.json index 98f4819f..10942fff 100644 --- a/public/intl/messages/it-IT.json +++ b/public/intl/messages/it-IT.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ja-JP.json b/public/intl/messages/ja-JP.json index a0fb59ed..06ef769c 100644 --- a/public/intl/messages/ja-JP.json +++ b/public/intl/messages/ja-JP.json @@ -32,7 +32,7 @@ "label.add-member": [ { "type": 0, - "value": "Add member" + "value": "メンバーの追加" } ], "label.add-website": [ @@ -188,7 +188,7 @@ "label.create": [ { "type": 0, - "value": "Create" + "value": "作成" } ], "label.create-report": [ @@ -215,6 +215,12 @@ "value": "作成されました" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, @@ -272,7 +278,7 @@ "label.delete-report": [ { "type": 0, - "value": "Delete report" + "value": "レポートの削除" } ], "label.delete-team": [ @@ -362,7 +368,7 @@ "label.edit-member": [ { "type": 0, - "value": "Edit member" + "value": "メンバーの編集" } ], "label.enable-share-url": [ @@ -410,13 +416,13 @@ "label.filter": [ { "type": 0, - "value": "Filter" + "value": "フィルター" } ], "label.filter-combined": [ { "type": 0, - "value": "統合" + "value": "結合" } ], "label.filter-raw": [ @@ -434,13 +440,13 @@ "label.funnel": [ { "type": 0, - "value": "分析" + "value": "ファネル" } ], "label.funnel-description": [ { "type": 0, - "value": "Understand the conversion and drop-off rate of users." + "value": "ユーザーのコンバージョン率と離脱率を分析します。" } ], "label.greater-than": [ @@ -458,13 +464,13 @@ "label.insights": [ { "type": 0, - "value": "見通し" + "value": "インサイト" } ], "label.insights-description": [ { "type": 0, - "value": "Dive deeper into your data by using segments and filters." + "value": "セグメントとフィルタを使用して、データをさらに詳しく分析します。" } ], "label.is": [ @@ -588,7 +594,7 @@ "label.manage": [ { "type": 0, - "value": "Manage" + "value": "管理" } ], "label.max": [ @@ -600,7 +606,7 @@ "label.member": [ { "type": 0, - "value": "Member" + "value": "メンバー" } ], "label.members": [ @@ -630,7 +636,7 @@ "label.my-account": [ { "type": 0, - "value": "My account" + "value": "マイアカウント" } ], "label.my-websites": [ @@ -842,7 +848,7 @@ "label.remove-member": [ { "type": 0, - "value": "Remove member" + "value": "メンバーの削除" } ], "label.reports": [ @@ -872,13 +878,13 @@ "label.retention": [ { "type": 0, - "value": "保持" + "value": "リテンション" } ], "label.retention-description": [ { "type": 0, - "value": "Measure your website stickiness by tracking how often users return." + "value": "ユーザーの再訪問回数を記録して、Webサイトのリテンション率を計測します。" } ], "label.role": [ @@ -908,13 +914,13 @@ "label.search": [ { "type": 0, - "value": "Search" + "value": "検索" } ], "label.select": [ { "type": 0, - "value": "Select" + "value": "選択" } ], "label.select-date": [ @@ -926,7 +932,7 @@ "label.select-role": [ { "type": 0, - "value": "Select role" + "value": "ロールを選択" } ], "label.select-website": [ @@ -1004,7 +1010,7 @@ "label.team-view-only": [ { "type": 0, - "value": "Team view only" + "value": "チーム表示のみ" } ], "label.team-websites": [ @@ -1088,13 +1094,13 @@ "label.transfer": [ { "type": 0, - "value": "Transfer" + "value": "移管" } ], "label.transfer-website": [ { "type": 0, - "value": "Transfer website" + "value": "Webサイトの移管" } ], "label.true": [ @@ -1232,7 +1238,7 @@ "message.action-confirmation": [ { "type": 0, - "value": "Type " + "value": "承認する場合は、下のフォームに「" }, { "type": 1, @@ -1240,7 +1246,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": "」と入力してください。" } ], "message.active-users": [ @@ -1298,17 +1304,13 @@ } ], "message.confirm-remove": [ - { - "type": 0, - "value": "Are you sure you want to remove " - }, { "type": 1, "value": "target" }, { "type": 0, - "value": "?" + "value": "を削除してもよろしいですか?" } ], "message.confirm-reset": [ @@ -1324,7 +1326,7 @@ "message.delete-team-warning": [ { "type": 0, - "value": "Deleting a team will also delete all team websites." + "value": "チームを削除すると、そのチームが管理しているWebサイトもすべて削除されます。" } ], "message.delete-website-warning": [ @@ -1526,25 +1528,25 @@ "message.transfer-team-website-to-user": [ { "type": 0, - "value": "Transfer this website to your account?" + "value": "このWebサイトをあなたのアカウントに移管しますか?" } ], "message.transfer-user-website-to-team": [ { "type": 0, - "value": "Select the team to transfer this website to." + "value": "このWebサイトを移管するチームを選択してください。" } ], "message.transfer-website": [ { "type": 0, - "value": "Transfer website ownership to your account or another team." + "value": "Webサイトの所有権を自分のアカウントまたは別のチームへ移管します。" } ], "message.triggered-event": [ { "type": 0, - "value": "Triggered event" + "value": "トリガーされたイベント" } ], "message.user-deleted": [ @@ -1556,7 +1558,7 @@ "message.viewed-page": [ { "type": 0, - "value": "Viewed page" + "value": "閲覧されたページ" } ], "message.visitor-log": [ @@ -1596,7 +1598,7 @@ "message.visitors-dropped-off": [ { "type": 0, - "value": "Visitors dropped off" + "value": "訪問者の離脱率" } ] } diff --git a/public/intl/messages/km-KH.json b/public/intl/messages/km-KH.json index c8911fca..40a280f9 100644 --- a/public/intl/messages/km-KH.json +++ b/public/intl/messages/km-KH.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ko-KR.json b/public/intl/messages/ko-KR.json index 92089367..b95b0e32 100644 --- a/public/intl/messages/ko-KR.json +++ b/public/intl/messages/ko-KR.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/lt-LT.json b/public/intl/messages/lt-LT.json index dcf8fe5b..0d3817da 100644 --- a/public/intl/messages/lt-LT.json +++ b/public/intl/messages/lt-LT.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/mn-MN.json b/public/intl/messages/mn-MN.json index 5d97a123..2c8a01e7 100644 --- a/public/intl/messages/mn-MN.json +++ b/public/intl/messages/mn-MN.json @@ -215,6 +215,12 @@ "value": "Үүсгэсэн" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ms-MY.json b/public/intl/messages/ms-MY.json index d85f08f7..4039bea1 100644 --- a/public/intl/messages/ms-MY.json +++ b/public/intl/messages/ms-MY.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/my-MM.json b/public/intl/messages/my-MM.json index 9b5f8a12..729dec13 100644 --- a/public/intl/messages/my-MM.json +++ b/public/intl/messages/my-MM.json @@ -215,6 +215,12 @@ "value": "ပြုလုပ်ပြီးသော" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/nb-NO.json b/public/intl/messages/nb-NO.json index 39aa52fe..fadc11f8 100644 --- a/public/intl/messages/nb-NO.json +++ b/public/intl/messages/nb-NO.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/nl-NL.json b/public/intl/messages/nl-NL.json index f92948f6..34777f93 100644 --- a/public/intl/messages/nl-NL.json +++ b/public/intl/messages/nl-NL.json @@ -215,6 +215,12 @@ "value": "Gemaakt" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/pl-PL.json b/public/intl/messages/pl-PL.json index 7834b218..89ab2dcd 100644 --- a/public/intl/messages/pl-PL.json +++ b/public/intl/messages/pl-PL.json @@ -215,6 +215,12 @@ "value": "Utworzony" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/pt-BR.json b/public/intl/messages/pt-BR.json index af420197..3c6bec5b 100644 --- a/public/intl/messages/pt-BR.json +++ b/public/intl/messages/pt-BR.json @@ -215,6 +215,12 @@ "value": "Criado" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/pt-PT.json b/public/intl/messages/pt-PT.json index add7ccb7..bcc7fae4 100644 --- a/public/intl/messages/pt-PT.json +++ b/public/intl/messages/pt-PT.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ro-RO.json b/public/intl/messages/ro-RO.json index 10625a08..50ae2166 100644 --- a/public/intl/messages/ro-RO.json +++ b/public/intl/messages/ro-RO.json @@ -2,7 +2,7 @@ "label.access-code": [ { "type": 0, - "value": "Access code" + "value": "Cod de access" } ], "label.actions": [ @@ -14,25 +14,25 @@ "label.activity-log": [ { "type": 0, - "value": "Activity log" + "value": "Jurnal de activități" } ], "label.add": [ { "type": 0, - "value": "Add" + "value": "Adaugă" } ], "label.add-description": [ { "type": 0, - "value": "Add description" + "value": "Adaugă descriere" } ], "label.add-member": [ { "type": 0, - "value": "Add member" + "value": "Adaugă membru" } ], "label.add-website": [ @@ -50,7 +50,7 @@ "label.after": [ { "type": 0, - "value": "After" + "value": "După" } ], "label.all": [ @@ -62,7 +62,7 @@ "label.all-time": [ { "type": 0, - "value": "All time" + "value": "Pentru tot timpul" } ], "label.analytics": [ @@ -74,7 +74,7 @@ "label.average": [ { "type": 0, - "value": "Average" + "value": "Mediu" } ], "label.average-visit-time": [ @@ -92,7 +92,7 @@ "label.before": [ { "type": 0, - "value": "Before" + "value": "Înainte" } ], "label.bounce-rate": [ @@ -104,7 +104,7 @@ "label.breakdown": [ { "type": 0, - "value": "Breakdown" + "value": "Detaliat" } ], "label.browser": [ @@ -134,19 +134,19 @@ "label.cities": [ { "type": 0, - "value": "Cities" + "value": "Orașe" } ], "label.city": [ { "type": 0, - "value": "City" + "value": "Oraș" } ], "label.clear-all": [ { "type": 0, - "value": "Clear all" + "value": "Șterge tot" } ], "label.confirm": [ @@ -164,13 +164,13 @@ "label.contains": [ { "type": 0, - "value": "Contains" + "value": "Conține" } ], "label.continue": [ { "type": 0, - "value": "Continue" + "value": "Continuă" } ], "label.countries": [ @@ -182,37 +182,37 @@ "label.country": [ { "type": 0, - "value": "Country" + "value": "Țară" } ], "label.create": [ { "type": 0, - "value": "Create" + "value": "Crează" } ], "label.create-report": [ { "type": 0, - "value": "Create report" + "value": "Crează report" } ], "label.create-team": [ { "type": 0, - "value": "Create team" + "value": "Crează echipă" } ], "label.create-user": [ { "type": 0, - "value": "Create user" + "value": "Crează utilizator" } ], "label.created": [ { "type": 0, - "value": "Created" + "value": "Creat" } ], "label.current-password": [ @@ -236,13 +236,13 @@ "label.data": [ { "type": 0, - "value": "Data" + "value": "Date" } ], "label.date": [ { "type": 0, - "value": "Date" + "value": "Data" } ], "label.date-range": [ @@ -254,7 +254,7 @@ "label.day": [ { "type": 0, - "value": "Day" + "value": "Zi" } ], "label.default-date-range": [ @@ -272,19 +272,19 @@ "label.delete-report": [ { "type": 0, - "value": "Delete report" + "value": "Șterge raport" } ], "label.delete-team": [ { "type": 0, - "value": "Delete team" + "value": "Șterge echipă" } ], "label.delete-user": [ { "type": 0, - "value": "Delete user" + "value": "Șterge utilizator" } ], "label.delete-website": [ @@ -296,7 +296,7 @@ "label.description": [ { "type": 0, - "value": "Description" + "value": "Descriere" } ], "label.desktop": [ @@ -308,13 +308,13 @@ "label.details": [ { "type": 0, - "value": "Details" + "value": "Detalii" } ], "label.device": [ { "type": 0, - "value": "Device" + "value": "Dispozitiv" } ], "label.devices": [ @@ -332,7 +332,7 @@ "label.does-not-contain": [ { "type": 0, - "value": "Does not contain" + "value": "Nu conține" } ], "label.domain": [ @@ -344,7 +344,7 @@ "label.dropoff": [ { "type": 0, - "value": "Dropoff" + "value": "Rată de abandon" } ], "label.edit": [ @@ -356,13 +356,13 @@ "label.edit-dashboard": [ { "type": 0, - "value": "Edit dashboard" + "value": "Editare tablou de bord" } ], "label.edit-member": [ { "type": 0, - "value": "Edit member" + "value": "Editare membru" } ], "label.enable-share-url": [ @@ -374,13 +374,13 @@ "label.event": [ { "type": 0, - "value": "Event" + "value": "Eveniment" } ], "label.event-data": [ { "type": 0, - "value": "Event data" + "value": "Date despre eveniment" } ], "label.events": [ @@ -392,25 +392,25 @@ "label.false": [ { "type": 0, - "value": "False" + "value": "Fals" } ], "label.field": [ { "type": 0, - "value": "Field" + "value": "Câmp" } ], "label.fields": [ { "type": 0, - "value": "Fields" + "value": "Câmpuri" } ], "label.filter": [ { "type": 0, - "value": "Filter" + "value": "Filtru" } ], "label.filter-combined": [ @@ -428,91 +428,91 @@ "label.filters": [ { "type": 0, - "value": "Filters" + "value": "Filtre" } ], "label.funnel": [ { "type": 0, - "value": "Funnel" + "value": "Parcursul utilizatorului" } ], "label.funnel-description": [ { "type": 0, - "value": "Understand the conversion and drop-off rate of users." + "value": "Înțelege rata de conversie și rata de abandon a utilizatorilor." } ], "label.greater-than": [ { "type": 0, - "value": "Greater than" + "value": "Mai mare decât" } ], "label.greater-than-equals": [ { "type": 0, - "value": "Greater than or equals" + "value": "Mai mare sau egal cu" } ], "label.insights": [ { "type": 0, - "value": "Insights" + "value": "Perspective" } ], "label.insights-description": [ { "type": 0, - "value": "Dive deeper into your data by using segments and filters." + "value": "Aprofundează datele utilizând segmente și filtre." } ], "label.is": [ { "type": 0, - "value": "Is" + "value": "Este" } ], "label.is-not": [ { "type": 0, - "value": "Is not" + "value": "Nu este" } ], "label.is-not-set": [ { "type": 0, - "value": "Is not set" + "value": "Nu este setat" } ], "label.is-set": [ { "type": 0, - "value": "Is set" + "value": "Este setat" } ], "label.join": [ { "type": 0, - "value": "Join" + "value": "Alătură-te" } ], "label.join-team": [ { "type": 0, - "value": "Join team" + "value": "Alătură-te echipei" } ], "label.language": [ { "type": 0, - "value": "Language" + "value": "Limbă" } ], "label.languages": [ { "type": 0, - "value": "Languages" + "value": "Limbi" } ], "label.laptop": [ @@ -552,25 +552,25 @@ "label.leave": [ { "type": 0, - "value": "Leave" + "value": "Părăsește" } ], "label.leave-team": [ { "type": 0, - "value": "Leave team" + "value": "Părăsește echipa" } ], "label.less-than": [ { "type": 0, - "value": "Less than" + "value": "Mai puțin decât" } ], "label.less-than-equals": [ { "type": 0, - "value": "Less than or equals" + "value": "Mai puțin sau egal cu" } ], "label.login": [ @@ -582,13 +582,13 @@ "label.logout": [ { "type": 0, - "value": "Iesire din cont" + "value": "Ieșire din cont" } ], "label.manage": [ { "type": 0, - "value": "Manage" + "value": "Administrează" } ], "label.max": [ @@ -600,13 +600,13 @@ "label.member": [ { "type": 0, - "value": "Member" + "value": "Membru" } ], "label.members": [ { "type": 0, - "value": "Members" + "value": "Membri" } ], "label.min": [ @@ -630,13 +630,13 @@ "label.my-account": [ { "type": 0, - "value": "My account" + "value": "Contul meu" } ], "label.my-websites": [ { "type": 0, - "value": "My websites" + "value": "Website-ul meu" } ], "label.name": [ @@ -648,13 +648,13 @@ "label.new-password": [ { "type": 0, - "value": "Parola nouă" + "value": "Parolă nouă" } ], "label.none": [ { "type": 0, - "value": "None" + "value": "Niciunul" } ], "label.number-of-records": [ @@ -673,7 +673,7 @@ "value": [ { "type": 0, - "value": "record" + "value": "înregistrare" } ] }, @@ -681,7 +681,7 @@ "value": [ { "type": 0, - "value": "records" + "value": "înregistrări" } ] } @@ -706,19 +706,19 @@ "label.overview": [ { "type": 0, - "value": "Overview" + "value": "Vedere de ansamblu" } ], "label.owner": [ { "type": 0, - "value": "Owner" + "value": "Titular" } ], "label.page-of": [ { "type": 0, - "value": "Page " + "value": "Pagina " }, { "type": 1, @@ -726,7 +726,7 @@ }, { "type": 0, - "value": " of " + "value": " din " }, { "type": 1, @@ -742,7 +742,7 @@ "label.pageTitle": [ { "type": 0, - "value": "Page title" + "value": "Titlul paginii" } ], "label.pages": [ @@ -776,31 +776,31 @@ "label.queries": [ { "type": 0, - "value": "Queries" + "value": "Interogări" } ], "label.query": [ { "type": 0, - "value": "Query" + "value": "Interogare" } ], "label.query-parameters": [ { "type": 0, - "value": "Query parameters" + "value": "Parametri de interogare" } ], "label.realtime": [ { "type": 0, - "value": "Realtime" + "value": "Timp real" } ], "label.referrer": [ { "type": 0, - "value": "Referrer" + "value": "Proveniență" } ], "label.referrers": [ @@ -818,37 +818,37 @@ "label.regenerate": [ { "type": 0, - "value": "Regenerate" + "value": "Regenerează" } ], "label.region": [ { "type": 0, - "value": "Region" + "value": "Regiune" } ], "label.regions": [ { "type": 0, - "value": "Regions" + "value": "Regiuni" } ], "label.remove": [ { "type": 0, - "value": "Remove" + "value": "Îndepărtează" } ], "label.remove-member": [ { "type": 0, - "value": "Remove member" + "value": "Îndepărtează membru" } ], "label.reports": [ { "type": 0, - "value": "Reports" + "value": "Rapoarte" } ], "label.required": [ @@ -872,25 +872,25 @@ "label.retention": [ { "type": 0, - "value": "Retention" + "value": "Retenție" } ], "label.retention-description": [ { "type": 0, - "value": "Measure your website stickiness by tracking how often users return." + "value": "Măsoară atractivitatea site-ului tău prin urmărirea frecvenței cu care utilizatorii se întorc." } ], "label.role": [ { "type": 0, - "value": "Role" + "value": "Rol" } ], "label.run-query": [ { "type": 0, - "value": "Run query" + "value": "Execută interogarea" } ], "label.save": [ @@ -902,43 +902,43 @@ "label.screens": [ { "type": 0, - "value": "Screens" + "value": "Ecrane" } ], "label.search": [ { "type": 0, - "value": "Search" + "value": "Căutare" } ], "label.select": [ { "type": 0, - "value": "Select" + "value": "Selectează" } ], "label.select-date": [ { "type": 0, - "value": "Select date" + "value": "Selectează data" } ], "label.select-role": [ { "type": 0, - "value": "Select role" + "value": "Selectează rolul" } ], "label.select-website": [ { "type": 0, - "value": "Select website" + "value": "Selectează website" } ], "label.sessions": [ { "type": 0, - "value": "Sessions" + "value": "Sesiuni" } ], "label.settings": [ @@ -962,7 +962,7 @@ "label.sum": [ { "type": 0, - "value": "Sum" + "value": "Sumă" } ], "label.tablet": [ @@ -974,55 +974,55 @@ "label.team": [ { "type": 0, - "value": "Team" + "value": "Echipă" } ], "label.team-id": [ { "type": 0, - "value": "Team ID" + "value": "ID Echipa" } ], "label.team-member": [ { "type": 0, - "value": "Team member" + "value": "Membru echipă" } ], "label.team-name": [ { "type": 0, - "value": "Team name" + "value": "Nume echipă" } ], "label.team-owner": [ { "type": 0, - "value": "Team owner" + "value": "Titular echipă" } ], "label.team-view-only": [ { "type": 0, - "value": "Team view only" + "value": "Doar vizualizare echipă" } ], "label.team-websites": [ { "type": 0, - "value": "Team websites" + "value": "Website-uri echipă" } ], "label.teams": [ { "type": 0, - "value": "Teams" + "value": "Echipă" } ], "label.theme": [ { "type": 0, - "value": "Theme" + "value": "Temă" } ], "label.this-month": [ @@ -1052,7 +1052,7 @@ "label.title": [ { "type": 0, - "value": "Title" + "value": "Titlu" } ], "label.today": [ @@ -1076,7 +1076,7 @@ "label.total-records": [ { "type": 0, - "value": "Total records" + "value": "Total înregistrări" } ], "label.tracking-code": [ @@ -1100,19 +1100,19 @@ "label.true": [ { "type": 0, - "value": "True" + "value": "Adevărat" } ], "label.type": [ { "type": 0, - "value": "Type" + "value": "Tip" } ], "label.unique": [ { "type": 0, - "value": "Unique" + "value": "Unici" } ], "label.unique-visitors": [ @@ -1130,7 +1130,7 @@ "label.untitled": [ { "type": 0, - "value": "Untitled" + "value": "Fără titlu" } ], "label.url": [ @@ -1148,7 +1148,7 @@ "label.user": [ { "type": 0, - "value": "User" + "value": "Utilizator" } ], "label.username": [ @@ -1160,19 +1160,19 @@ "label.users": [ { "type": 0, - "value": "Users" + "value": "Utilizatori" } ], "label.value": [ { "type": 0, - "value": "Value" + "value": "Valoare" } ], "label.view": [ { "type": 0, - "value": "View" + "value": "Vizualizare" } ], "label.view-details": [ @@ -1184,7 +1184,7 @@ "label.view-only": [ { "type": 0, - "value": "View only" + "value": "Doar vizualizare" } ], "label.views": [ @@ -1208,7 +1208,7 @@ "label.website-id": [ { "type": 0, - "value": "Website ID" + "value": "ID Website" } ], "label.websites": [ @@ -1220,19 +1220,19 @@ "label.window": [ { "type": 0, - "value": "Window" + "value": "Fereastră" } ], "label.yesterday": [ { "type": 0, - "value": "Yesterday" + "value": "Ieri" } ], "message.action-confirmation": [ { "type": 0, - "value": "Type " + "value": "Scrie " }, { "type": 1, @@ -1240,7 +1240,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": " în câmpul de mai jos pentru a confirma." } ], "message.active-users": [ @@ -1280,7 +1280,7 @@ "message.confirm-delete": [ { "type": 0, - "value": "Sunteți sigur că doriți să ștergeți " + "value": "Ești sigur că vrei să ștergi " }, { "type": 1, @@ -1294,7 +1294,7 @@ "message.confirm-leave": [ { "type": 0, - "value": "Are you sure you want to leave " + "value": "Ești sigur că vrei să părăsești " }, { "type": 1, @@ -1308,7 +1308,7 @@ "message.confirm-remove": [ { "type": 0, - "value": "Are you sure you want to remove " + "value": "Ești sigur că vrei să ștergi " }, { "type": 1, @@ -1322,7 +1322,7 @@ "message.confirm-reset": [ { "type": 0, - "value": "Sunteți sigur că doriți să resetați statisticile pentru " + "value": "Ești sigur că vrei să resetezi statisticile pentru " }, { "type": 1, @@ -1336,7 +1336,7 @@ "message.delete-team-warning": [ { "type": 0, - "value": "Deleting a team will also delete all team websites." + "value": "Ștergerea unei echipe va șterge și toate website-urile echipei." } ], "message.delete-website-warning": [ @@ -1358,7 +1358,7 @@ }, { "type": 0, - "value": " on " + "value": " la " }, { "type": 1, @@ -1380,13 +1380,13 @@ "message.invalid-domain": [ { "type": 0, - "value": "Domeniu nu este valid" + "value": "Domeniul nu este valid" } ], "message.min-password-length": [ { "type": 0, - "value": "Minimum length of " + "value": "Lungimea minimă este de " }, { "type": 1, @@ -1394,13 +1394,13 @@ }, { "type": 0, - "value": " characters" + "value": " caractere" } ], "message.new-version-available": [ { "type": 0, - "value": "A new version of Umami " + "value": "O nouă versiune de Umami " }, { "type": 1, @@ -1408,19 +1408,19 @@ }, { "type": 0, - "value": " is available!" + "value": " este disponibilă!" } ], "message.no-data-available": [ { "type": 0, - "value": "Nici o informație disponibilă." + "value": "Nicio informație disponibilă." } ], "message.no-event-data": [ { "type": 0, - "value": "No event data is available." + "value": "Nu sunt disponibile date legate de eveniment." } ], "message.no-match-password": [ @@ -1432,31 +1432,31 @@ "message.no-results-found": [ { "type": 0, - "value": "No results were found." + "value": "Nu a fost găsit niciun rezultat." } ], "message.no-team-websites": [ { "type": 0, - "value": "This team does not have any websites." + "value": "Echipa aceasta nu are niciun website." } ], "message.no-teams": [ { "type": 0, - "value": "You have not created any teams." + "value": "Nu ai creat nicio echipă." } ], "message.no-users": [ { "type": 0, - "value": "There are no users." + "value": "Nu există utilizatori." } ], "message.no-websites-configured": [ { "type": 0, - "value": "Nu aveți niciun site web configurat." + "value": "Nu ai niciun site web configurat." } ], "message.page-not-found": [ @@ -1468,7 +1468,7 @@ "message.reset-website": [ { "type": 0, - "value": "To reset this website, type " + "value": "Pentru a reseta acest website, scrie " }, { "type": 1, @@ -1476,7 +1476,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": " În câmpul de mai jos pentru a confirma." } ], "message.reset-website-warning": [ @@ -1508,19 +1508,19 @@ "message.team-already-member": [ { "type": 0, - "value": "You are already a member of the team." + "value": "Deja ești membru al acestei echipe." } ], "message.team-not-found": [ { "type": 0, - "value": "Team not found." + "value": "Echipa nu a fost găsită." } ], "message.team-websites-info": [ { "type": 0, - "value": "Websites can be viewed by anyone on the team." + "value": "Site-urile web pot fi vizualizate de către oricare membru al echipei." } ], "message.tracking-code": [ @@ -1532,37 +1532,37 @@ "message.transfer-team-website-to-user": [ { "type": 0, - "value": "Transfer this website to your account?" + "value": "Vrei să transferi acest website pe contul tău?" } ], "message.transfer-user-website-to-team": [ { "type": 0, - "value": "Select the team to transfer this website to." + "value": "Selectează echipa căreia vrei să îi transferi site-ul." } ], "message.transfer-website": [ { "type": 0, - "value": "Transfer website ownership to your account or another team." + "value": "Transferă titulatura site-ului către tine sau către o altă echipă." } ], "message.triggered-event": [ { "type": 0, - "value": "Triggered event" + "value": "Eveniment declanșat" } ], "message.user-deleted": [ { "type": 0, - "value": "User deleted." + "value": "Utilizator șters." } ], "message.viewed-page": [ { "type": 0, - "value": "Viewed page" + "value": "Pagină vizualizată" } ], "message.visitor-log": [ @@ -1602,7 +1602,7 @@ "message.visitors-dropped-off": [ { "type": 0, - "value": "Visitors dropped off" + "value": "Vizitatori care au abandonat" } ] } diff --git a/public/intl/messages/ru-RU.json b/public/intl/messages/ru-RU.json index 86949d67..7d3bd9ea 100644 --- a/public/intl/messages/ru-RU.json +++ b/public/intl/messages/ru-RU.json @@ -215,6 +215,12 @@ "value": "Создано" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/si-LK.json b/public/intl/messages/si-LK.json index f4e6b31b..eab794e6 100644 --- a/public/intl/messages/si-LK.json +++ b/public/intl/messages/si-LK.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/sk-SK.json b/public/intl/messages/sk-SK.json index dfbcd064..b1c300eb 100644 --- a/public/intl/messages/sk-SK.json +++ b/public/intl/messages/sk-SK.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/sl-SI.json b/public/intl/messages/sl-SI.json index 2c29c827..67524f57 100644 --- a/public/intl/messages/sl-SI.json +++ b/public/intl/messages/sl-SI.json @@ -215,6 +215,12 @@ "value": "Ustvarjeno" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/sv-SE.json b/public/intl/messages/sv-SE.json index 93103d51..5e3b9021 100644 --- a/public/intl/messages/sv-SE.json +++ b/public/intl/messages/sv-SE.json @@ -215,6 +215,12 @@ "value": "Skapad" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ta-IN.json b/public/intl/messages/ta-IN.json index f183b55b..e5f4f36b 100644 --- a/public/intl/messages/ta-IN.json +++ b/public/intl/messages/ta-IN.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/th-TH.json b/public/intl/messages/th-TH.json index 0e1a70c0..f4356a50 100644 --- a/public/intl/messages/th-TH.json +++ b/public/intl/messages/th-TH.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/tr-TR.json b/public/intl/messages/tr-TR.json index d2fdb0a0..1bd71b56 100644 --- a/public/intl/messages/tr-TR.json +++ b/public/intl/messages/tr-TR.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/uk-UA.json b/public/intl/messages/uk-UA.json index 89f95612..4dd2e86d 100644 --- a/public/intl/messages/uk-UA.json +++ b/public/intl/messages/uk-UA.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/ur-PK.json b/public/intl/messages/ur-PK.json index 2de7bc4d..1f9ad995 100644 --- a/public/intl/messages/ur-PK.json +++ b/public/intl/messages/ur-PK.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/vi-VN.json b/public/intl/messages/vi-VN.json index 733278f3..254f5070 100644 --- a/public/intl/messages/vi-VN.json +++ b/public/intl/messages/vi-VN.json @@ -215,6 +215,12 @@ "value": "Created" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/public/intl/messages/zh-CN.json b/public/intl/messages/zh-CN.json index 85b788c5..a66d7db3 100644 --- a/public/intl/messages/zh-CN.json +++ b/public/intl/messages/zh-CN.json @@ -32,7 +32,7 @@ "label.add-member": [ { "type": 0, - "value": "Add member" + "value": "添加成员" } ], "label.add-website": [ @@ -215,6 +215,12 @@ "value": "已创建" } ], + "label.created-by": [ + { + "type": 0, + "value": "创建者" + } + ], "label.current-password": [ { "type": 0, @@ -272,7 +278,7 @@ "label.delete-report": [ { "type": 0, - "value": "Delete report" + "value": "删除报告" } ], "label.delete-team": [ @@ -362,7 +368,7 @@ "label.edit-member": [ { "type": 0, - "value": "Edit member" + "value": "编辑成员" } ], "label.enable-share-url": [ @@ -588,7 +594,7 @@ "label.manage": [ { "type": 0, - "value": "Manage" + "value": "管理" } ], "label.max": [ @@ -600,7 +606,7 @@ "label.member": [ { "type": 0, - "value": "Member" + "value": "成员" } ], "label.members": [ @@ -630,7 +636,7 @@ "label.my-account": [ { "type": 0, - "value": "My account" + "value": "我的账户" } ], "label.my-websites": [ @@ -700,7 +706,7 @@ "label.os": [ { "type": 0, - "value": "OS" + "value": "操作系统" } ], "label.overview": [ @@ -718,7 +724,7 @@ "label.page-of": [ { "type": 0, - "value": "总" + "value": "总 " }, { "type": 1, @@ -726,7 +732,7 @@ }, { "type": 0, - "value": "中的第" + "value": " 中的第 " }, { "type": 1, @@ -734,7 +740,7 @@ }, { "type": 0, - "value": "页" + "value": " 页" } ], "label.page-views": [ @@ -850,7 +856,7 @@ "label.remove-member": [ { "type": 0, - "value": "Remove member" + "value": "移除成员" } ], "label.reports": [ @@ -922,7 +928,7 @@ "label.select": [ { "type": 0, - "value": "Select" + "value": "选择" } ], "label.select-date": [ @@ -934,7 +940,7 @@ "label.select-role": [ { "type": 0, - "value": "Select role" + "value": "选择角色" } ], "label.select-website": [ @@ -1012,7 +1018,7 @@ "label.team-view-only": [ { "type": 0, - "value": "Team view only" + "value": "仅团队视图" } ], "label.team-websites": [ @@ -1096,13 +1102,13 @@ "label.transfer": [ { "type": 0, - "value": "Transfer" + "value": "转移" } ], "label.transfer-website": [ { "type": 0, - "value": "Transfer website" + "value": "转移网站" } ], "label.true": [ @@ -1240,7 +1246,7 @@ "message.action-confirmation": [ { "type": 0, - "value": "Type " + "value": "在下面的框中输入 " }, { "type": 1, @@ -1248,7 +1254,7 @@ }, { "type": 0, - "value": " in the box below to confirm." + "value": " 以确认。" } ], "message.active-users": [ @@ -1296,7 +1302,7 @@ "message.confirm-remove": [ { "type": 0, - "value": "Are you sure you want to remove " + "value": "您确定要移除 " }, { "type": 1, @@ -1304,7 +1310,7 @@ }, { "type": 0, - "value": "?" + "value": " ?" } ], "message.confirm-reset": [ @@ -1318,13 +1324,13 @@ }, { "type": 0, - "value": " 的数据吗?" + "value": " 的数据吗?" } ], "message.delete-team-warning": [ { "type": 0, - "value": "Deleting a team will also delete all team websites." + "value": "删除团队也会删除所有团队的网站。" } ], "message.delete-website-warning": [ @@ -1346,7 +1352,7 @@ }, { "type": 0, - "value": "上的" + "value": " 上的 " }, { "type": 1, @@ -1388,7 +1394,7 @@ "message.new-version-available": [ { "type": 0, - "value": "Umami的新版本" + "value": "Umami 的新版本 " }, { "type": 1, @@ -1396,7 +1402,7 @@ }, { "type": 0, - "value": "已推出!" + "value": " 已推出!" } ], "message.no-data-available": [ @@ -1456,7 +1462,7 @@ "message.reset-website": [ { "type": 0, - "value": "如果确定重置该网站, 请在下面的输入框中输入 " + "value": "如果确定重置该网站,请在下面的输入框中输入 " }, { "type": 1, @@ -1520,25 +1526,25 @@ "message.transfer-team-website-to-user": [ { "type": 0, - "value": "Transfer this website to your account?" + "value": "将该网站转入您的账户?" } ], "message.transfer-user-website-to-team": [ { "type": 0, - "value": "Select the team to transfer this website to." + "value": "选择要将该网站转移到哪个团队。" } ], "message.transfer-website": [ { "type": 0, - "value": "Transfer website ownership to your account or another team." + "value": "将网站所有权转移到您的账户或其他团队。" } ], "message.triggered-event": [ { "type": 0, - "value": "Triggered event" + "value": "触发事件" } ], "message.user-deleted": [ @@ -1550,13 +1556,13 @@ "message.viewed-page": [ { "type": 0, - "value": "Viewed page" + "value": "已浏览页面" } ], "message.visitor-log": [ { "type": 0, - "value": "来自" + "value": "来自 " }, { "type": 1, @@ -1564,7 +1570,7 @@ }, { "type": 0, - "value": "的访客在搭载 " + "value": " 的访客在搭载 " }, { "type": 1, @@ -1572,7 +1578,7 @@ }, { "type": 0, - "value": " 的" + "value": " 的 " }, { "type": 1, @@ -1580,7 +1586,7 @@ }, { "type": 0, - "value": "上使用 " + "value": " 上使用 " }, { "type": 1, @@ -1594,7 +1600,7 @@ "message.visitors-dropped-off": [ { "type": 0, - "value": "Visitors dropped off" + "value": "访客减少" } ] } diff --git a/public/intl/messages/zh-TW.json b/public/intl/messages/zh-TW.json index af2a37a1..f0455d43 100644 --- a/public/intl/messages/zh-TW.json +++ b/public/intl/messages/zh-TW.json @@ -215,6 +215,12 @@ "value": "已建立" } ], + "label.created-by": [ + { + "type": 0, + "value": "Created By" + } + ], "label.current-password": [ { "type": 0, diff --git a/rollup.tracker.config.mjs b/rollup.tracker.config.mjs index 6a692efa..05df2879 100644 --- a/rollup.tracker.config.mjs +++ b/rollup.tracker.config.mjs @@ -10,7 +10,8 @@ export default { }, plugins: [ replace({ - '/api/send': process.env.COLLECT_API_ENDPOINT || '/api/send', + '__COLLECT_API_HOST__': process.env.COLLECT_API_HOST || '', + '__COLLECT_API_ENDPOINT__': process.env.COLLECT_API_ENDPOINT || '/api/send', delimiters: ['', ''], preventAssignment: true, }), diff --git a/src/app/(main)/reports/ReportsPage.tsx b/src/app/(main)/reports/ReportsPage.tsx index 6a63c2cb..a76a6a47 100644 --- a/src/app/(main)/reports/ReportsPage.tsx +++ b/src/app/(main)/reports/ReportsPage.tsx @@ -1,4 +1,5 @@ 'use client'; +import { Metadata } from 'next'; import ReportsHeader from './ReportsHeader'; import ReportsDataTable from './ReportsDataTable'; @@ -10,6 +11,7 @@ export default function ReportsPage({ teamId }: { teamId: string }) { ); } -export const metadata = { + +export const metadata: Metadata = { title: 'Reports', }; diff --git a/src/app/(main)/reports/[reportId]/ReportDetails.tsx b/src/app/(main)/reports/[reportId]/ReportDetails.tsx deleted file mode 100644 index 40d58e92..00000000 --- a/src/app/(main)/reports/[reportId]/ReportDetails.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import FunnelReport from '../funnel/FunnelReport'; -import EventDataReport from '../event-data/EventDataReport'; -import InsightsReport from '../insights/InsightsReport'; -import RetentionReport from '../retention/RetentionReport'; -import { useApi } from 'components/hooks'; - -const reports = { - funnel: FunnelReport, - 'event-data': EventDataReport, - insights: InsightsReport, - retention: RetentionReport, -}; - -export default function ReportDetails({ reportId }: { reportId: string }) { - const { get, useQuery } = useApi(); - const { data: report } = useQuery({ - queryKey: ['reports', reportId], - queryFn: () => get(`/reports/${reportId}`), - }); - - if (!report) { - return null; - } - - const ReportComponent = reports[report.type]; - - return ; -} diff --git a/src/app/(main)/reports/[reportId]/ReportPage.tsx b/src/app/(main)/reports/[reportId]/ReportPage.tsx index 227efa8d..7ecebd31 100644 --- a/src/app/(main)/reports/[reportId]/ReportPage.tsx +++ b/src/app/(main)/reports/[reportId]/ReportPage.tsx @@ -1,6 +1,27 @@ 'use client'; -import ReportDetails from './ReportDetails'; +import FunnelReport from '../funnel/FunnelReport'; +import EventDataReport from '../event-data/EventDataReport'; +import InsightsReport from '../insights/InsightsReport'; +import RetentionReport from '../retention/RetentionReport'; +import UTMReport from '../utm/UTMReport'; +import { useReport } from 'components/hooks'; -export default function ReportPage({ reportId }) { - return ; +const reports = { + funnel: FunnelReport, + 'event-data': EventDataReport, + insights: InsightsReport, + retention: RetentionReport, + utm: UTMReport, +}; + +export default function ReportPage({ reportId }: { reportId: string }) { + const { report } = useReport(reportId); + + if (!report) { + return null; + } + + const ReportComponent = reports[report.type]; + + return ; } diff --git a/src/app/(main)/reports/create/ReportTemplates.tsx b/src/app/(main)/reports/create/ReportTemplates.tsx index ae84046a..1bd84aec 100644 --- a/src/app/(main)/reports/create/ReportTemplates.tsx +++ b/src/app/(main)/reports/create/ReportTemplates.tsx @@ -4,6 +4,7 @@ import PageHeader from 'components/layout/PageHeader'; import Funnel from 'assets/funnel.svg'; import Lightbulb from 'assets/lightbulb.svg'; import Magnet from 'assets/magnet.svg'; +import Tag from 'assets/tag.svg'; import styles from './ReportTemplates.module.css'; import { useMessages, useTeamUrl } from 'components/hooks'; @@ -30,6 +31,12 @@ export function ReportTemplates({ showHeader = true }: { showHeader?: boolean }) url: renderTeamUrl('/reports/retention'), icon: , }, + { + title: formatMessage(labels.utm), + description: formatMessage(labels.utmDescription), + url: renderTeamUrl('/reports/utm'), + icon: , + }, ]; return ( diff --git a/src/app/(main)/reports/insights/InsightsParameters.tsx b/src/app/(main)/reports/insights/InsightsParameters.tsx index 4aaa9abd..a3e4e72f 100644 --- a/src/app/(main)/reports/insights/InsightsParameters.tsx +++ b/src/app/(main)/reports/insights/InsightsParameters.tsx @@ -53,11 +53,11 @@ export function InsightsParameters() { filters, }; - const handleSubmit = values => { + const handleSubmit = (values: any) => { runReport(values); }; - const handleAdd = (id, value) => { + const handleAdd = (id: string | number, value: { name: any }) => { const data = parameterData[id]; if (!data.find(({ name }) => name === value.name)) { @@ -65,7 +65,7 @@ export function InsightsParameters() { } }; - const handleRemove = (id, index) => { + const handleRemove = (id: string, index: number) => { const data = [...parameterData[id]]; data.splice(index, 1); updateReport({ parameters: { [id]: data } }); diff --git a/src/app/(main)/reports/retention/RetentionReportPage.tsx b/src/app/(main)/reports/retention/RetentionReportPage.tsx index f2500fb2..4d3e19e9 100644 --- a/src/app/(main)/reports/retention/RetentionReportPage.tsx +++ b/src/app/(main)/reports/retention/RetentionReportPage.tsx @@ -1,6 +1,11 @@ 'use client'; +import { Metadata } from 'next'; import RetentionReport from './RetentionReport'; export default function RetentionReportPage() { return ; } + +export const metadata: Metadata = { + title: 'Retention Report', +}; diff --git a/src/app/(main)/reports/utm/UTMParameters.tsx b/src/app/(main)/reports/utm/UTMParameters.tsx new file mode 100644 index 00000000..c76df77d --- /dev/null +++ b/src/app/(main)/reports/utm/UTMParameters.tsx @@ -0,0 +1,36 @@ +import { useContext } from 'react'; +import { useMessages } from 'components/hooks'; +import { Form, FormButtons, SubmitButton } from 'react-basics'; +import { ReportContext } from '../[reportId]/Report'; +import BaseParameters from '../[reportId]/BaseParameters'; + +export function UTMParameters() { + const { report, runReport, isRunning } = useContext(ReportContext); + const { formatMessage, labels } = useMessages(); + + const { id, parameters } = report || {}; + const { websiteId, dateRange } = parameters || {}; + const queryDisabled = !websiteId || !dateRange; + + const handleSubmit = (data: any, e: any) => { + e.stopPropagation(); + e.preventDefault(); + + if (!queryDisabled) { + runReport(data); + } + }; + + return ( +
+ + + + {formatMessage(labels.runQuery)} + + + + ); +} + +export default UTMParameters; diff --git a/src/app/(main)/reports/utm/UTMReport.tsx b/src/app/(main)/reports/utm/UTMReport.tsx new file mode 100644 index 00000000..7183b9f7 --- /dev/null +++ b/src/app/(main)/reports/utm/UTMReport.tsx @@ -0,0 +1,28 @@ +'use client'; +import Report from '../[reportId]/Report'; +import ReportHeader from '../[reportId]/ReportHeader'; +import ReportMenu from '../[reportId]/ReportMenu'; +import ReportBody from '../[reportId]/ReportBody'; +import UTMParameters from './UTMParameters'; +import UTMView from './UTMView'; +import Tag from 'assets/tag.svg'; +import { REPORT_TYPES } from 'lib/constants'; + +const defaultParameters = { + type: REPORT_TYPES.utm, + parameters: {}, +}; + +export default function UTMReport({ reportId }: { reportId?: string }) { + return ( + + } /> + + + + + + + + ); +} diff --git a/src/app/(main)/reports/utm/UTMReportPage.tsx b/src/app/(main)/reports/utm/UTMReportPage.tsx new file mode 100644 index 00000000..926a4263 --- /dev/null +++ b/src/app/(main)/reports/utm/UTMReportPage.tsx @@ -0,0 +1,5 @@ +import UTMReport from './UTMReport'; + +export default function UTMReportPage() { + return ; +} diff --git a/src/app/(main)/reports/utm/UTMView.module.css b/src/app/(main)/reports/utm/UTMView.module.css new file mode 100644 index 00000000..9792e0f3 --- /dev/null +++ b/src/app/(main)/reports/utm/UTMView.module.css @@ -0,0 +1,14 @@ +.title { + font-size: 18px; + line-height: 36px; + font-weight: 700; +} + +.row { + display: grid; + grid-template-columns: 50% 50%; + gap: 20px; + border-bottom: 1px solid var(--base300); + padding-bottom: 30px; + margin-bottom: 30px; +} diff --git a/src/app/(main)/reports/utm/UTMView.tsx b/src/app/(main)/reports/utm/UTMView.tsx new file mode 100644 index 00000000..48fb6497 --- /dev/null +++ b/src/app/(main)/reports/utm/UTMView.tsx @@ -0,0 +1,65 @@ +import { useContext } from 'react'; +import { firstBy } from 'thenby'; +import { ReportContext } from '../[reportId]/Report'; +import { CHART_COLORS, UTM_PARAMS } from 'lib/constants'; +import PieChart from 'components/charts/PieChart'; +import ListTable from 'components/metrics/ListTable'; +import styles from './UTMView.module.css'; +import { useMessages } from 'components/hooks'; + +function toArray(data: { [key: string]: number }) { + return Object.keys(data) + .map(key => { + return { name: key, value: data[key] }; + }) + .sort(firstBy('value', -1)); +} + +export default function UTMView() { + const { formatMessage, labels } = useMessages(); + const { report } = useContext(ReportContext); + const { data } = report || {}; + + if (!data) { + return null; + } + + return ( +
+ {UTM_PARAMS.map(key => { + const items = toArray(data[key]); + const chartData = { + labels: items.map(({ name }) => name), + datasets: [ + { + data: items.map(({ value }) => value), + backgroundColor: CHART_COLORS, + }, + ], + }; + const total = items.reduce((sum, { value }) => { + return +sum + +value; + }, 0); + + return ( +
+
+
{key}
+ ({ + x: name, + y: value, + z: (value / total) * 100, + }))} + /> +
+
+ +
+
+ ); + })} +
+ ); +} diff --git a/src/app/(main)/reports/utm/page.tsx b/src/app/(main)/reports/utm/page.tsx new file mode 100644 index 00000000..12b6cc5b --- /dev/null +++ b/src/app/(main)/reports/utm/page.tsx @@ -0,0 +1,10 @@ +import { Metadata } from 'next'; +import UTMReportPage from './UTMReportPage'; + +export default function () { + return ; +} + +export const metadata: Metadata = { + title: 'UTM Report', +}; diff --git a/src/app/(main)/websites/[websiteId]/realtime/Realtime.module.css b/src/app/(main)/websites/[websiteId]/realtime/Realtime.module.css deleted file mode 100644 index 465be551..00000000 --- a/src/app/(main)/websites/[websiteId]/realtime/Realtime.module.css +++ /dev/null @@ -1,16 +0,0 @@ -.container { - display: flex; -} - -.chart { - margin-bottom: 30px; -} - -.sticky { - position: fixed; - top: 0; - background: var(--base50); - border-bottom: 1px solid var(--base300); - z-index: 1; - padding: 10px 0; -} diff --git a/src/app/(main)/websites/[websiteId]/realtime/Realtime.tsx b/src/app/(main)/websites/[websiteId]/realtime/Realtime.tsx deleted file mode 100644 index 6314fbb8..00000000 --- a/src/app/(main)/websites/[websiteId]/realtime/Realtime.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { useMemo, useState, useEffect } from 'react'; -import { subMinutes, startOfMinute } from 'date-fns'; -import thenby from 'thenby'; -import { Grid, GridRow } from 'components/layout/Grid'; -import Page from 'components/layout/Page'; -import RealtimeChart from 'components/metrics/RealtimeChart'; -import WorldMap from 'components/metrics/WorldMap'; -import { useApi, useWebsite } from 'components/hooks'; -import { percentFilter } from 'lib/filters'; -import { REALTIME_RANGE, REALTIME_INTERVAL } from 'lib/constants'; -import { RealtimeData } from 'lib/types'; -import RealtimeLog from './RealtimeLog'; -import RealtimeHeader from './RealtimeHeader'; -import RealtimeUrls from './RealtimeUrls'; -import RealtimeCountries from './RealtimeCountries'; -import WebsiteHeader from '../WebsiteHeader'; -import styles from './Realtime.module.css'; - -function mergeData(state = [], data = [], time: number) { - const ids = state.map(({ id }) => id); - return state - .concat(data.filter(({ id }) => !ids.includes(id))) - .filter(({ timestamp }) => timestamp >= time); -} - -export function Realtime({ websiteId }) { - const [currentData, setCurrentData] = useState(); - const { get, useQuery } = useApi(); - const { data: website } = useWebsite(websiteId); - const { data, isLoading, error } = useQuery({ - queryKey: ['realtime', websiteId], - queryFn: () => get(`/realtime/${websiteId}`, { startAt: currentData?.timestamp || 0 }), - enabled: !!(websiteId && website), - refetchInterval: REALTIME_INTERVAL, - }); - - useEffect(() => { - if (data) { - const date = subMinutes(startOfMinute(new Date()), REALTIME_RANGE); - const time = date.getTime(); - const { pageviews, sessions, events, timestamp } = data; - - setCurrentData(state => ({ - pageviews: mergeData(state?.pageviews, pageviews, time), - sessions: mergeData(state?.sessions, sessions, time), - events: mergeData(state?.events, events, time), - timestamp, - })); - } - }, [data]); - - const realtimeData: RealtimeData = useMemo(() => { - if (!currentData) { - return { pageviews: [], sessions: [], events: [], countries: [], visitors: [], timestamp: 0 }; - } - - currentData.countries = percentFilter( - currentData.sessions - .reduce((arr, data) => { - if (!arr.find(({ id }) => id === data.id)) { - return arr.concat(data); - } - return arr; - }, []) - .reduce((arr: { x: any; y: number }[], { country }: any) => { - if (country) { - const row = arr.find(({ x }) => x === country); - - if (!row) { - arr.push({ x: country, y: 1 }); - } else { - row.y += 1; - } - } - return arr; - }, []) - .sort(thenby.firstBy('y', -1)), - ); - - currentData.visitors = currentData.sessions.reduce((arr, val) => { - if (!arr.find(({ id }) => id === val.id)) { - return arr.concat(val); - } - return arr; - }, []); - - return currentData; - }, [currentData]); - - if (isLoading || error) { - return ; - } - - return ( - <> - - - - - - - - - - - - - - - ); -} - -export default Realtime; diff --git a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.module.css b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.module.css index fb5fdecf..19d02384 100644 --- a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.module.css +++ b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.module.css @@ -35,11 +35,6 @@ overflow: hidden; } -.website { - text-align: right; - padding: 0 20px; -} - .detail { display: flex; align-items: center; diff --git a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx index d9aad35b..c26d0629 100644 --- a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx +++ b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from 'react'; +import { useContext, useMemo, useState } from 'react'; import { StatusLight, Icon, Text, SearchField } from 'react-basics'; import { FixedSizeList } from 'react-window'; import { format } from 'date-fns'; @@ -11,6 +11,8 @@ import Icons from 'components/icons'; import useFormat from 'components//hooks/useFormat'; import { BROWSERS } from 'lib/constants'; import { stringToColor } from 'lib/format'; +import { RealtimeData } from 'lib/types'; +import { WebsiteContext } from '../WebsiteProvider'; import styles from './RealtimeLog.module.css'; const TYPE_ALL = 'all'; @@ -24,7 +26,8 @@ const icons = { [TYPE_EVENT]: , }; -export function RealtimeLog({ data, websiteDomain }) { +export function RealtimeLog({ data }: { data: RealtimeData }) { + const website = useContext(WebsiteContext); const [search, setSearch] = useState(''); const { formatMessage, labels, messages, FormattedMessage } = useMessages(); const { formatValue } = useFormat(); @@ -76,7 +79,7 @@ export function RealtimeLog({ data, websiteDomain }) { event: {eventName || formatMessage(labels.unknown)}, url: ( (FILTER_REFERRERS); @@ -31,7 +27,7 @@ export function RealtimeUrls({ ]; const renderLink = ({ x }) => { - const domain = x.startsWith('/') ? websiteDomain : ''; + const domain = x.startsWith('/') ? website?.domain : ''; return ( {x} diff --git a/src/app/(main)/websites/[websiteId]/realtime/WebsiteRealtimePage.tsx b/src/app/(main)/websites/[websiteId]/realtime/WebsiteRealtimePage.tsx index 7e538812..8c1e3800 100644 --- a/src/app/(main)/websites/[websiteId]/realtime/WebsiteRealtimePage.tsx +++ b/src/app/(main)/websites/[websiteId]/realtime/WebsiteRealtimePage.tsx @@ -1,6 +1,40 @@ 'use client'; -import Realtime from './Realtime'; +import { Grid, GridRow } from 'components/layout/Grid'; +import Page from 'components/layout/Page'; +import RealtimeChart from 'components/metrics/RealtimeChart'; +import WorldMap from 'components/metrics/WorldMap'; +import { useRealtime } from 'components/hooks'; +import RealtimeLog from './RealtimeLog'; +import RealtimeHeader from './RealtimeHeader'; +import RealtimeUrls from './RealtimeUrls'; +import RealtimeCountries from './RealtimeCountries'; +import WebsiteHeader from '../WebsiteHeader'; +import WebsiteProvider from '../WebsiteProvider'; -export default function WebsiteRealtimePage({ websiteId }) { - return ; +export function WebsiteRealtimePage({ websiteId }) { + const { data, isLoading, error } = useRealtime(websiteId); + + if (isLoading || error) { + return ; + } + + return ( + + + + + + + + + + + + + + + + ); } + +export default WebsiteRealtimePage; diff --git a/src/assets/bookmark.svg b/src/assets/bookmark.svg new file mode 100644 index 00000000..5abc5ed2 --- /dev/null +++ b/src/assets/bookmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/flag.svg b/src/assets/flag.svg new file mode 100644 index 00000000..c3750585 --- /dev/null +++ b/src/assets/flag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/speaker.svg b/src/assets/speaker.svg new file mode 100644 index 00000000..f243a494 --- /dev/null +++ b/src/assets/speaker.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tag.svg b/src/assets/tag.svg new file mode 100644 index 00000000..0e0f3668 --- /dev/null +++ b/src/assets/tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/visitor.svg b/src/assets/visitor.svg index 4aeceafc..829eb8e1 100644 --- a/src/assets/visitor.svg +++ b/src/assets/visitor.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/charts/BarChart.tsx b/src/components/charts/BarChart.tsx new file mode 100644 index 00000000..09ff5154 --- /dev/null +++ b/src/components/charts/BarChart.tsx @@ -0,0 +1,85 @@ +import { useTheme } from 'components/hooks'; +import Chart, { ChartProps } from 'components/charts/Chart'; +import { renderNumberLabels } from 'lib/charts'; +import { useState } from 'react'; +import BarChartTooltip from 'components/charts/BarChartTooltip'; + +export interface BarChartProps extends ChartProps { + unit: string; + stacked?: boolean; + renderXLabel?: (label: string, index: number, values: any[]) => string; + renderYLabel?: (label: string, index: number, values: any[]) => string; + XAxisType?: string; + YAxisType?: string; +} + +export function BarChart(props: BarChartProps) { + const [tooltip, setTooltip] = useState(null); + const { colors } = useTheme(); + const { + renderXLabel, + renderYLabel, + unit, + XAxisType = 'time', + YAxisType = 'linear', + stacked = false, + } = props; + + const options = { + scales: { + x: { + type: XAxisType, + stacked: true, + time: { + unit, + }, + grid: { + display: false, + }, + border: { + color: colors.chart.line, + }, + ticks: { + color: colors.chart.text, + autoSkip: false, + maxRotation: 0, + callback: renderXLabel, + }, + }, + y: { + type: YAxisType, + min: 0, + beginAtZero: true, + stacked, + grid: { + color: colors.chart.line, + }, + border: { + color: colors.chart.line, + }, + ticks: { + color: colors.chart.text, + callback: renderYLabel || renderNumberLabels, + }, + }, + }, + }; + + const handleTooltip = ({ tooltip }: { tooltip: any }) => { + const { opacity } = tooltip; + + setTooltip(opacity ? : null); + }; + + return ( + + ); +} + +export default BarChart; diff --git a/src/components/charts/BarChartTooltip.tsx b/src/components/charts/BarChartTooltip.tsx new file mode 100644 index 00000000..b81d55fe --- /dev/null +++ b/src/components/charts/BarChartTooltip.tsx @@ -0,0 +1,32 @@ +import { formatDate } from 'lib/date'; +import { Flexbox, StatusLight } from 'react-basics'; +import { formatLongNumber } from 'lib/format'; +import { useLocale } from 'components/hooks'; + +const formats = { + millisecond: 'T', + second: 'pp', + minute: 'p', + hour: 'h:mm aaa - PP', + day: 'PPPP', + week: 'PPPP', + month: 'LLLL yyyy', + quarter: 'qqq', + year: 'yyyy', +}; + +export default function BarChartTooltip({ tooltip, unit }) { + const { locale } = useLocale(); + const { labelColors, dataPoints } = tooltip; + + return ( + +
{formatDate(new Date(dataPoints[0].raw.x), formats[unit], locale)}
+
+ + {formatLongNumber(dataPoints[0].raw.y)} {dataPoints[0].dataset.label} + +
+
+ ); +} diff --git a/src/components/metrics/BarChart.module.css b/src/components/charts/Chart.module.css similarity index 62% rename from src/components/metrics/BarChart.module.css rename to src/components/charts/Chart.module.css index 6af22abe..ee61f29b 100644 --- a/src/components/metrics/BarChart.module.css +++ b/src/components/charts/Chart.module.css @@ -1,7 +1,3 @@ -.container { - display: grid; -} - .chart { position: relative; height: 400px; @@ -13,7 +9,3 @@ flex-direction: column; gap: 10px; } - -.tooltip .value { - text-transform: lowercase; -} diff --git a/src/components/charts/Chart.tsx b/src/components/charts/Chart.tsx new file mode 100644 index 00000000..abaa6eb8 --- /dev/null +++ b/src/components/charts/Chart.tsx @@ -0,0 +1,141 @@ +import { useState, useRef, useEffect, ReactNode } from 'react'; +import { Loading } from 'react-basics'; +import classNames from 'classnames'; +import ChartJS, { LegendItem } from 'chart.js/auto'; +import HoverTooltip from 'components/common/HoverTooltip'; +import Legend from 'components/metrics/Legend'; +import { DEFAULT_ANIMATION_DURATION } from 'lib/constants'; +import styles from './Chart.module.css'; + +export interface ChartProps { + type?: 'bar' | 'bubble' | 'doughnut' | 'pie' | 'line' | 'polarArea' | 'radar' | 'scatter'; + data?: object; + isLoading?: boolean; + animationDuration?: number; + updateMode?: string; + onCreate?: (chart: any) => void; + onUpdate?: (chart: any) => void; + onTooltip?: (model: any) => void; + className?: string; + chartOptions?: { [key: string]: any }; + tooltip?: ReactNode; +} + +export function Chart({ + type, + data, + isLoading = false, + animationDuration = DEFAULT_ANIMATION_DURATION, + tooltip, + updateMode, + onCreate, + onUpdate, + onTooltip, + className, + chartOptions, +}: ChartProps) { + const canvas = useRef(); + const chart = useRef(null); + const [legendItems, setLegendItems] = useState([]); + + const options = { + responsive: true, + maintainAspectRatio: false, + animation: { + duration: animationDuration, + resize: { + duration: 0, + }, + active: { + duration: 0, + }, + }, + plugins: { + legend: { + display: false, + }, + tooltip: { + enabled: false, + external: onTooltip, + }, + }, + ...chartOptions, + }; + + const createChart = (data: any) => { + ChartJS.defaults.font.family = 'Inter'; + + chart.current = new ChartJS(canvas.current, { + type, + data, + options, + }); + + onCreate?.(chart.current); + + setLegendItems(chart.current.legend.legendItems); + }; + + const updateChart = (data: any) => { + chart.current.data.datasets.forEach((dataset: { data: any }, index: string | number) => { + dataset.data = data?.datasets[index]?.data; + }); + + chart.current.options = options; + + // Allow config changes before update + onUpdate?.(chart.current); + + chart.current.update(updateMode); + + setLegendItems(chart.current.legend.legendItems); + }; + + useEffect(() => { + if (data) { + if (!chart.current) { + createChart(data); + } else { + updateChart(data); + } + } + }, [data]); + + const handleLegendClick = (item: LegendItem) => { + if (type === 'bar') { + const { datasetIndex } = item; + const meta = chart.current.getDatasetMeta(datasetIndex); + + meta.hidden = + meta.hidden === null ? !chart.current.data.datasets[datasetIndex]?.hidden : null; + } else { + const { index } = item; + const meta = chart.current.getDatasetMeta(0); + const hidden = !!meta.data[index].hidden; + + meta.data[index].hidden = !hidden; + chart.current.legend.legendItems[index].hidden = !hidden; + } + + chart.current.update(updateMode); + + setLegendItems(chart.current.legend.legendItems); + }; + + return ( + <> +
+ {isLoading && } + +
+ + {tooltip && ( + +
{tooltip}
+
+ )} + + ); +} + +export default Chart; diff --git a/src/components/charts/PieChart.tsx b/src/components/charts/PieChart.tsx new file mode 100644 index 00000000..11ad125c --- /dev/null +++ b/src/components/charts/PieChart.tsx @@ -0,0 +1,27 @@ +import { Chart, ChartProps } from 'components/charts/Chart'; +import { useState } from 'react'; +import { StatusLight } from 'react-basics'; +import { formatLongNumber } from 'lib/format'; + +export interface PieChartProps extends ChartProps { + type?: 'doughnut' | 'pie'; +} + +export default function PieChart(props: PieChartProps) { + const [tooltip, setTooltip] = useState(null); + const { type } = props; + + const handleTooltip = ({ tooltip }) => { + const { labelColors, dataPoints } = tooltip; + + setTooltip( + tooltip.opacity ? ( + + {formatLongNumber(dataPoints?.[0]?.raw)} {dataPoints?.[0]?.label} + + ) : null, + ); + }; + + return ; +} diff --git a/src/components/common/Breadcrumb.module.css b/src/components/common/Breadcrumb.module.css index 70d88f36..73e72bc6 100644 --- a/src/components/common/Breadcrumb.module.css +++ b/src/components/common/Breadcrumb.module.css @@ -1,5 +1,5 @@ .bar { - font-size: 11px; + font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--base600); diff --git a/src/components/common/Breadcrumb.tsx b/src/components/common/Breadcrumb.tsx index fa7bde15..ebdce497 100644 --- a/src/components/common/Breadcrumb.tsx +++ b/src/components/common/Breadcrumb.tsx @@ -1,6 +1,7 @@ import Link from 'next/link'; import { Flexbox, Icon, Icons, Text } from 'react-basics'; import styles from './Breadcrumb.module.css'; +import { Fragment } from 'react'; export interface BreadcrumbProps { data: { @@ -14,7 +15,7 @@ export function Breadcrumb({ data }: BreadcrumbProps) { {data.map((a, i) => { return ( - <> + {a.url ? ( {a.label} @@ -27,7 +28,7 @@ export function Breadcrumb({ data }: BreadcrumbProps) { ) : null} - + ); })} diff --git a/src/components/common/FilterLink.tsx b/src/components/common/FilterLink.tsx index 2a4747ff..ef278ed2 100644 --- a/src/components/common/FilterLink.tsx +++ b/src/components/common/FilterLink.tsx @@ -1,10 +1,9 @@ +import classNames from 'classnames'; +import { useMessages, useNavigation } from 'components/hooks'; +import { safeDecodeURIComponent } from 'next-basics'; +import Link from 'next/link'; import { ReactNode } from 'react'; import { Icon, Icons } from 'react-basics'; -import classNames from 'classnames'; -import Link from 'next/link'; -import { safeDecodeURI } from 'next-basics'; -import { useNavigation } from 'components/hooks'; -import { useMessages } from 'components/hooks'; import styles from './FilterLink.module.css'; export interface FilterLinkProps { @@ -40,7 +39,7 @@ export function FilterLink({ {!value && `(${label || formatMessage(labels.unknown)})`} {value && ( - {safeDecodeURI(label || value)} + {safeDecodeURIComponent(label || value)} )} {externalUrl && ( diff --git a/src/components/hooks/index.ts b/src/components/hooks/index.ts index 560d48a0..a737ba20 100644 --- a/src/components/hooks/index.ts +++ b/src/components/hooks/index.ts @@ -2,6 +2,7 @@ export * from './queries/useApi'; export * from './queries/useConfig'; export * from './queries/useFilterQuery'; export * from './queries/useLogin'; +export * from './queries/useRealtime'; export * from './queries/useReport'; export * from './queries/useReports'; export * from './queries/useShareToken'; diff --git a/src/components/hooks/queries/useRealtime.ts b/src/components/hooks/queries/useRealtime.ts new file mode 100644 index 00000000..ccf6a62d --- /dev/null +++ b/src/components/hooks/queries/useRealtime.ts @@ -0,0 +1,87 @@ +import { useMemo, useRef } from 'react'; +import { RealtimeData } from 'lib/types'; +import { useApi } from 'components/hooks'; +import { REALTIME_INTERVAL, REALTIME_RANGE } from 'lib/constants'; +import { startOfMinute, subMinutes } from 'date-fns'; +import { percentFilter } from 'lib/filters'; +import thenby from 'thenby'; + +function mergeData(state = [], data = [], time: number) { + const ids = state.map(({ id }) => id); + return state + .concat(data.filter(({ id }) => !ids.includes(id))) + .filter(({ timestamp }) => timestamp >= time); +} + +export function useRealtime(websiteId: string) { + const currentData = useRef({ + pageviews: [], + sessions: [], + events: [], + countries: [], + visitors: [], + timestamp: 0, + }); + const { get, useQuery } = useApi(); + const { data, isLoading, error } = useQuery({ + queryKey: ['realtime', websiteId], + queryFn: async () => { + const state = currentData.current; + const data = await get(`/realtime/${websiteId}`, { startAt: state?.timestamp || 0 }); + const date = subMinutes(startOfMinute(new Date()), REALTIME_RANGE); + const time = date.getTime(); + const { pageviews, sessions, events, timestamp } = data; + + return { + pageviews: mergeData(state?.pageviews, pageviews, time), + sessions: mergeData(state?.sessions, sessions, time), + events: mergeData(state?.events, events, time), + timestamp, + }; + }, + enabled: !!websiteId, + refetchInterval: REALTIME_INTERVAL, + }); + + const realtimeData: RealtimeData = useMemo(() => { + if (!data) { + return { pageviews: [], sessions: [], events: [], countries: [], visitors: [], timestamp: 0 }; + } + + data.countries = percentFilter( + data.sessions + .reduce((arr, data) => { + if (!arr.find(({ id }) => id === data.id)) { + return arr.concat(data); + } + return arr; + }, []) + .reduce((arr: { x: any; y: number }[], { country }: any) => { + if (country) { + const row = arr.find(({ x }) => x === country); + + if (!row) { + arr.push({ x: country, y: 1 }); + } else { + row.y += 1; + } + } + return arr; + }, []) + .sort(thenby.firstBy('y', -1)), + ); + + data.visitors = data.sessions.reduce((arr, val) => { + if (!arr.find(({ id }) => id === val.id)) { + return arr.concat(val); + } + return arr; + }, []); + + return data; + }, [data]); + + return { data: realtimeData, isLoading, error }; +} + +export default useRealtime; diff --git a/src/components/hooks/queries/useReport.ts b/src/components/hooks/queries/useReport.ts index 38061761..ef571d00 100644 --- a/src/components/hooks/queries/useReport.ts +++ b/src/components/hooks/queries/useReport.ts @@ -4,7 +4,7 @@ import { useApi } from './useApi'; import { useTimezone } from '../useTimezone'; import { useMessages } from '../useMessages'; -export function useReport(reportId: string, defaultParameters: { [key: string]: any }) { +export function useReport(reportId: string, defaultParameters: { [key: string]: any } = {}) { const [report, setReport] = useState(null); const [isRunning, setIsRunning] = useState(false); const { get, post } = useApi(); diff --git a/src/components/hooks/useTheme.ts b/src/components/hooks/useTheme.ts index 099bf962..f2a2d448 100644 --- a/src/components/hooks/useTheme.ts +++ b/src/components/hooks/useTheme.ts @@ -1,19 +1,13 @@ import { useEffect } from 'react'; import useStore, { setTheme } from 'store/app'; import { getItem, setItem } from 'next-basics'; -import { THEME_COLORS, THEME_CONFIG } from 'lib/constants'; +import { DEFAULT_THEME, THEME_COLORS, THEME_CONFIG } from 'lib/constants'; import { colord } from 'colord'; const selector = (state: { theme: string }) => state.theme; export function useTheme() { - const defaultTheme = - typeof window !== 'undefined' - ? window?.matchMedia('(prefers-color-scheme: dark)')?.matches - ? 'dark' - : 'light' - : 'light'; - const theme = useStore(selector) || getItem(THEME_CONFIG) || defaultTheme; + const theme = useStore(selector) || getItem(THEME_CONFIG) || DEFAULT_THEME; const primaryColor = colord(THEME_COLORS[theme].primary); const colors = { diff --git a/src/components/input/DateFilter.tsx b/src/components/input/DateFilter.tsx index afe44e6f..f025da97 100644 --- a/src/components/input/DateFilter.tsx +++ b/src/components/input/DateFilter.tsx @@ -32,18 +32,14 @@ export function DateFilter({ const { locale } = useLocale(); const options = [ - { label: formatMessage(labels.today), value: '1day' }, + { label: formatMessage(labels.today), value: '0day' }, { label: formatMessage(labels.lastHours, { x: 24 }), value: '24hour', }, - { - label: formatMessage(labels.yesterday), - value: '-1day', - }, { label: formatMessage(labels.thisWeek), - value: '1week', + value: '0week', divider: true, }, { @@ -52,7 +48,7 @@ export function DateFilter({ }, { label: formatMessage(labels.thisMonth), - value: '1month', + value: '0month', divider: true, }, { @@ -63,7 +59,7 @@ export function DateFilter({ label: formatMessage(labels.lastDays, { x: 90 }), value: '90day', }, - { label: formatMessage(labels.thisYear), value: '1year' }, + { label: formatMessage(labels.thisYear), value: '0year' }, showAllTime && { label: formatMessage(labels.allTime), value: 'all', diff --git a/src/components/messages.ts b/src/components/messages.ts index 36bdf057..9f2deb84 100644 --- a/src/components/messages.ts +++ b/src/components/messages.ts @@ -15,6 +15,7 @@ export const labels = defineMessages({ username: { id: 'label.username', defaultMessage: 'Username' }, password: { id: 'label.password', defaultMessage: 'Password' }, role: { id: 'label.role', defaultMessage: 'Role' }, + admin: { id: 'label.admin', defaultMessage: 'Admin' }, user: { id: 'label.user', defaultMessage: 'User' }, viewOnly: { id: 'label.view-only', defaultMessage: 'View only' }, manage: { id: 'label.manage', defaultMessage: 'Manage' }, @@ -222,6 +223,11 @@ export const labels = defineMessages({ id: 'message.visitors-dropped-off', defaultMessage: 'Visitors dropped off', }, + utm: { id: 'label.utm', defaultMessage: 'UTM' }, + utmDescription: { + id: 'label.utm-description', + defaultMessage: 'Track your campaigns through UTM parameters.', + }, }); export const messages = defineMessages({ diff --git a/src/components/metrics/BarChart.tsx b/src/components/metrics/BarChart.tsx deleted file mode 100644 index 1b1c7588..00000000 --- a/src/components/metrics/BarChart.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import { useState, useRef, useEffect, useCallback } from 'react'; -import { Loading } from 'react-basics'; -import classNames from 'classnames'; -import Chart from 'chart.js/auto'; -import HoverTooltip from 'components/common/HoverTooltip'; -import Legend from 'components/metrics/Legend'; -import { useLocale } from 'components/hooks'; -import { useTheme } from 'components/hooks'; -import { DEFAULT_ANIMATION_DURATION } from 'lib/constants'; -import { renderNumberLabels } from 'lib/charts'; -import styles from './BarChart.module.css'; - -export interface BarChartProps { - datasets?: any[]; - unit?: string; - animationDuration?: number; - stacked?: boolean; - isLoading?: boolean; - renderXLabel?: (label: string, index: number, values: any[]) => string; - renderYLabel?: (label: string, index: number, values: any[]) => string; - XAxisType?: string; - YAxisType?: string; - renderTooltipPopup?: (setTooltipPopup: (data: any) => void, model: any) => void; - onCreate?: (chart: any) => void; - onUpdate?: (chart: any) => void; - className?: string; -} - -export function BarChart({ - datasets = [], - unit, - animationDuration = DEFAULT_ANIMATION_DURATION, - stacked = false, - isLoading = false, - renderXLabel, - renderYLabel, - XAxisType = 'time', - YAxisType = 'linear', - renderTooltipPopup, - onCreate, - onUpdate, - className, -}: BarChartProps) { - const canvas = useRef(); - const chart = useRef(null); - const [tooltip, setTooltipPopup] = useState(null); - const { locale } = useLocale(); - const { theme, colors } = useTheme(); - - const getOptions = useCallback(() => { - return { - responsive: true, - maintainAspectRatio: false, - animation: { - duration: animationDuration, - resize: { - duration: 0, - }, - active: { - duration: 0, - }, - }, - plugins: { - legend: { - display: false, - }, - tooltip: { - enabled: false, - external: renderTooltipPopup ? renderTooltipPopup.bind(null, setTooltipPopup) : undefined, - }, - }, - scales: { - x: { - type: XAxisType, - stacked: true, - time: { - unit, - }, - grid: { - display: false, - }, - border: { - color: colors.chart.line, - }, - ticks: { - color: colors.chart.text, - autoSkip: false, - maxRotation: 0, - callback: renderXLabel, - }, - }, - y: { - type: YAxisType, - min: 0, - beginAtZero: true, - stacked, - grid: { - color: colors.chart.line, - }, - border: { - color: colors.chart.line, - }, - ticks: { - color: colors.chart.text, - callback: renderYLabel || renderNumberLabels, - }, - }, - }, - }; - }, [ - animationDuration, - renderTooltipPopup, - renderXLabel, - XAxisType, - YAxisType, - stacked, - colors, - unit, - locale, - ]); - - const createChart = () => { - Chart.defaults.font.family = 'Inter'; - - chart.current = new Chart(canvas.current, { - type: 'bar', - data: { - datasets, - }, - options: getOptions() as any, - }); - - onCreate?.(chart.current); - }; - - const updateChart = () => { - setTooltipPopup(null); - - chart.current.data.datasets = datasets; - - chart.current.options = getOptions(); - - onUpdate?.(chart.current); - - chart.current.update(); - }; - - useEffect(() => { - if (datasets) { - if (!chart.current) { - createChart(); - } else { - updateChart(); - } - } - }, [datasets, unit, theme, animationDuration, locale]); - - return ( - <> -
- {isLoading && } - -
- - {tooltip && ( - -
{tooltip}
-
- )} - - ); -} - -export default BarChart; diff --git a/src/components/metrics/EventsChart.tsx b/src/components/metrics/EventsChart.tsx index b1c581fc..87e65276 100644 --- a/src/components/metrics/EventsChart.tsx +++ b/src/components/metrics/EventsChart.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { Loading } from 'react-basics'; import { colord } from 'colord'; -import BarChart from './BarChart'; +import BarChart from 'components/charts/BarChart'; import { getDateArray } from 'lib/date'; import { useLocale, @@ -10,8 +10,8 @@ import { useNavigation, useWebsiteEvents, } from 'components/hooks'; -import { EVENT_COLORS } from 'lib/constants'; -import { renderDateLabels, renderStatusTooltipPopup } from 'lib/charts'; +import { CHART_COLORS } from 'lib/constants'; +import { renderDateLabels } from 'lib/charts'; export interface EventsChartProps { websiteId: string; @@ -26,7 +26,6 @@ export function EventsChart({ websiteId, className, token }: EventsChartProps) { const { query: { url, event }, } = useNavigation(); - const { data, isLoading } = useWebsiteEvents(websiteId, { startAt: +startDate, endAt: +endDate, @@ -38,9 +37,8 @@ export function EventsChart({ websiteId, className, token }: EventsChartProps) { offset, }); - const datasets = useMemo(() => { + const chartData = useMemo(() => { if (!data) return []; - if (isLoading) return data; const map = (data as any[]).reduce((obj, { x, t, y }) => { if (!obj[x]) { @@ -56,18 +54,20 @@ export function EventsChart({ websiteId, className, token }: EventsChartProps) { map[key] = getDateArray(map[key], startDate, endDate, unit); }); - return Object.keys(map).map((key, index) => { - const color = colord(EVENT_COLORS[index % EVENT_COLORS.length]); - return { - label: key, - data: map[key], - lineTension: 0, - backgroundColor: color.alpha(0.6).toRgbString(), - borderColor: color.alpha(0.7).toRgbString(), - borderWidth: 1, - }; - }); - }, [data, isLoading, startDate, endDate, unit]); + return { + datasets: Object.keys(map).map((key, index) => { + const color = colord(CHART_COLORS[index % CHART_COLORS.length]); + return { + label: key, + data: map[key], + lineTension: 0, + backgroundColor: color.alpha(0.6).toRgbString(), + borderColor: color.alpha(0.7).toRgbString(), + borderWidth: 1, + }; + }), + }; + }, [data, startDate, endDate, unit]); if (isLoading) { return ; @@ -76,11 +76,10 @@ export function EventsChart({ websiteId, className, token }: EventsChartProps) { return ( ); diff --git a/src/components/metrics/Legend.tsx b/src/components/metrics/Legend.tsx index 6349b3d4..5fbee827 100644 --- a/src/components/metrics/Legend.tsx +++ b/src/components/metrics/Legend.tsx @@ -1,43 +1,34 @@ -import { useEffect } from 'react'; import { StatusLight } from 'react-basics'; import { colord } from 'colord'; import classNames from 'classnames'; +import { LegendItem } from 'chart.js/auto'; import { useLocale } from 'components/hooks'; -import { useForceUpdate } from 'components/hooks'; import styles from './Legend.module.css'; -export function Legend({ chart }) { +export function Legend({ + items = [], + onClick, +}: { + items: any[]; + onClick: (index: LegendItem) => void; +}) { const { locale } = useLocale(); - const forceUpdate = useForceUpdate(); - const handleClick = (index: string | number) => { - const meta = chart.getDatasetMeta(index); - - meta.hidden = meta.hidden === null ? !chart.data.datasets[index].hidden : null; - - chart.update(); - - forceUpdate(); - }; - - useEffect(() => { - forceUpdate(); - }, [locale, forceUpdate]); - - if (!chart?.legend?.legendItems.find(({ text }) => text)) { + if (!items.find(({ text }) => text)) { return null; } return (
- {chart.legend.legendItems.map(({ text, fillStyle, datasetIndex, hidden }) => { + {items.map(item => { + const { text, fillStyle, hidden } = item; const color = colord(fillStyle); return (