Merge branch 'feat/um-154-add-event-data-rewrite-queries' into stage

This commit is contained in:
Brian Cao 2023-01-12 21:05:15 -08:00
commit b63bf7b3c0
249 changed files with 6914 additions and 8185 deletions

View File

@ -36,6 +36,7 @@ DATABASE_URL=connection-url
```
The connection url is in the following format:
```
postgresql://username:mypassword@localhost:5432/mydb
@ -48,13 +49,7 @@ mysql://username:mypassword@localhost:3306/mydb
yarn build
```
### Create database tables
```bash
yarn update-db
```
This will also create a login account with username **admin** and password **umami**.
The build step will also create tables in your database if you ae installing for the first time. It will also create a login user with username **admin** and password **umami**.
### Start the application
@ -75,13 +70,15 @@ docker compose up
```
Alternatively, to pull just the Umami Docker image with PostgreSQL support:
```bash
docker pull docker.umami.is/umami-software/umami:postgresql-latest
docker pull docker.umami.dev/umami-software/umami:postgresql-latest
```
Or with MySQL support:
```bash
docker pull docker.umami.is/umami-software/umami:mysql-latest
docker pull docker.umami.dev/umami-software/umami:mysql-latest
```
## Getting updates

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M216.464 36.465l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887L209.393 451.494c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l211.051-211.05c4.686-4.686 4.686-12.284 0-16.971L233.434 36.465c-4.686-4.687-12.284-4.687-16.97 0z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="m216.464 36.465-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887L209.393 451.494c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l211.051-211.05c4.686-4.686 4.686-12.284 0-16.971L233.434 36.465c-4.686-4.687-12.284-4.687-16.97 0z"/></svg>

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 408 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Pro 6.0.0-alpha2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M392 320C378.75 320 368 330.75 368 344V456C368 460.406 364.406 464 360 464H56C51.594 464 48 460.406 48 456V152C48 147.594 51.594 144 56 144H168C181.25 144 192 133.25 192 120S181.25 96 168 96H56C25.125 96 0 121.125 0 152V456C0 486.875 25.125 512 56 512H360C390.875 512 416 486.875 416 456V344C416 330.75 405.25 320 392 320ZM488 0H320C306.75 0 296 10.75 296 24S306.75 48 320 48H430.062L183.031 295.031C173.656 304.406 173.656 319.594 183.031 328.969C187.719 333.656 193.844 336 200 336S212.281 333.656 216.969 328.969L464 81.938V192C464 205.25 474.75 216 488 216S512 205.25 512 192V24C512 10.75 501.25 0 488 0Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M392 320c-13.25 0-24 10.75-24 24v112c0 4.406-3.594 8-8 8H56c-4.406 0-8-3.594-8-8V152c0-4.406 3.594-8 8-8h112c13.25 0 24-10.75 24-24s-10.75-24-24-24H56c-30.875 0-56 25.125-56 56v304c0 30.875 25.125 56 56 56h304c30.875 0 56-25.125 56-56V344c0-13.25-10.75-24-24-24ZM488 0H320c-13.25 0-24 10.75-24 24s10.75 24 24 24h110.062L183.031 295.031c-9.375 9.375-9.375 24.563 0 33.938A23.9 23.9 0 0 0 200 336a23.9 23.9 0 0 0 16.969-7.031L464 81.938V192c0 13.25 10.75 24 24 24s24-10.75 24-24V24c0-13.25-10.75-24-24-24Z"/></svg>

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 583 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Pro 6.0.0-alpha2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M424 392H24C10.8 392 0 402.8 0 416V416C0 429.2 10.8 440 24 440H424C437.2 440 448 429.2 448 416V416C448 402.8 437.2 392 424 392ZM424 72H24C10.8 72 0 82.8 0 96V96C0 109.2 10.8 120 24 120H424C437.2 120 448 109.2 448 96V96C448 82.8 437.2 72 424 72ZM424 232H24C10.8 232 0 242.8 0 256V256C0 269.2 10.8 280 24 280H424C437.2 280 448 269.2 448 256V256C448 242.8 437.2 232 424 232Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M424 392H24c-13.2 0-24 10.8-24 24s10.8 24 24 24h400c13.2 0 24-10.8 24-24s-10.8-24-24-24Zm0-320H24C10.8 72 0 82.8 0 96s10.8 24 24 24h400c13.2 0 24-10.8 24-24s-10.8-24-24-24Zm0 160H24c-13.2 0-24 10.8-24 24s10.8 24 24 24h400c13.2 0 24-10.8 24-24s-10.8-24-24-24Z"/></svg>

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 338 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Pro 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z"/></svg>

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 748 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M435.848 83.466 172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"/></svg>

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M441.9 167.3l-19.8-19.8c-4.7-4.7-12.3-4.7-17 0L224 328.2 42.9 147.5c-4.7-4.7-12.3-4.7-17 0L6.1 167.3c-4.7 4.7-4.7 12.3 0 17l209.4 209.4c4.7 4.7 12.3 4.7 17 0l209.4-209.4c4.7-4.7 4.7-12.3 0-17z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="m441.9 167.3-19.8-19.8c-4.7-4.7-12.3-4.7-17 0L224 328.2 42.9 147.5c-4.7-4.7-12.3-4.7-17 0L6.1 167.3c-4.7 4.7-4.7 12.3 0 17l209.4 209.4c4.7 4.7 12.3 4.7 17 0l209.4-209.4c4.7-4.7 4.7-12.3 0-17z"/></svg>

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 271 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M234.8 511.7L196 500.4c-4.2-1.2-6.7-5.7-5.5-9.9L331.3 5.8c1.2-4.2 5.7-6.7 9.9-5.5L380 11.6c4.2 1.2 6.7 5.7 5.5 9.9L244.7 506.2c-1.2 4.3-5.6 6.7-9.9 5.5zm-83.2-121.1l27.2-29c3.1-3.3 2.8-8.5-.5-11.5L72.2 256l106.1-94.1c3.4-3 3.6-8.2.5-11.5l-27.2-29c-3-3.2-8.1-3.4-11.3-.4L2.5 250.2c-3.4 3.2-3.4 8.5 0 11.7L140.3 391c3.2 3 8.2 2.8 11.3-.4zm284.1.4l137.7-129.1c3.4-3.2 3.4-8.5 0-11.7L435.7 121c-3.2-3-8.3-2.9-11.3.4l-27.2 29c-3.1 3.3-2.8 8.5.5 11.5L503.8 256l-106.1 94.1c-3.4 3-3.6 8.2-.5 11.5l27.2 29c3.1 3.2 8.1 3.4 11.3.4z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M234.8 511.7 196 500.4c-4.2-1.2-6.7-5.7-5.5-9.9L331.3 5.8c1.2-4.2 5.7-6.7 9.9-5.5L380 11.6c4.2 1.2 6.7 5.7 5.5 9.9L244.7 506.2c-1.2 4.3-5.6 6.7-9.9 5.5zm-83.2-121.1 27.2-29c3.1-3.3 2.8-8.5-.5-11.5L72.2 256l106.1-94.1c3.4-3 3.6-8.2.5-11.5l-27.2-29c-3-3.2-8.1-3.4-11.3-.4L2.5 250.2c-3.4 3.2-3.4 8.5 0 11.7L140.3 391c3.2 3 8.2 2.8 11.3-.4zm284.1.4 137.7-129.1c3.4-3.2 3.4-8.5 0-11.7L435.7 121c-3.2-3-8.3-2.9-11.3.4l-27.2 29c-3.1 3.3-2.8 8.5.5 11.5L503.8 256l-106.1 94.1c-3.4 3-3.6 8.2-.5 11.5l27.2 29c3.1 3.2 8.1 3.4 11.3.4z"/></svg>

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 601 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M497.6,0,334.4.17A14.4,14.4,0,0,0,320,14.57V47.88a14.4,14.4,0,0,0,14.69,14.4l73.63-2.72,2.06,2.06L131.52,340.49a12,12,0,0,0,0,17l23,23a12,12,0,0,0,17,0L450.38,101.62l2.06,2.06-2.72,73.63A14.4,14.4,0,0,0,464.12,192h33.31a14.4,14.4,0,0,0,14.4-14.4L512,14.4A14.4,14.4,0,0,0,497.6,0ZM432,288H416a16,16,0,0,0-16,16V458a6,6,0,0,1-6,6H54a6,6,0,0,1-6-6V118a6,6,0,0,1,6-6H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V304A16,16,0,0,0,432,288Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M497.6 0 334.4.17a14.4 14.4 0 0 0-14.4 14.4v33.31a14.4 14.4 0 0 0 14.69 14.4l73.63-2.72 2.06 2.06-278.86 278.87a12 12 0 0 0 0 17l23 23a12 12 0 0 0 17 0l278.86-278.87 2.06 2.06-2.72 73.63a14.4 14.4 0 0 0 14.4 14.69h33.31a14.4 14.4 0 0 0 14.4-14.4L512 14.4A14.4 14.4 0 0 0 497.6 0ZM432 288h-16a16 16 0 0 0-16 16v154a6 6 0 0 1-6 6H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h154a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16H48a48 48 0 0 0-48 48v352a48 48 0 0 0 48 48h352a48 48 0 0 0 48-48V304a16 16 0 0 0-16-16Z"/></svg>

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 573 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Pro 6.0.0-alpha2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M504.265 315.978C504.265 307.326 499.658 299.134 491.906 294.586L458.998 275.615C459.643 269.099 459.966 262.549 459.966 256S459.643 242.901 458.998 236.385L491.906 217.414C499.658 212.866 504.265 204.674 504.265 196.022C504.265 174.755 454.947 67.846 419.746 67.846C415.502 67.846 411.236 68.939 407.379 71.203L374.599 90.172C363.888 82.43 352.533 75.848 340.531 70.428V32.488C340.531 21.262 333.047 11.453 322.205 8.613C300.654 2.871 278.425 0 256.181 0C233.935 0 211.675 2.871 190.06 8.613C179.218 11.453 171.734 21.262 171.734 32.488V70.428C159.732 75.848 148.377 82.43 137.666 90.172L104.886 71.203C101.031 68.939 96.763 67.846 92.519 67.846C92.517 67.846 92.514 67.846 92.512 67.846C60.048 67.846 8 169.591 8 196.022C8 204.674 12.607 212.866 20.359 217.414L53.267 236.385C52.622 242.901 52.299 249.451 52.299 256S52.622 269.099 53.267 275.615L20.359 294.586C12.607 299.134 8 307.326 8 315.978C8 337.245 57.318 444.154 92.519 444.154C96.763 444.154 101.029 443.061 104.886 440.797L137.666 421.828C148.377 429.57 159.732 436.152 171.734 441.572V479.512C171.734 490.738 179.218 500.547 190.06 503.387C211.611 509.129 233.84 512 256.084 512C278.33 512 300.59 509.129 322.205 503.387C333.047 500.547 340.531 490.738 340.531 479.512V441.572C352.533 436.152 363.888 429.57 374.599 421.828L407.379 440.797C411.234 443.061 415.502 444.154 419.746 444.154C452.209 444.154 504.265 342.423 504.265 315.978ZM415.361 389.959C391.561 376.186 404.101 383.444 371.705 364.695C329.649 395.09 339.375 389.426 292.531 410.582V460.82C279.236 463.161 266.948 464 256.093 464C240.669 464 228.14 462.306 219.734 460.824V410.582C172.779 389.376 182.552 395.044 140.56 364.695C108.748 383.105 117.896 377.811 96.924 389.949C81.181 371.256 68.849 349.895 60.517 326.84C81.643 314.663 72.361 320.014 104.088 301.723C101.549 276.083 100.277 266.079 100.277 256.04C100.277 246.018 101.545 235.96 104.088 210.277C72.198 191.892 81.571 197.295 60.504 185.152C68.818 162.109 81.187 140.686 96.904 122.041C120.704 135.814 108.164 128.556 140.56 147.305C182.616 116.91 172.89 122.574 219.734 101.418V51.18C233.029 48.839 245.318 48 256.172 48C271.597 48 284.126 49.694 292.531 51.176V101.418C339.486 122.624 329.713 116.956 371.705 147.305C405.655 127.657 394.228 134.27 415.343 122.051C431.084 140.744 443.416 162.105 451.748 185.16C430.622 197.337 439.904 191.986 408.177 210.277C410.716 235.917 411.988 245.921 411.988 255.96C411.988 265.982 410.72 276.04 408.177 301.723C440.067 320.108 430.694 314.705 451.761 326.848C443.447 349.891 431.078 371.314 415.361 389.959ZM256.133 160C203.258 160 160.133 203.125 160.133 256S203.258 352 256.133 352S352.133 308.875 352.133 256S309.008 160 256.133 160ZM256.133 304C229.666 304 208.133 282.467 208.133 256S229.666 208 256.133 208S304.133 229.533 304.133 256S282.599 304 256.133 304Z "></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M504.265 315.978c0-8.652-4.607-16.844-12.359-21.392l-32.908-18.971a199.182 199.182 0 0 0 0-39.23l32.908-18.971c7.752-4.548 12.359-12.74 12.359-21.392 0-21.267-49.318-128.176-84.519-128.176-4.244 0-8.51 1.093-12.367 3.357l-32.78 18.969a195.058 195.058 0 0 0-34.068-19.744v-37.94c0-11.226-7.484-21.035-18.326-23.875C300.654 2.871 278.425 0 256.181 0a257.698 257.698 0 0 0-66.121 8.613c-10.842 2.84-18.326 12.649-18.326 23.875v37.94a195.058 195.058 0 0 0-34.068 19.744l-32.78-18.969a24.36 24.36 0 0 0-12.367-3.357h-.007C60.048 67.846 8 169.591 8 196.022c0 8.652 4.607 16.844 12.359 21.392l32.908 18.971a199.182 199.182 0 0 0 0 39.23l-32.908 18.971C12.607 299.134 8 307.326 8 315.978c0 21.267 49.318 128.176 84.519 128.176 4.244 0 8.51-1.093 12.367-3.357l32.78-18.969a195.058 195.058 0 0 0 34.068 19.744v37.94c0 11.226 7.484 21.035 18.326 23.875 21.551 5.742 43.78 8.613 66.024 8.613 22.246 0 44.506-2.871 66.121-8.613 10.842-2.84 18.326-12.649 18.326-23.875v-37.94a195.058 195.058 0 0 0 34.068-19.744l32.78 18.969a24.36 24.36 0 0 0 12.367 3.357c32.463 0 84.519-101.731 84.519-128.176Zm-88.904 73.981c-23.8-13.773-11.26-6.515-43.656-25.264-42.056 30.395-32.33 24.731-79.174 45.887v50.238a210.138 210.138 0 0 1-36.438 3.18 208.924 208.924 0 0 1-36.359-3.176v-50.242c-46.955-21.206-37.182-15.538-79.174-45.887l-43.636 25.254a207.379 207.379 0 0 1-36.407-63.109c21.126-12.177 11.844-6.826 43.571-25.117-2.539-25.64-3.811-35.644-3.811-45.683 0-10.022 1.268-20.08 3.811-45.763-31.89-18.385-22.517-12.982-43.584-25.125a207.107 207.107 0 0 1 36.4-63.111c23.8 13.773 11.26 6.515 43.656 25.264 42.056-30.395 32.33-24.731 79.174-45.887V51.18A210.146 210.146 0 0 1 256.172 48c15.425 0 27.954 1.694 36.359 3.176v50.242c46.955 21.206 37.182 15.538 79.174 45.887l43.638-25.254a207.414 207.414 0 0 1 36.405 63.109c-21.126 12.177-11.844 6.826-43.571 25.117 2.539 25.64 3.811 35.644 3.811 45.683 0 10.022-1.268 20.08-3.811 45.763 31.89 18.385 22.517 12.982 43.584 25.125a207.107 207.107 0 0 1-36.4 63.111ZM256.133 160c-52.875 0-96 43.125-96 96s43.125 96 96 96 96-43.125 96-96-43.125-96-96-96Zm0 144c-26.467 0-48-21.533-48-48s21.533-48 48-48 48 21.533 48 48-21.534 48-48 48Z"/></svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,2 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 428 389.11" width="20" height="20">
<circle cx="214.15" cy="181" r="171" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="20"/><path d="M413,134.11H15.29a15,15,0,0,0-15,15v15.3C.12,168,0,171.52,0,175.11c0,118.19,95.81,214,214,214,116.4,0,211.1-92.94,213.93-208.67,0-.44.07-.88.07-1.33v-30A15,15,0,0,0,413,134.11Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 428 389.11" width="20" height="20"><circle cx="214.15" cy="181" r="171" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="20"/><path d="M413 134.11H15.29a15 15 0 0 0-15 15v15.3C.12 168 0 171.52 0 175.11c0 118.19 95.81 214 214 214 116.4 0 211.1-92.94 213.93-208.67 0-.44.07-.88.07-1.33v-30a15 15 0 0 0-15-15Z"/></svg>

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 390 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1399.98 1400"><path d="M562.44,837.55C335.89,611,288.08,273.54,418.71,0A734.31,734.31,0,0,0,215.54,143.73c-287.39,287.39-287.39,753.33,0,1040.72s753.33,287.4,1040.74,0A733.8,733.8,0,0,0,1400,981.29C1126.45,1111.92,789,1064.09,562.44,837.55Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1399.98 1400"><path d="M562.44 837.55C335.89 611 288.08 273.54 418.71 0a734.31 734.31 0 0 0-203.17 143.73c-287.39 287.39-287.39 753.33 0 1040.72s753.33 287.4 1040.74 0A733.8 733.8 0 0 0 1400 981.29c-273.55 130.63-611 82.8-837.56-143.74Z"/></svg>

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 298 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M493.26 56.26l-37.51-37.51C443.25 6.25 426.87 0 410.49 0s-32.76 6.25-45.25 18.74l-74.49 74.49L256 127.98 12.85 371.12.15 485.34C-1.45 499.72 9.88 512 23.95 512c.89 0 1.79-.05 2.69-.15l114.14-12.61L384.02 256l34.74-34.74 74.49-74.49c25-25 25-65.52.01-90.51zM118.75 453.39l-67.58 7.46 7.53-67.69 231.24-231.24 31.02-31.02 60.14 60.14-31.02 31.02-231.33 231.33zm340.56-340.57l-44.28 44.28-60.13-60.14 44.28-44.28c4.08-4.08 8.84-4.69 11.31-4.69s7.24.61 11.31 4.69l37.51 37.51c6.24 6.25 6.24 16.4 0 22.63z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m493.26 56.26-37.51-37.51C443.25 6.25 426.87 0 410.49 0s-32.76 6.25-45.25 18.74l-74.49 74.49L256 127.98 12.85 371.12.15 485.34C-1.45 499.72 9.88 512 23.95 512c.89 0 1.79-.05 2.69-.15l114.14-12.61L384.02 256l34.74-34.74 74.49-74.49c25-25 25-65.52.01-90.51zM118.75 453.39l-67.58 7.46 7.53-67.69 231.24-231.24 31.02-31.02 60.14 60.14-31.02 31.02-231.33 231.33zm340.56-340.57-44.28 44.28-60.13-60.14 44.28-44.28c4.08-4.08 8.84-4.69 11.31-4.69s7.24.61 11.31 4.69l37.51 37.51c6.24 6.25 6.24 16.4 0 22.63z"/></svg>

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 578 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 1400"><path d="M367.43,422.13a54.44,54.44,0,0,1-38.66-16L205,282.35A54.69,54.69,0,0,1,282.37,205L406.11,328.79a54.68,54.68,0,0,1-38.68,93.34Z"/><path d="M1156.3,1211a54.51,54.51,0,0,1-38.67-16L993.89,1071.21a54.68,54.68,0,1,1,77.34-77.33L1195,1117.65A54.7,54.7,0,0,1,1156.3,1211Z"/><path d="M243.7,1211A54.7,54.7,0,0,1,205,1117.65L328.74,993.89a54.69,54.69,0,0,1,77.36,77.32L282.37,1195A54.51,54.51,0,0,1,243.7,1211Z"/><path d="M1032.57,422.13a54.68,54.68,0,0,1-38.68-93.34L1117.61,205A54.69,54.69,0,0,1,1195,282.35L1071.23,406.11A54.44,54.44,0,0,1,1032.57,422.13Z"/><path d="M229.69,754.69h-175a54.69,54.69,0,0,1,0-109.38h175a54.69,54.69,0,0,1,0,109.38Z"/><path d="M1345.31,754.69h-175a54.69,54.69,0,0,1,0-109.38h175a54.69,54.69,0,0,1,0,109.38Z"/><path d="M700,1400a54.68,54.68,0,0,1-54.69-54.69v-175a54.69,54.69,0,0,1,109.38,0v175A54.68,54.68,0,0,1,700,1400Z"/><path d="M700,284.38a54.7,54.7,0,0,1-54.69-54.69v-175a54.69,54.69,0,0,1,109.38,0v175A54.7,54.7,0,0,1,700,284.38Z"/><circle cx="700" cy="700" r="306.25"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 1400"><path d="M367.43 422.13a54.44 54.44 0 0 1-38.66-16L205 282.35A54.69 54.69 0 0 1 282.37 205l123.74 123.79a54.68 54.68 0 0 1-38.68 93.34ZM1156.3 1211a54.51 54.51 0 0 1-38.67-16l-123.74-123.79a54.68 54.68 0 1 1 77.34-77.33L1195 1117.65a54.7 54.7 0 0 1-38.7 93.35ZM243.7 1211a54.7 54.7 0 0 1-38.7-93.35l123.74-123.76a54.69 54.69 0 0 1 77.36 77.32L282.37 1195a54.51 54.51 0 0 1-38.67 16ZM1032.57 422.13a54.68 54.68 0 0 1-38.68-93.34L1117.61 205a54.69 54.69 0 0 1 77.39 77.35l-123.77 123.76a54.44 54.44 0 0 1-38.66 16.02ZM229.69 754.69h-175a54.69 54.69 0 0 1 0-109.38h175a54.69 54.69 0 0 1 0 109.38ZM1345.31 754.69h-175a54.69 54.69 0 0 1 0-109.38h175a54.69 54.69 0 0 1 0 109.38ZM700 1400a54.68 54.68 0 0 1-54.69-54.69v-175a54.69 54.69 0 0 1 109.38 0v175A54.68 54.68 0 0 1 700 1400ZM700 284.38a54.7 54.7 0 0 1-54.69-54.69v-175a54.69 54.69 0 0 1 109.38 0v175A54.7 54.7 0 0 1 700 284.38Z"/><circle cx="700" cy="700" r="306.25"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 989 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="m207.6 256 107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 468 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1652 1652"><title>Asset 1</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path d="M1587.07,504.47A828.56,828.56,0,1,0,1652,826,823.13,823.13,0,0,0,1587.07,504.47ZM826,1577a747.29,747.29,0,0,1-464.48-161.26,39.94,39.94,0,0,0,2.8-11.35,458.82,458.82,0,0,1,34.29-135.74,464.15,464.15,0,0,1,854.78,0,458.82,458.82,0,0,1,34.29,135.74,39.94,39.94,0,0,0,2.8,11.35A747.29,747.29,0,0,1,826,1577ZM719.81,866.57A274,274,0,1,1,826,888,272.1,272.1,0,0,1,719.81,866.57Zm641.28,485.87c-36.11-201.1-182.78-363.82-374.86-423,114.28-58.37,192.53-177.22,192.53-314.35,0-194.83-157.94-352.76-352.76-352.76S473.24,420.29,473.24,615.12c0,137.13,78.25,256,192.53,314.35-192.08,59.15-338.75,221.87-374.86,423C157.46,1216.81,75,1030.86,75,826,75,411.9,411.9,75,826,75s751,336.9,751,751C1577,1030.86,1494.54,1216.81,1361.09,1352.44Z"/></g></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1652 1652"><g data-name="Layer 2"><path d="M1587.07 504.47A828.56 828.56 0 1 0 1652 826a823.13 823.13 0 0 0-64.93-321.53ZM826 1577a747.29 747.29 0 0 1-464.48-161.26 39.94 39.94 0 0 0 2.8-11.35 458.82 458.82 0 0 1 34.29-135.74 464.15 464.15 0 0 1 854.78 0 458.82 458.82 0 0 1 34.29 135.74 39.94 39.94 0 0 0 2.8 11.35A747.29 747.29 0 0 1 826 1577ZM719.81 866.57A274 274 0 1 1 826 888a272.1 272.1 0 0 1-106.19-21.43Zm641.28 485.87c-36.11-201.1-182.78-363.82-374.86-423 114.28-58.37 192.53-177.22 192.53-314.35 0-194.83-157.94-352.76-352.76-352.76S473.24 420.29 473.24 615.12c0 137.13 78.25 256 192.53 314.35-192.08 59.15-338.75 221.87-374.86 423C157.46 1216.81 75 1030.86 75 826 75 411.9 411.9 75 826 75s751 336.9 751 751c0 204.86-82.46 390.81-215.91 526.44Z" data-name="Layer 1"/></g></svg>

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 841 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Pro 6.0.0-alpha2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M312.973 375.032C322.342 384.401 322.342 399.604 312.973 408.973S288.401 418.342 279.032 408.973L160 289.941L40.968 408.973C31.599 418.342 16.396 418.342 7.027 408.973S-2.342 384.401 7.027 375.032L126.059 256L7.027 136.968C-2.342 127.599 -2.342 112.396 7.027 103.027S31.599 93.658 40.968 103.027L160 222.059L279.032 103.027C288.401 93.658 303.604 93.658 312.973 103.027S322.342 127.599 312.973 136.968L193.941 256L312.973 375.032Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M312.973 375.032c9.369 9.369 9.369 24.572 0 33.941s-24.572 9.369-33.941 0L160 289.941 40.968 408.973c-9.369 9.369-24.572 9.369-33.941 0s-9.369-24.572 0-33.941L126.059 256 7.027 136.968c-9.369-9.369-9.369-24.572 0-33.941s24.572-9.369 33.941 0L160 222.059l119.032-119.032c9.369-9.369 24.572-9.369 33.941 0s9.369 24.572 0 33.941L193.941 256l119.032 119.032Z"/></svg>

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 434 B

View File

@ -2,9 +2,9 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-normal);
color: var(--gray900);
background: var(--gray100);
font-size: var(--font-size-md);
color: var(--base900);
background: var(--base100);
padding: 8px 16px;
border-radius: 4px;
border: 0;
@ -14,11 +14,11 @@
}
.button:hover {
background: var(--gray200);
background: var(--base200);
}
.button:active {
color: var(--gray900);
color: var(--base900);
}
.label {
@ -29,30 +29,30 @@
}
.large {
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
}
.small {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.xsmall {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
}
.action,
.action:active {
color: var(--gray50);
background: var(--gray900);
color: var(--base50);
background: var(--base900);
}
.action:hover {
background: var(--gray800);
background: var(--base800);
}
.danger,
.danger:active {
color: var(--gray50);
color: var(--base50);
background: var(--red500);
}
@ -62,7 +62,7 @@
.light,
.light:active {
color: var(--gray900);
color: var(--base900);
background: transparent;
}
@ -85,18 +85,18 @@
.button:disabled {
cursor: default;
color: var(--gray500);
background: var(--gray75);
color: var(--base500);
background: var(--base75);
}
.button:disabled:active {
color: var(--gray500);
color: var(--base500);
}
.button:disabled:hover {
background: var(--gray75);
background: var(--base75);
}
.button.light:disabled {
background: var(--gray50);
background: var(--base50);
}

View File

@ -2,14 +2,14 @@
display: inline-flex;
border-radius: 4px;
overflow: hidden;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
}
.group .button {
border-radius: 0;
color: var(--gray800);
background: var(--gray50);
border-left: 1px solid var(--gray500);
color: var(--base800);
background: var(--base50);
border-left: 1px solid var(--base500);
padding: 4px 8px;
}
@ -18,7 +18,7 @@
}
.group .button:hover {
background: var(--gray100);
background: var(--base100);
}
.group .button + .button {
@ -26,6 +26,6 @@
}
.group .button.selected {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -1,7 +1,7 @@
.calendar {
display: flex;
flex-direction: column;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
flex: 1;
min-height: 306px;
}
@ -12,7 +12,7 @@
}
.calendar td {
color: var(--gray800);
color: var(--base800);
cursor: pointer;
text-align: center;
vertical-align: center;
@ -23,17 +23,17 @@
}
.calendar td:hover {
border: 1px solid var(--gray300);
background: var(--gray75);
border: 1px solid var(--base300);
background: var(--base75);
}
.calendar td.faded {
color: var(--gray500);
color: var(--base500);
}
.calendar td.selected {
font-weight: 600;
border: 1px solid var(--gray600);
border: 1px solid var(--base600);
}
.calendar td.selected:hover {
@ -41,18 +41,18 @@
}
.calendar td.disabled {
color: var(--gray400);
background: var(--gray75);
color: var(--base400);
background: var(--base75);
}
.calendar td.disabled:hover {
cursor: default;
background: var(--gray75);
background: var(--base75);
border-color: transparent;
}
.calendar td.faded.disabled {
background: var(--gray100);
background: var(--base100);
}
.header {
@ -61,7 +61,7 @@
align-items: center;
font-weight: 700;
line-height: 40px;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.body {

View File

@ -11,7 +11,7 @@
align-items: center;
width: 20px;
height: 20px;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
border-radius: 4px;
}

View File

@ -1,5 +1,5 @@
.wrapper {
background: var(--gray50);
background: var(--base50);
margin-right: 10px;
border-radius: 100%;
}

View File

@ -3,7 +3,7 @@
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
border-radius: 4px;
cursor: pointer;
}
@ -12,7 +12,7 @@
flex: 1;
display: flex;
justify-content: space-between;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
flex-wrap: nowrap;
white-space: nowrap;
padding: 4px 16px;

View File

@ -6,7 +6,7 @@
margin: auto;
display: flex;
z-index: 1;
background-color: var(--gray50);
background-color: var(--base50);
padding: 10px;
}

View File

@ -0,0 +1,48 @@
import List from 'assets/list-ul.svg';
import Modal from 'components/common/Modal';
import PropTypes from 'prop-types';
import { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import Button from './Button';
import EventDataForm from 'components/forms/EventDataForm';
import styles from './EventDataButton.module.css';
function EventDataButton({ websiteId }) {
const [showEventData, setShowEventData] = useState(false);
function handleClick() {
if (!showEventData) {
setShowEventData(true);
}
}
function handleClose() {
setShowEventData(false);
}
return (
<>
<Button
icon={<List />}
tooltip={<FormattedMessage id="label.event-data" defaultMessage="Event" />}
tooltipId="button-event"
size="small"
onClick={handleClick}
className={styles.button}
>
Event Data
</Button>
{showEventData && (
<Modal title={<FormattedMessage id="label.event-data" defaultMessage="Query Event Data" />}>
<EventDataForm websiteId={websiteId} onClose={handleClose} />
</Modal>
)}
</>
);
}
EventDataButton.propTypes = {
websiteId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
export default EventDataButton;

View File

@ -0,0 +1,3 @@
.button {
width: fit-content;
}

View File

@ -4,11 +4,11 @@
}
.row .inactive {
color: var(--gray500);
color: var(--base500);
}
.row .active {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -2,7 +2,7 @@ a.link,
a.link:active,
a.link:visited {
position: relative;
color: var(--gray900);
color: var(--base900);
text-decoration: none;
display: inline-flex;
align-items: center;
@ -17,15 +17,15 @@ a.link:hover span {
}
a.link.large {
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
}
a.link.small {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
a.link.xsmall {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
}
a.link .icon + * {

View File

@ -25,7 +25,7 @@
height: 100%;
width: 100%;
z-index: 10;
background: var(--gray400);
background: var(--base400);
opacity: 0.4;
}
@ -33,13 +33,13 @@
width: 10px;
height: 10px;
border-radius: 100%;
background: var(--gray400);
background: var(--base400);
animation: blink 1.4s infinite;
animation-fill-mode: both;
}
.loading.overlay div {
background: var(--gray900);
background: var(--base900);
}
.loading div + div {

View File

@ -1,22 +1,22 @@
.menu {
background: var(--gray50);
border: 1px solid var(--gray500);
background: var(--base50);
border: 1px solid var(--base500);
border-radius: 4px;
overflow: hidden;
z-index: 100;
}
.option {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: normal;
background: var(--gray50);
background: var(--base50);
padding: 4px 16px;
cursor: pointer;
white-space: nowrap;
}
.option:hover {
background: var(--gray100);
background: var(--base100);
}
.float {
@ -43,7 +43,7 @@
}
.divider {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
}
.selected {

View File

@ -10,11 +10,11 @@
}
.text {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.open,
.open:hover {
background: var(--gray50);
border: 1px solid var(--gray500);
background: var(--base50);
border: 1px solid var(--base500);
}

View File

@ -8,7 +8,7 @@
z-index: 100;
display: flex;
flex-direction: column;
background-color: var(--gray50);
background-color: var(--base50);
overflow: auto;
}
@ -21,7 +21,7 @@
}
.item {
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
}
.item + .item {

View File

@ -5,7 +5,7 @@
right: 0;
bottom: 0;
margin: auto;
z-index: 2;
z-index: 3;
}
.modal:before {
@ -25,12 +25,12 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--gray50);
background: var(--base50);
min-width: 400px;
min-height: 100px;
max-width: 100vw;
z-index: 1;
border: 1px solid var(--gray300);
border: 1px solid var(--base300);
padding: 30px;
border-radius: 4px;
}

View File

@ -1,6 +1,6 @@
.menu {
color: var(--gray800);
border: 1px solid var(--gray500);
color: var(--base800);
border: 1px solid var(--base500);
border-radius: 4px;
overflow: hidden;
z-index: 2;
@ -13,10 +13,10 @@
}
.option:hover {
background: var(--gray75);
background: var(--base75);
}
.selected {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -1,6 +1,6 @@
.container {
color: var(--gray500);
font-size: var(--font-size-normal);
color: var(--base500);
font-size: var(--font-size-md);
position: relative;
display: flex;
align-items: center;

View File

@ -5,16 +5,16 @@
.table label {
display: none;
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
font-weight: bold;
}
.header {
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
}
.head {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
line-height: 40px;
}
@ -26,7 +26,7 @@
}
.row {
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
padding: 10px 0;
}

View File

@ -1,6 +1,6 @@
.tag {
padding: 2px 4px;
border: 1px solid var(--gray300);
border: 1px solid var(--base300);
border-radius: 4px;
margin-right: 10px;
}

View File

@ -17,7 +17,7 @@
}
.message {
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.close {

View File

@ -6,7 +6,7 @@
}
.message {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
flex: 1;
text-align: center;

2
components/declarations.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare module '*.css';
declare module '*.svg';

View File

@ -9,7 +9,7 @@ import FormLayout, {
FormRow,
} from 'components/layout/FormLayout';
import useApi from 'hooks/useApi';
import useUser from '../../hooks/useUser';
import useUser from 'hooks/useUser';
const initialValues = {
current_password: '',
@ -43,13 +43,13 @@ export default function ChangePasswordForm({ values, onSave, onClose }) {
const { user } = useUser();
const handleSubmit = async values => {
const { ok, data } = await post(`/accounts/${user.user_id}/password`, values);
const { ok, error } = await post(`/users/${user.id}/password`, values);
if (ok) {
onSave();
} else {
setMessage(
data || <FormattedMessage id="message.failure" defaultMessage="Something went wrong." />,
error || <FormattedMessage id="message.failure" defaultMessage="Something went wrong." />,
);
}
};

View File

@ -16,7 +16,7 @@
.calendars > div + div {
margin-left: 20px;
padding-left: 20px;
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
}
.filter {

View File

@ -0,0 +1,262 @@
import classNames from 'classnames';
import Button from 'components/common/Button';
import DateFilter from 'components/common/DateFilter';
import DropDown from 'components/common/DropDown';
import FormLayout, {
FormButtons,
FormError,
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
import DataTable from 'components/metrics/DataTable';
import FilterTags from 'components/metrics/FilterTags';
import { Field, Form, Formik } from 'formik';
import useApi from 'hooks/useApi';
import useDateRange from 'hooks/useDateRange';
import { useState, useEffect } from 'react';
import { FormattedMessage } from 'react-intl';
import styles from './EventDataForm.module.css';
import useTimezone from 'hooks/useTimezone';
export const filterOptions = [
{ label: 'Count', value: 'count' },
{ label: 'Average', value: 'avg' },
{ label: 'Minimum', value: 'min' },
{ label: 'Maximum', value: 'max' },
{ label: 'Sum', value: 'sum' },
];
export const dateOptions = [
{ label: <FormattedMessage id="label.today" defaultMessage="Today" />, value: '1day' },
{
label: (
<FormattedMessage id="label.last-hours" defaultMessage="Last {x} hours" values={{ x: 24 }} />
),
value: '24hour',
},
{
label: <FormattedMessage id="label.yesterday" defaultMessage="Yesterday" />,
value: '-1day',
},
{
label: <FormattedMessage id="label.this-week" defaultMessage="This week" />,
value: '1week',
divider: true,
},
{
label: (
<FormattedMessage id="label.last-days" defaultMessage="Last {x} days" values={{ x: 7 }} />
),
value: '7day',
},
{
label: <FormattedMessage id="label.this-month" defaultMessage="This month" />,
value: '1month',
divider: true,
},
{
label: (
<FormattedMessage id="label.last-days" defaultMessage="Last {x} days" values={{ x: 30 }} />
),
value: '30day',
},
{
label: (
<FormattedMessage id="label.last-days" defaultMessage="Last {x} days" values={{ x: 90 }} />
),
value: '90day',
},
{ label: <FormattedMessage id="label.this-year" defaultMessage="This year" />, value: '1year' },
{
label: <FormattedMessage id="label.custom-range" defaultMessage="Custom range" />,
value: 'custom',
divider: true,
},
];
export default function EventDataForm({ websiteId, onClose, className }) {
const { post } = useApi();
const [message, setMessage] = useState();
const [columns, setColumns] = useState({});
const [filters, setFilters] = useState({});
const [data, setData] = useState([]);
const [dateRange, setDateRange] = useDateRange('report');
const { startDate, endDate, value } = dateRange;
const [timezone] = useTimezone();
const [isValid, setIsValid] = useState(false);
useEffect(() => {
if (Object.keys(columns).length > 0) {
setIsValid(true);
} else {
setIsValid(false);
}
}, [columns]);
const handleAddTag = (value, list, setState, resetForm) => {
setState({ ...list, [`${value.field}`]: value.value });
resetForm();
};
const handleRemoveTag = (value, list, setState) => {
const newList = { ...list };
delete newList[`${value}`];
setState(newList);
};
const handleSubmit = async () => {
const params = {
website_id: websiteId,
start_at: +startDate,
end_at: +endDate,
timezone,
columns,
filters,
};
const { ok, data } = await post(`/websites/${websiteId}/eventdata`, params);
if (!ok) {
setMessage(<FormattedMessage id="message.failure" defaultMessage="Something went wrong." />);
setData([]);
} else {
setData(data);
setMessage(null);
}
};
return (
<>
<FormMessage>{message}</FormMessage>
<div className={classNames(styles.container, className)}>
<div className={styles.form}>
<FormLayout>
<div className={styles.filters}>
<FormRow>
<label htmlFor="date-range">
<FormattedMessage id="label.date-range" defaultMessage="Date Range" />
</label>
<DateFilter
value={value}
startDate={startDate}
endDate={endDate}
onChange={setDateRange}
options={dateOptions}
/>
</FormRow>
</div>
<div className={styles.filters}>
<Formik
initialValues={{ field: '', value: '' }}
onSubmit={(value, { resetForm }) =>
handleAddTag(value, columns, setColumns, resetForm)
}
>
{({ values, setFieldValue }) => (
<Form>
<FormRow>
<label htmlFor="field">
<FormattedMessage id="label.field-name" defaultMessage="Field Name" />
</label>
<div>
<Field name="field" type="text" />
<FormError name="field" />
</div>
</FormRow>
<FormRow>
<label htmlFor="value">
<FormattedMessage id="label.type" defaultMessage="Type" />
</label>
<div>
<DropDown
value={values.value}
onChange={value => setFieldValue('value', value)}
className={styles.dropdown}
name="value"
options={filterOptions}
/>
<FormError name="value" />
</div>
</FormRow>
<FormButtons className={styles.formButtons}>
<Button
variant="action"
type="submit"
disabled={!values.field || !values.value}
>
<FormattedMessage id="label.add-column" defaultMessage="Add Column" />
</Button>
</FormButtons>
</Form>
)}
</Formik>
<FilterTags
className={styles.filterTag}
params={columns}
onClick={value => handleRemoveTag(value, columns, setColumns)}
/>
</div>
<div className={styles.filters}>
<Formik
initialValues={{ field: '', value: '' }}
onSubmit={(value, { resetForm }) =>
handleAddTag(value, filters, setFilters, resetForm)
}
>
{({ values }) => (
<Form>
<FormRow>
<label htmlFor="field">
<FormattedMessage id="label.field-name" defaultMessage="Field Name" />
</label>
<div>
<Field name="field" type="text" />
<FormError name="field" />
</div>
</FormRow>
<FormRow>
<label htmlFor="value">
<FormattedMessage id="label.value" defaultMessage="Value" />
</label>
<div>
<Field name="value" type="text" />
<FormError name="value" />
</div>
</FormRow>
<FormButtons className={styles.formButtons}>
<Button
variant="action"
type="submit"
disabled={!values.field || !values.value}
>
<FormattedMessage id="label.add-filter" defaultMessage="Add Filter" />
</Button>
</FormButtons>
</Form>
)}
</Formik>
<FilterTags
className={styles.filterTag}
params={filters}
onClick={value => handleRemoveTag(value, filters, setFilters)}
/>
</div>
</FormLayout>
</div>
<div>
<DataTable className={styles.table} data={data} title="Results" showPercentage={false} />
</div>
</div>
<FormButtons>
<Button variant="action" onClick={handleSubmit} disabled={!isValid}>
<FormattedMessage id="label.search" defaultMessage="Search" />
</Button>
<Button onClick={onClose}>
<FormattedMessage id="label.cancel" defaultMessage="Cancel" />
</Button>
</FormButtons>
</>
);
}

View File

@ -0,0 +1,38 @@
.container {
display: flex;
}
.form {
border-right: 1px solid var(--base300);
width: 420px;
}
.filters {
padding: 10px 5px;
}
.filters + .filters {
border-top: 1px solid var(--base300);
min-height: 250px;
}
.table {
padding: 10px;
min-height: 430px;
min-width: 400px;
}
.formButtons {
justify-content: flex-start;
margin-left: 20px;
}
.dropdown {
min-height: 39px;
min-width: 240px;
}
.filterTag {
flex-wrap: wrap;
margin: 10px 5px 5px 5px;
}

View File

@ -0,0 +1,63 @@
.form {
display: flex;
flex-direction: column;
gap: 30px;
width: 300px;
margin: 0 auto;
}
.header {
font-size: 24px;
font-weight: 700;
text-align: center;
margin: 30px auto;
}
.info {
text-align: center;
padding: 30px 0;
}
.footer {
display: flex;
flex-direction: column;
gap: 20px;
font-size: 14px;
text-align: center;
margin: 30px auto;
}
.footer a {
font-weight: 600;
}
.buttons {
justify-content: center;
}
.button {
flex: 1;
justify-content: center;
}
.error {
width: 600px;
margin: 0 auto 30px;
background: var(--base50);
padding: 16px;
color: var(--red400);
border: 1px solid var(--red400);
border-radius: 5px;
text-align: center;
}
.success {
width: 600px;
margin: 60px auto;
background: var(--base50);
padding: 16px;
color: var(--green400);
border: 1px solid var(--green400);
border-radius: 5px;
text-align: center;
}

View File

@ -1,111 +1,57 @@
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { Formik, Form, Field } from 'formik';
import { setItem } from 'next-basics';
import { useRouter } from 'next/router';
import Button from 'components/common/Button';
import FormLayout, {
import { useMutation } from '@tanstack/react-query';
import {
Form,
FormInput,
FormButtons,
FormError,
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
import Icon from 'components/common/Icon';
import useApi from 'hooks/useApi';
import { AUTH_TOKEN } from 'lib/constants';
TextField,
PasswordField,
SubmitButton,
Icon,
} from 'react-basics';
import { useRouter } from 'next/router';
import { useApi } from 'next-basics';
import { setUser } from 'store/app';
import { setAuthToken } from 'lib/client';
import Logo from 'assets/logo.svg';
import styles from './LoginForm.module.css';
const validate = ({ username, password }) => {
const errors = {};
if (!username) {
errors.username = <FormattedMessage id="label.required" defaultMessage="Required" />;
}
if (!password) {
errors.password = <FormattedMessage id="label.required" defaultMessage="Required" />;
}
return errors;
};
import styles from './Form.module.css';
export default function LoginForm() {
const { post } = useApi();
const router = useRouter();
const [message, setMessage] = useState();
const { post } = useApi();
const { mutate, error, isLoading } = useMutation(data => post('/auth/login', data));
const handleSubmit = async ({ username, password }) => {
const { ok, status, data } = await post('/auth/login', {
username,
password,
const handleSubmit = async data => {
mutate(data, {
onSuccess: async ({ token, user }) => {
setAuthToken(token);
setUser(user);
await router.push('/websites');
},
});
if (ok) {
setItem(AUTH_TOKEN, data.token);
setUser(data.user);
await router.push('/');
return null;
} else {
setMessage(
status === 401 ? (
<FormattedMessage
id="message.incorrect-username-password"
defaultMessage="Incorrect username/password."
/>
) : (
data
),
);
}
};
return (
<FormLayout className={styles.login}>
<Formik
initialValues={{
username: '',
password: '',
}}
validate={validate}
onSubmit={handleSubmit}
>
{() => (
<Form>
<div className={styles.header}>
<Icon icon={<Logo />} size="xlarge" className={styles.icon} />
<h1 className="center">umami</h1>
</div>
<FormRow>
<label htmlFor="username">
<FormattedMessage id="label.username" defaultMessage="Username" />
</label>
<div>
<Field name="username" type="text" />
<FormError name="username" />
</div>
</FormRow>
<FormRow>
<label htmlFor="password">
<FormattedMessage id="label.password" defaultMessage="Password" />
</label>
<div>
<Field name="password" type="password" />
<FormError name="password" />
</div>
</FormRow>
<FormButtons>
<Button type="submit" variant="action">
<FormattedMessage id="label.login" defaultMessage="Login" />
</Button>
</FormButtons>
<FormMessage>{message}</FormMessage>
</Form>
)}
</Formik>
</FormLayout>
<>
<div className={styles.header}>
<Icon size="xl">
<Logo />
</Icon>
<p>umami</p>
</div>
<Form className={styles.form} onSubmit={handleSubmit} error={error}>
<FormInput name="username" label="Username" rules={{ required: 'Required' }}>
<TextField autoComplete="off" />
</FormInput>
<FormInput name="password" label="Password" rules={{ required: 'Required' }}>
<PasswordField />
</FormInput>
<FormButtons>
<SubmitButton variant="primary" className={styles.button} disabled={isLoading}>
Log in
</SubmitButton>
</FormButtons>
</Form>
</>
);
}

View File

@ -8,7 +8,7 @@ import CopyButton from 'components/common/CopyButton';
export default function TrackingCodeForm({ values, onClose }) {
const ref = useRef();
const { basePath } = useRouter();
const { name, share_id } = values;
const { name, shareId } = values;
return (
<FormLayout>
@ -27,7 +27,7 @@ export default function TrackingCodeForm({ values, onClose }) {
spellCheck={false}
defaultValue={`${
document.location.origin
}${basePath}/share/${share_id}/${encodeURIComponent(name)}`}
}${basePath}/share/${shareId}/${encodeURIComponent(name)}`}
readOnly
/>
</FormRow>

View File

@ -26,7 +26,7 @@ export default function TrackingCodeForm({ values, onClose }) {
rows={3}
cols={60}
spellCheck={false}
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${
defaultValue={`<script async defer data-website-id="${values.id}" src="${
document.location.origin
}${basePath}/${trackerScriptName ? `${trackerScriptName}.js` : 'umami.js'}"></script>`}
readOnly

View File

@ -15,26 +15,26 @@ const initialValues = {
password: '',
};
const validate = ({ user_id, username, password }) => {
const validate = ({ id, username, password }) => {
const errors = {};
if (!username) {
errors.username = <FormattedMessage id="label.required" defaultMessage="Required" />;
}
if (!user_id && !password) {
if (!id && !password) {
errors.password = <FormattedMessage id="label.required" defaultMessage="Required" />;
}
return errors;
};
export default function AccountEditForm({ values, onSave, onClose }) {
export default function UserEditForm({ values, onSave, onClose }) {
const { post } = useApi();
const [message, setMessage] = useState();
const handleSubmit = async values => {
const { user_id } = values;
const { ok, data } = await post(user_id ? `/accounts/${user_id}` : '/accounts', values);
const { id } = values;
const { ok, data } = await post(id ? `/users/${id}` : '/users', values);
if (ok) {
onSave();

View File

@ -37,18 +37,18 @@ const validate = ({ name, domain }) => {
return errors;
};
const OwnerDropDown = ({ user, accounts }) => {
const OwnerDropDown = ({ user, users }) => {
const { setFieldValue, values } = useFormikContext();
useEffect(() => {
if (values.user_id != null && values.owner === '') {
setFieldValue('owner', values.user_id.toString());
} else if (user?.user_id && values.owner === '') {
setFieldValue('owner', user.user_id.toString());
if (values.userId != null && values.owner === '') {
setFieldValue('owner', values.userId.toString());
} else if (user?.id && values.owner === '') {
setFieldValue('owner', user.id.toString());
}
}, [accounts, setFieldValue, user, values]);
}, [users, setFieldValue, user, values]);
if (user?.is_admin) {
if (user?.isAdmin) {
return (
<FormRow>
<label htmlFor="owner">
@ -56,8 +56,8 @@ const OwnerDropDown = ({ user, accounts }) => {
</label>
<div>
<Field as="select" name="owner" className={styles.dropdown}>
{accounts?.map(acc => (
<option key={acc.user_id} value={acc.user_id}>
{users?.map(acc => (
<option key={acc.id} value={acc.id}>
{acc.username}
</option>
))}
@ -73,13 +73,14 @@ const OwnerDropDown = ({ user, accounts }) => {
export default function WebsiteEditForm({ values, onSave, onClose }) {
const { post } = useApi();
const { data: accounts } = useFetch(`/accounts`);
const { data: users } = useFetch(`/users`);
const { user } = useUser();
const [message, setMessage] = useState();
const handleSubmit = async values => {
const { website_id } = values;
const { ok, data } = await post(website_id ? `/websites/${website_id}` : '/websites', values);
const { id } = values;
const { ok, data } = await post(id ? `/websites/${id}` : '/websites', values);
if (ok) {
onSave();
@ -93,7 +94,7 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
return (
<FormLayout>
<Formik
initialValues={{ ...initialValues, ...values, enable_share_url: !!values?.share_id }}
initialValues={{ ...initialValues, ...values, enableShareUrl: !!values?.shareId }}
validate={validate}
onSubmit={handleSubmit}
>
@ -117,17 +118,17 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
name="domain"
type="text"
placeholder="example.com"
spellcheck="false"
autocapitalize="off"
autocorrect="off"
spellCheck="false"
autoCapitalize="off"
autoCorrect="off"
/>
<FormError name="domain" />
</div>
</FormRow>
<OwnerDropDown accounts={accounts} user={user} />
<OwnerDropDown users={users} user={user} />
<FormRow>
<label />
<Field name="enable_share_url">
<Field name="enableShareUrl">
{({ field }) => (
<Checkbox
{...field}
@ -137,7 +138,6 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
defaultMessage="Enable share URL"
/>
}
value={null}
/>
)}
</Field>

View File

@ -2,7 +2,7 @@
display: flex;
justify-content: space-between;
align-items: center;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
text-align: center;
margin: 30px 0;
}

View File

@ -54,7 +54,7 @@
.msg {
color: var(--msgColor);
background: var(--red400);
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
padding: 4px 8px;
border-radius: 4px;
white-space: nowrap;
@ -78,8 +78,8 @@
margin: 20px 0;
padding: 4px 8px;
border-radius: 4px;
color: var(--gray50);
background: var(--gray800);
color: var(--base50);
background: var(--base800);
}
@media only screen and (max-width: 576px) {

View File

@ -9,12 +9,12 @@
}
.row {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
min-height: 430px;
}
.row > .col {
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
padding: 20px;
}
@ -33,7 +33,7 @@
}
.row > .col {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
border-left: 0;
padding: 20px 0;
}

View File

@ -0,0 +1,18 @@
import { Row, cloneChildren } from 'react-basics';
import styles from './GridRow.module.css';
import classNames from 'classnames';
export default function GridRow(props) {
const { children, className, ...rowProps } = props;
return (
<Row {...rowProps} className={className}>
{breakpoint =>
cloneChildren(children, () => {
return {
className: classNames(styles.column, styles[breakpoint]),
};
})
}
</Row>
);
}

View File

@ -0,0 +1,21 @@
.column {
padding: 20px;
border-top: 1px solid var(--base200);
border-left: 1px solid var(--base200);
}
.column:first-child {
padding-left: 0;
border-left: 0;
}
.column:last-child {
padding-right: 0;
}
.column.xs,
.column.sm,
.column.md {
border-left: 0;
border-right: 0;
}

View File

@ -1,6 +1,6 @@
import { Row, Column } from 'react-basics';
import { useRouter } from 'next/router';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Link from 'components/common/Link';
import Icon from 'components/common/Icon';
import LanguageButton from 'components/settings/LanguageButton';
@ -13,41 +13,45 @@ import useConfig from 'hooks/useConfig';
import useUser from 'hooks/useUser';
import Logo from 'assets/logo.svg';
import styles from './Header.module.css';
import SettingsButton from '../settings/SettingsButton';
export default function Header() {
const { user } = useUser();
const { pathname } = useRouter();
const { updatesDisabled } = useConfig();
const { updatesDisabled, adminDisabled } = useConfig();
const isSharePage = pathname.includes('/share/');
const allowUpdate = user?.is_admin && !updatesDisabled && !isSharePage;
const allowUpdate = user?.isAdmin && !updatesDisabled && !isSharePage;
return (
<>
{allowUpdate && <UpdateNotice />}
<header className={classNames(styles.header, 'row')}>
<div className={styles.title}>
<Icon icon={<Logo />} size="large" className={styles.logo} />
<Link href={isSharePage ? HOMEPAGE_URL : '/'}>umami</Link>
</div>
<HamburgerButton />
{user && (
<div className={styles.links}>
<Link href="/dashboard">
<FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />
</Link>
<Link href="/realtime">
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
</Link>
<Link href="/settings">
<FormattedMessage id="label.settings" defaultMessage="Settings" />
</Link>
</div>
)}
<div className={styles.buttons}>
<ThemeButton />
<LanguageButton menuAlign="right" />
{user && <UserButton />}
</div>
<header className={styles.header}>
<Row>
<Column className={styles.title}>
<Icon icon={<Logo />} size="large" className={styles.logo} />
<Link href={isSharePage ? HOMEPAGE_URL : '/'}>umami</Link>
</Column>
<HamburgerButton />
{user && !adminDisabled && (
<div className={styles.links}>
<Link href="/dashboard">
<FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />
</Link>
<Link href="/realtime">
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
</Link>
<Link href="/settings">
<FormattedMessage id="label.settings" defaultMessage="Settings" />
</Link>
</div>
)}
<Column className={styles.buttons}>
<ThemeButton />
<LanguageButton menuAlign="right" />
<SettingsButton />
{user && !adminDisabled && <UserButton />}
</Column>
</Row>
</header>
</>
);

View File

@ -7,10 +7,10 @@
.title {
flex: 1;
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
display: flex;
align-items: center;
line-height: 1.4;
flex-direction: row;
}
.logo {
@ -22,7 +22,7 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
font-weight: 600;
}
@ -33,6 +33,7 @@
.buttons {
flex: 1;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
}

View File

@ -1,22 +1,33 @@
import React from 'react';
import { Container } from 'react-basics';
import Head from 'next/head';
import Header from 'components/layout/Header';
import Footer from 'components/layout/Footer';
import useLocale from 'hooks/useLocale';
import { useRouter } from 'next/router';
export default function Layout({ title, children, header = true, footer = true }) {
const { dir } = useLocale();
const { basePath } = useRouter();
return (
<>
<Container dir={dir} style={{ maxWidth: 1140 }}>
<Head>
<title>umami{title && ` - ${title}`}</title>
<title>{title ? `${title} | umami` : 'umami'}</title>
<link rel="icon" href={`${basePath}/favicon.ico`} />
<link rel="apple-touch-icon" sizes="180x180" href={`${basePath}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
{header && <Header />}
<main>{children}</main>
{footer && <Footer />}
<div id="__modals" dir={dir} />
</>
</Container>
);
}

View File

@ -17,9 +17,9 @@ export default function MenuLayout({
function handleSelect(url) {
if (replace) {
router.replace(url);
router.replace(url, undefined, { shallow: true });
} else {
router.push(url);
router.push(url, undefined, { shallow: true });
}
}

View File

@ -12,7 +12,7 @@
.container .content {
flex: 1;
position: relative;
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
padding-left: 30px;
margin-left: 30px;
}
@ -30,7 +30,7 @@
}
.container .content {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
border-left: 0;
padding-left: 0;
margin-left: 0;

View File

@ -3,5 +3,6 @@
display: flex;
flex-direction: column;
padding: 0 30px;
background: var(--gray50);
background: var(--base50);
border-radius: 8px;
}

View File

@ -5,7 +5,7 @@
.text {
display: flex;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.value {

View File

@ -17,7 +17,7 @@
}
.title {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
font-weight: 600;
}
@ -25,7 +25,7 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
}
@ -34,7 +34,7 @@
overflow: hidden;
border-radius: 100%;
margin-right: 8px;
background: var(--gray50);
background: var(--base50);
}
.color {

View File

@ -16,6 +16,7 @@ export default function DataTable({
height,
animate = true,
virtualize = false,
showPercentage = true,
}) {
const [format, setFormat] = useState(true);
const formatFunc = format ? formatLongNumber : formatNumber;
@ -38,6 +39,7 @@ export default function DataTable({
animate={animate && !virtualize}
format={formatFunc}
onClick={handleSetFormat}
showPercentage={showPercentage}
/>
);
};
@ -68,7 +70,15 @@ export default function DataTable({
);
}
const AnimatedRow = ({ label, value = 0, percent, animate, format, onClick }) => {
const AnimatedRow = ({
label,
value = 0,
percent,
animate,
format,
onClick,
showPercentage = true,
}) => {
const props = useSpring({
width: percent,
y: value,
@ -82,15 +92,17 @@ const AnimatedRow = ({ label, value = 0, percent, animate, format, onClick }) =>
<div className={styles.value} onClick={onClick}>
<animated.div className={styles.value}>{props.y?.interpolate(format)}</animated.div>
</div>
<div className={styles.percent}>
<animated.div
className={styles.bar}
style={{ width: props.width.interpolate(n => `${n}%`) }}
/>
<animated.span className={styles.percentValue}>
{props.width.interpolate(n => `${n.toFixed(0)}%`)}
</animated.span>
</div>
{showPercentage && (
<div className={styles.percent}>
<animated.div
className={styles.bar}
style={{ width: props.width.interpolate(n => `${n}%`) }}
/>
<animated.span className={styles.percentValue}>
{props.width.interpolate(n => `${n.toFixed(0)}%`)}
</animated.span>
</div>
)}
</div>
);
};

View File

@ -1,7 +1,7 @@
.table {
position: relative;
height: 100%;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
display: grid;
grid-template-rows: fit-content(100%) auto;
overflow: hidden;
@ -23,11 +23,11 @@
.title {
display: flex;
font-weight: 600;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.metric {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
text-align: center;
width: 100px;
@ -80,8 +80,8 @@
.percent {
position: relative;
width: 50px;
color: var(--gray600);
border-left: 1px solid var(--gray600);
color: var(--base600);
border-left: 1px solid var(--base600);
padding-left: 10px;
z-index: 1;
}

View File

@ -5,12 +5,12 @@ import Button from 'components/common/Button';
import Times from 'assets/times.svg';
import styles from './FilterTags.module.css';
export default function FilterTags({ params, onClick }) {
export default function FilterTags({ className, params, onClick }) {
if (Object.keys(params).filter(key => params[key]).length === 0) {
return null;
}
return (
<div className={classNames(styles.filters, 'col-12')}>
<div className={classNames(styles.filters, 'col-12', className)}>
{Object.keys(params).map(key => {
if (!params[key]) {
return null;

View File

@ -7,8 +7,5 @@
.tag {
text-align: center;
margin-bottom: 10px;
}
.tag + .tag {
margin-left: 20px;
margin-right: 20px;
}

View File

@ -8,7 +8,7 @@
.label {
display: flex;
align-items: center;
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
cursor: pointer;
}
@ -17,5 +17,5 @@
}
.hidden {
color: var(--gray400);
color: var(--base400);
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import { useSpring, animated } from 'react-spring';
import { formatNumber } from '../../lib/format';
import { formatNumber } from 'lib/format';
import styles from './MetricCard.module.css';
const MetricCard = ({

View File

@ -6,7 +6,7 @@
}
.value {
font-size: var(--font-size-xlarge);
font-size: var(--font-size-xl);
line-height: 40px;
min-height: 40px;
font-weight: 600;
@ -14,7 +14,7 @@
}
.label {
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
white-space: nowrap;
display: flex;
align-items: center;
@ -26,8 +26,8 @@
padding: 0 5px;
border-radius: 5px;
margin-left: 4px;
border: 1px solid var(--gray200);
color: var(--gray500);
border: 1px solid var(--base200);
color: var(--base500);
}
.change.positive {

View File

@ -2,7 +2,7 @@
position: relative;
min-height: 430px;
height: 100%;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
display: flex;
flex-direction: column;
}

View File

@ -9,8 +9,8 @@ function mapData(data) {
const arr = [];
data.reduce((obj, val) => {
const { created_at } = val;
const t = startOfMinute(parseISO(created_at));
const { createdAt } = val;
const t = startOfMinute(parseISO(createdAt));
if (t.getTime() > last) {
obj = { t: format(t, 'yyyy-LL-dd HH:mm:00'), y: 1 };
arr.push(obj);

View File

@ -9,11 +9,14 @@ import styles from './RealtimeHeader.module.css';
export default function RealtimeHeader({ websites, data, websiteId, onSelect }) {
const options = [
{ label: <FormattedMessage id="label.all-websites" defaultMessage="All websites" />, value: 0 },
{
label: <FormattedMessage id="label.all-websites" defaultMessage="All websites" />,
value: null,
},
].concat(
websites.map(({ name, website_id }, index) => ({
websites.map(({ name, id }, index) => ({
label: name,
value: website_id,
value: id,
divider: index === 0,
})),
);
@ -22,7 +25,7 @@ export default function RealtimeHeader({ websites, data, websiteId, onSelect })
const count = useMemo(() => {
return sessions.filter(
({ created_at }) => differenceInMinutes(new Date(), new Date(created_at)) <= 5,
({ createdAt }) => differenceInMinutes(new Date(), new Date(createdAt)) <= 5,
).length;
}, [sessions, websiteId]);

View File

@ -37,7 +37,7 @@ export default function RealtimeLog({ data, websites, websiteId }) {
const logs = useMemo(() => {
const { pageviews, sessions, events } = data;
const logs = [...pageviews, ...sessions, ...events].sort(firstBy('created_at', -1));
const logs = [...pageviews, ...sessions, ...events].sort(firstBy('createdAt', -1));
if (filter) {
return logs.filter(row => getType(row) === filter);
}
@ -45,8 +45,8 @@ export default function RealtimeLog({ data, websites, websiteId }) {
}, [data, filter]);
const uuids = useMemo(() => {
return data.sessions.reduce((obj, { session_id, session_uuid }) => {
obj[session_id] = session_uuid;
return data.sessions.reduce((obj, { sessionId, sessionUuid }) => {
obj[sessionId] = sessionUuid;
return obj;
}, {});
}, [data]);
@ -70,14 +70,14 @@ export default function RealtimeLog({ data, websites, websiteId }) {
},
];
function getType({ view_id, session_id, event_id }) {
if (event_id) {
function getType({ pageviewId, sessionId, eventId }) {
if (eventId) {
return TYPE_EVENT;
}
if (view_id) {
if (pageviewId) {
return TYPE_PAGEVIEW;
}
if (session_id) {
if (sessionId) {
return TYPE_SESSION;
}
return null;
@ -87,26 +87,26 @@ export default function RealtimeLog({ data, websites, websiteId }) {
return TYPE_ICONS[getType(row)];
}
function getWebsite({ website_id }) {
return websites.find(n => n.website_id === website_id);
function getWebsite({ websiteId }) {
return websites.find(n => n.id === websiteId);
}
function getDetail({
event_name,
view_id,
session_id,
eventName,
pageviewId,
sessionId,
url,
browser,
os,
country,
device,
website_id,
websiteId,
}) {
if (event_name) {
return <div>{event_name}</div>;
if (eventName) {
return <div>{eventName}</div>;
}
if (view_id) {
const domain = getWebsite({ website_id })?.domain;
if (pageviewId) {
const domain = getWebsite({ websiteId })?.domain;
return (
<a
className={styles.link}
@ -118,7 +118,7 @@ export default function RealtimeLog({ data, websites, websiteId }) {
</a>
);
}
if (session_id) {
if (sessionId) {
return (
<FormattedMessage
id="message.log.visitor"
@ -134,14 +134,14 @@ export default function RealtimeLog({ data, websites, websiteId }) {
}
}
function getTime({ created_at }) {
return dateFormat(new Date(created_at), 'pp', locale);
function getTime({ createdAt }) {
return dateFormat(new Date(createdAt), 'pp', locale);
}
function getColor(row) {
const { session_id } = row;
const { sessionId } = row;
return stringToColor(uuids[session_id] || `${session_id}${getWebsite(row)}`);
return stringToColor(uuids[sessionId] || `${sessionId}${getWebsite(row)}`);
}
const Row = ({ index, style }) => {

View File

@ -1,5 +1,5 @@
.table {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
overflow: hidden;
height: 100%;
display: grid;
@ -19,7 +19,7 @@
display: flex;
align-items: center;
height: 40px;
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
}
.body {
@ -50,7 +50,7 @@
}
.row .link {
color: var(--gray900);
color: var(--base900);
text-decoration: none;
}

View File

@ -16,7 +16,7 @@ export default function RealtimeViews({ websiteId, data, websites }) {
id =>
websites.length === 1
? websites[0]?.domain
: websites.find(({ website_id }) => website_id === id)?.domain,
: websites.find(({ websiteId }) => websiteId === id)?.domain,
[websites],
);
@ -65,10 +65,10 @@ export default function RealtimeViews({ websiteId, data, websites }) {
const pages = percentFilter(
pageviews
.reduce((arr, { url, website_id }) => {
.reduce((arr, { url, websiteId }) => {
if (url?.startsWith('/')) {
if (!websiteId && websites.length > 1) {
url = `${getDomain(website_id)}${url}`;
url = `${getDomain(websiteId)}${url}`;
}
const row = arr.find(({ x }) => x === url);

View File

@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
import classNames from 'classnames';
import { useMemo } from 'react';
import { Row, Column } from 'react-basics';
import PageviewsChart from './PageviewsChart';
import MetricsBar from './MetricsBar';
import WebsiteHeader from './WebsiteHeader';
@ -20,7 +20,6 @@ export default function WebsiteChart({
title,
domain,
stickyHeader = false,
showLink = false,
showChart = true,
onDataLoad = () => {},
}) {
@ -72,7 +71,7 @@ export default function WebsiteChart({
if (value === 'all') {
const { data, ok } = await get(`/websites/${websiteId}`);
if (ok) {
setDateRange({ value, ...getDateRangeValues(new Date(data.created_at), Date.now()) });
setDateRange({ value, ...getDateRangeValues(new Date(data.createdAt), Date.now()) });
}
} else {
setDateRange(value);
@ -80,33 +79,34 @@ export default function WebsiteChart({
}
return (
<div className={styles.container}>
<WebsiteHeader websiteId={websiteId} title={title} domain={domain} showLink={showLink} />
<div className={classNames(styles.header, 'row')}>
<StickyHeader
className={classNames(styles.metrics, 'col row')}
stickyClassName={styles.sticky}
enabled={stickyHeader}
>
<FilterTags
params={{ url, referrer, os, browser, device, country }}
onClick={handleCloseFilter}
/>
<div className="col-12 col-lg-9">
<>
<WebsiteHeader websiteId={websiteId} title={title} domain={domain} />
<StickyHeader
className={styles.metrics}
stickyClassName={styles.sticky}
enabled={stickyHeader}
>
<FilterTags
params={{ url, referrer, os, browser, device, country }}
onClick={handleCloseFilter}
/>
<Row className={styles.header}>
<Column xs={12} sm={12} md={12} defaultSize={10}>
<MetricsBar websiteId={websiteId} />
</div>
<div className={classNames(styles.filter, 'col-12 col-lg-3')}>
</Column>
<Column className={styles.filter} xs={12} sm={12} md={12} defaultSize={2}>
<DateFilter
value={value}
startDate={startDate}
endDate={endDate}
onChange={handleDateChange}
/>
</div>
</StickyHeader>
</div>
<div className="row">
<div className={classNames(styles.chart, 'col')}>
</Column>
</Row>
</StickyHeader>
<Row>
<Column className={styles.chart}>
{error && <ErrorMessage />}
{showChart && (
<PageviewsChart
@ -117,8 +117,8 @@ export default function WebsiteChart({
loading={loading}
/>
)}
</div>
</div>
</div>
</Column>
</Row>
</>
);
}

View File

@ -7,10 +7,11 @@
.chart {
position: relative;
padding-bottom: 20px;
}
.title {
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
line-height: 60px;
font-weight: 600;
}
@ -31,19 +32,11 @@
position: fixed;
top: 0;
margin: auto;
background: var(--gray50);
border-bottom: 1px solid var(--gray300);
background: var(--base50);
border-bottom: 1px solid var(--base300);
z-index: 3;
}
.filter {
display: flex;
justify-content: flex-end;
align-items: center;
}
@media only screen and (max-width: 992px) {
.filter {
display: block;
}
align-self: center;
}

View File

@ -1,58 +1,22 @@
import React from 'react';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
import Link from 'components/common/Link';
import { Row, Column } from 'react-basics';
import Favicon from 'components/common/Favicon';
import OverflowText from 'components/common/OverflowText';
import PageHeader from 'components/layout/PageHeader';
import RefreshButton from 'components/common/RefreshButton';
import ButtonLayout from 'components/layout/ButtonLayout';
import Favicon from 'components/common/Favicon';
import ActiveUsers from './ActiveUsers';
import Arrow from 'assets/arrow-right.svg';
import styles from './WebsiteHeader.module.css';
export default function WebsiteHeader({ websiteId, title, domain, showLink = false }) {
const header = showLink ? (
<>
<Favicon domain={domain} />
<Link
className={styles.titleLink}
href="/websites/[...id]"
as={`/websites/${websiteId}/${title}`}
>
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</Link>
</>
) : (
<>
<Favicon domain={domain} />
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</>
);
export default function WebsiteHeader({ websiteId, title, domain }) {
return (
<PageHeader className="row">
<div className={classNames(styles.title, 'col-10 col-lg-4 order-1 order-lg-1')}>{header}</div>
<div className={classNames(styles.active, 'col-12 col-lg-4 order-3 order-lg-2')}>
<ActiveUsers websiteId={websiteId} />
</div>
<div className="col-2 col-lg-4 order-2 order-lg-3">
<ButtonLayout align="right">
<RefreshButton websiteId={websiteId} />
{showLink && (
<Link
href="/websites/[...id]"
as={`/websites/${websiteId}/${title}`}
className={styles.link}
icon={<Arrow />}
size="small"
iconRight
>
<FormattedMessage id="label.view-details" defaultMessage="View details" />
</Link>
)}
</ButtonLayout>
</div>
<PageHeader>
<Row>
<Column className={styles.title} variant="two">
<Favicon domain={domain} />
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</Column>
<Column className={styles.active} variant="two">
<ActiveUsers websiteId={websiteId} />
</Column>
</Row>
</PageHeader>
);
}

View File

@ -1,32 +1,15 @@
.title {
color: var(--gray900);
font-size: var(--font-size-large);
line-height: var(--font-size-xlarge);
align-items: center;
display: flex;
max-width: 100%;
flex-direction: row;
align-items: center;
gap: 10px;
font-size: var(--font-size-lg);
overflow: hidden;
}
.titleLink {
max-width: 100%;
}
.link {
font-weight: 600;
}
.active {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
@media only screen and (max-width: 992px) {
.active {
justify-content: flex-start;
}
a.link {
display: none;
}
}

View File

@ -1,6 +1,5 @@
import { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useRouter } from 'next/router';
import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import WebsiteList from 'components/pages/WebsiteList';
@ -16,10 +15,7 @@ const messages = defineMessages({
more: { id: 'label.more', defaultMessage: 'More' },
});
export default function Dashboard() {
const router = useRouter();
const { id } = router.query;
const userId = id?.[0];
export default function Dashboard({ userId }) {
const dashboard = useDashboard();
const { showCharts, limit, editing } = dashboard;
const [max, setMax] = useState(limit);

View File

@ -24,7 +24,7 @@ export default function DashboardEdit({ websites }) {
const ordered = useMemo(
() =>
websites
.map(website => ({ ...website, order: order.indexOf(website.website_id) }))
.map(website => ({ ...website, order: order.indexOf(website.id) }))
.sort(firstBy('order')),
[websites, order],
);
@ -36,7 +36,7 @@ export default function DashboardEdit({ websites }) {
const [removed] = orderedWebsites.splice(source.index, 1);
orderedWebsites.splice(destination.index, 0, removed);
setOrder(orderedWebsites.map((website) => website?.website_id || 0));
setOrder(orderedWebsites.map(website => website?.id || 0));
}
function handleSave() {
@ -76,8 +76,8 @@ export default function DashboardEdit({ websites }) {
ref={provided.innerRef}
style={{ marginBottom: snapshot.isDraggingOver ? 260 : null }}
>
{ordered.map(({ website_id, name, domain }, index) => (
<Draggable key={website_id} draggableId={`${dragId}-${website_id}`} index={index}>
{ordered.map(({ id, name, domain }, index) => (
<Draggable key={id} draggableId={`${dragId}-${id}`} index={index}>
{(provided, snapshot) => (
<div
ref={provided.innerRef}

View File

@ -16,19 +16,19 @@
.item h2 {
font-size: 14px;
color: var(--gray700);
color: var(--base700);
}
.text {
padding: 20px;
border-radius: 5px;
border: 1px solid var(--gray400);
background: var(--gray50);
border: 1px solid var(--base400);
background: var(--base50);
}
.active .text {
border-color: var(--gray600);
box-shadow: 4px 4px 4px var(--gray100);
border-color: var(--base600);
box-shadow: 4px 4px 4px var(--base100);
}
.dragActive {

View File

@ -21,18 +21,18 @@ function mergeData(state, data, time) {
const ids = state.map(({ __id }) => __id);
return state
.concat(data.filter(({ __id }) => !ids.includes(__id)))
.filter(({ created_at }) => new Date(created_at).getTime() >= time);
.filter(({ createdAt }) => new Date(createdAt).getTime() >= time);
}
function filterWebsite(data, id) {
return data.filter(({ website_id }) => website_id === id);
return data.filter(({ websiteId }) => websiteId === id);
}
export default function RealtimeDashboard() {
const { locale } = useLocale();
const countryNames = useCountryNames(locale);
const [data, setData] = useState();
const [websiteId, setWebsiteId] = useState(0);
const [websiteId, setWebsiteId] = useState(null);
const { data: init, loading } = useFetch('/realtime/init');
const { data: updates } = useFetch('/realtime/update', {
params: { start_at: data?.timestamp },
@ -51,10 +51,11 @@ export default function RealtimeDashboard() {
const { pageviews, sessions, events } = data;
if (websiteId) {
const { id } = init.websites.find(n => n.id === websiteId);
return {
pageviews: filterWebsite(pageviews, websiteId),
sessions: filterWebsite(sessions, websiteId),
events: filterWebsite(events, websiteId),
pageviews: filterWebsite(pageviews, id),
sessions: filterWebsite(sessions, id),
events: filterWebsite(events, id),
};
}
}
@ -122,12 +123,7 @@ export default function RealtimeDashboard() {
onSelect={setWebsiteId}
/>
<div className={styles.chart}>
<RealtimeChart
websiteId={websiteId}
data={realtimeData}
unit="minute"
records={REALTIME_RANGE}
/>
<RealtimeChart data={realtimeData} unit="minute" records={REALTIME_RANGE} />
</div>
<GridLayout>
<GridRow>

View File

@ -4,12 +4,12 @@ import { useRouter } from 'next/router';
import Page from 'components/layout/Page';
import MenuLayout from 'components/layout/MenuLayout';
import WebsiteSettings from 'components/settings/WebsiteSettings';
import AccountSettings from 'components/settings/AccountSettings';
import UserSettings from 'components/settings/UserSettings';
import ProfileSettings from 'components/settings/ProfileSettings';
import useUser from 'hooks/useUser';
const WEBSITES = '/settings';
const ACCOUNTS = '/settings/accounts';
const ACCOUNTS = '/settings/users';
const PROFILE = '/settings/profile';
export default function Settings() {
@ -28,9 +28,9 @@ export default function Settings() {
value: WEBSITES,
},
{
label: <FormattedMessage id="label.accounts" defaultMessage="Accounts" />,
label: <FormattedMessage id="label.users" defaultMessage="Users" />,
value: ACCOUNTS,
hidden: !user?.is_admin,
hidden: !user?.isAdmin,
},
{
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
@ -42,7 +42,7 @@ export default function Settings() {
<Page>
<MenuLayout menu={menuOptions} selectedOption={option} onMenuSelect={setOption}>
{pathname === WEBSITES && <WebsiteSettings />}
{pathname === ACCOUNTS && <AccountSettings />}
{pathname === ACCOUNTS && <UserSettings />}
{pathname === PROFILE && <ProfileSettings />}
</MenuLayout>
</Page>

View File

@ -1,4 +1,4 @@
import classNames from 'classnames';
import { Row, Column } from 'react-basics';
import Head from 'next/head';
import Link from 'next/link';
import { useRouter } from 'next/router';
@ -12,7 +12,7 @@ import useFetch from 'hooks/useFetch';
import styles from './TestConsole.module.css';
export default function TestConsole() {
const { data } = useFetch('/websites');
const { data } = useFetch('/websites?include_all=true');
const router = useRouter();
const {
basePath,
@ -24,9 +24,9 @@ export default function TestConsole() {
return null;
}
const options = data.map(({ name, website_id }) => ({ label: name, value: website_id }));
const website = data.find(({ website_id }) => website_id === +websiteId);
const selectedValue = options.find(({ value }) => value === website?.website_id)?.value;
const options = data.map(({ name, id }) => ({ label: name, value: id }));
const website = data.find(({ id }) => websiteId === id);
const selectedValue = options.find(({ value }) => value === website?.id)?.value;
function handleSelect(value) {
router.push(`/console/${value}`);
@ -46,7 +46,7 @@ export default function TestConsole() {
<script
async
defer
data-website-id={website.website_uuid}
data-website-id={website.id}
src={`${basePath}/umami.js`}
data-cache="true"
/>
@ -62,8 +62,8 @@ export default function TestConsole() {
</PageHeader>
{website && (
<>
<div className={classNames(styles.test, 'row')}>
<div className="col-4">
<Row className={styles.test}>
<Column xs="4">
<PageHeader>Page links</PageHeader>
<div>
<Link href={`/console/${websiteId}?page=1`}>
@ -87,32 +87,32 @@ export default function TestConsole() {
</a>
</Link>
</div>
</div>
<div className="col-4">
</Column>
<Column xs="4">
<PageHeader>CSS events</PageHeader>
<Button id="primary-button" className="umami--click--button-click" variant="action">
Send event
</Button>
</div>
<div className="col-4">
</Column>
<Column xs="4">
<PageHeader>Javascript events</PageHeader>
<Button id="manual-button" variant="action" onClick={handleClick}>
Run script
</Button>
</div>
</div>
<div className="row">
<div className="col-12">
</Column>
</Row>
<Row>
<Column>
<WebsiteChart
websiteId={website.website_id}
websiteId={website.id}
title={website.name}
domain={website.domain}
showLink
/>
<PageHeader>Events</PageHeader>
<EventsChart websiteId={website.website_id} />
</div>
</div>
<EventsChart websiteId={website.id} />
</Column>
</Row>
</>
)}
</Page>

View File

@ -1,5 +1,5 @@
.test {
border: 1px solid var(--gray200);
border: 1px solid var(--base200);
border-radius: 5px;
padding: 0 20px 20px 20px;
}

View File

@ -1,28 +1,30 @@
import React, { useState } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import Arrow from 'assets/arrow-right.svg';
import classNames from 'classnames';
import WebsiteChart from 'components/metrics/WebsiteChart';
import WorldMap from 'components/common/WorldMap';
import Page from 'components/layout/Page';
import GridLayout, { GridRow, GridColumn } from 'components/layout/GridLayout';
import MenuLayout from 'components/layout/MenuLayout';
import EventDataButton from 'components/common/EventDataButton';
import Link from 'components/common/Link';
import Loading from 'components/common/Loading';
import Arrow from 'assets/arrow-right.svg';
import PagesTable from 'components/metrics/PagesTable';
import ReferrersTable from 'components/metrics/ReferrersTable';
import WorldMap from 'components/common/WorldMap';
import GridRow from 'components/layout/GridRow';
import MenuLayout from 'components/layout/MenuLayout';
import Page from 'components/layout/Page';
import BrowsersTable from 'components/metrics/BrowsersTable';
import OSTable from 'components/metrics/OSTable';
import DevicesTable from 'components/metrics/DevicesTable';
import CountriesTable from 'components/metrics/CountriesTable';
import LanguagesTable from 'components/metrics/LanguagesTable';
import EventsTable from 'components/metrics/EventsTable';
import DevicesTable from 'components/metrics/DevicesTable';
import EventsChart from 'components/metrics/EventsChart';
import ScreenTable from 'components/metrics/ScreenTable';
import EventsTable from 'components/metrics/EventsTable';
import LanguagesTable from 'components/metrics/LanguagesTable';
import OSTable from 'components/metrics/OSTable';
import PagesTable from 'components/metrics/PagesTable';
import QueryParametersTable from 'components/metrics/QueryParametersTable';
import ReferrersTable from 'components/metrics/ReferrersTable';
import ScreenTable from 'components/metrics/ScreenTable';
import WebsiteChart from 'components/metrics/WebsiteChart';
import useFetch from 'hooks/useFetch';
import usePageQuery from 'hooks/usePageQuery';
import { DEFAULT_ANIMATION_DURATION } from 'lib/constants';
import { useState } from 'react';
import { Column } from 'react-basics';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import styles from './WebsiteDetails.module.css';
const messages = defineMessages({
@ -64,7 +66,7 @@ export default function WebsiteDetails({ websiteId }) {
const BackButton = () => (
<div key="back-button" className={classNames(styles.backButton, 'col-12')}>
<Link key="back-button" href={resolve({ view: undefined })} icon={<Arrow />} size="small">
<Link key="back-button" href={resolve({ view: undefined })} icon={<Arrow />} sizes="small">
<FormattedMessage id="label.back" defaultMessage="Back" />
</Link>
</div>
@ -136,57 +138,54 @@ export default function WebsiteDetails({ websiteId }) {
return (
<Page>
<div className="row">
<div className={classNames(styles.chart, 'col')}>
<WebsiteChart
websiteId={websiteId}
title={data.name}
domain={data.domain}
onDataLoad={handleDataLoad}
showLink={false}
stickyHeader
/>
{!chartLoaded && <Loading />}
</div>
</div>
<WebsiteChart
websiteId={websiteId}
title={data.name}
domain={data.domain}
onDataLoad={handleDataLoad}
showLink={false}
stickyHeader
/>
{!chartLoaded && <Loading />}
{chartLoaded && !view && (
<GridLayout>
<>
<GridRow>
<GridColumn md={12} lg={6}>
<Column variant="two" className={styles.column}>
<PagesTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={6}>
</Column>
<Column variant="two" className={styles.column}>
<ReferrersTable {...tableProps} />
</GridColumn>
</Column>
</GridRow>
<GridRow>
<GridColumn md={12} lg={4}>
<Column variant="three" className={styles.column}>
<BrowsersTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={4}>
</Column>
<Column variant="three" className={styles.column}>
<OSTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={4}>
</Column>
<Column variant="three" className={styles.column}>
<DevicesTable {...tableProps} />
</GridColumn>
</Column>
</GridRow>
<GridRow>
<GridColumn xs={12} md={12} lg={8}>
<Column xs={12} sm={12} md={12} defaultSize={8}>
<WorldMap data={countryData} />
</GridColumn>
<GridColumn xs={12} md={12} lg={4}>
</Column>
<Column xs={12} sm={12} md={12} defaultSize={4}>
<CountriesTable {...tableProps} onDataLoad={setCountryData} />
</GridColumn>
</Column>
</GridRow>
<GridRow className={classNames({ [styles.hidden]: !eventsData?.length > 0 })}>
<GridColumn xs={12} md={12} lg={4}>
<Column xs={12} md={12} lg={12} defaultSize={4}>
<EventsTable {...tableProps} onDataLoad={setEventsData} />
</GridColumn>
<GridColumn xs={12} md={12} lg={8}>
</Column>
<Column xs={12} md={12} lg={12} defaultSize={8}>
<EventDataButton websiteId={websiteId} />
<EventsChart className={styles.eventschart} websiteId={websiteId} />
</GridColumn>
</Column>
</GridRow>
</GridLayout>
</>
)}
{view && chartLoaded && (
<MenuLayout

View File

@ -3,11 +3,11 @@
}
.view {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
}
.menu {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.content {
@ -33,10 +33,3 @@
.eventschart {
padding-top: 30px;
}
@media only screen and (max-width: 992px) {
.menu {
display: flex;
flex-direction: column;
}
}

View File

@ -27,7 +27,7 @@ export default function WebsiteList({ websites, showCharts, limit }) {
const ordered = useMemo(
() =>
websites
.map(website => ({ ...website, order: websiteOrder.indexOf(website.website_id) || 0 }))
.map(website => ({ ...website, order: websiteOrder.indexOf(website.id) || 0 }))
.sort(firstBy('order')),
[websites, websiteOrder],
);
@ -46,11 +46,11 @@ export default function WebsiteList({ websites, showCharts, limit }) {
return (
<div>
{ordered.map(({ website_id, name, domain }, index) =>
{ordered.map(({ id, name, domain }, index) =>
index < limit ? (
<div key={website_id} className={styles.website}>
<div key={id} className={styles.website}>
<WebsiteChart
websiteId={website_id}
websiteId={id}
title={name}
domain={domain}
showChart={showCharts}

View File

@ -1,6 +1,6 @@
.website {
padding-bottom: 30px;
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
margin-bottom: 30px;
align-self: stretch;
}

View File

@ -5,7 +5,7 @@ import Button from 'components/common/Button';
import useLocale from 'hooks/useLocale';
import { DEFAULT_LOCALE } from 'lib/constants';
import styles from './TimezoneSetting.module.css';
import { languages } from '../../lib/lang';
import { languages } from 'lib/lang';
export default function LanguageSetting() {
const { locale, saveLocale } = useLocale();

View File

@ -32,7 +32,7 @@ export default function ProfileSettings() {
return null;
}
const { user_id, username } = user;
const { userId, username } = user;
return (
<>
@ -79,7 +79,7 @@ export default function ProfileSettings() {
title={<FormattedMessage id="label.change-password" defaultMessage="Change password" />}
>
<ChangePasswordForm
values={{ user_id }}
values={{ userId }}
onSave={handleSave}
onClose={() => setChangePassword(false)}
/>

View File

@ -0,0 +1,45 @@
import React, { useRef, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import TimezoneSetting from './TimezoneSetting';
import DateRangeSetting from './DateRangeSetting';
import Button from 'components/common/Button';
import styles from './SettingsButton.module.css';
import Gear from 'assets/gear.svg';
import useDocumentClick from '../../hooks/useDocumentClick';
export default function SettingsButton() {
const [show, setShow] = useState(false);
const ref = useRef();
function handleClick() {
setShow(state => !state);
}
useDocumentClick(e => {
if (!ref.current?.contains(e.target)) {
setShow(false);
}
});
return (
<div className={styles.button} ref={ref}>
<Button icon={<Gear />} variant="light" onClick={handleClick} />
{show && (
<div className={styles.panel}>
<dt>
<FormattedMessage id="label.timezone" defaultMessage="Timezone" />
</dt>
<dd>
<TimezoneSetting />
</dd>
<dt>
<FormattedMessage id="label.default-date-range" defaultMessage="Default date range" />
</dt>
<dd>
<DateRangeSetting />
</dd>
</div>
)}
</div>
);
}

View File

@ -0,0 +1,20 @@
.button {
position: relative;
}
.panel {
background: var(--base50);
border: 1px solid var(--base500);
border-radius: 4px;
display: flex;
flex-direction: column;
position: absolute;
top: 100%;
right: 0;
padding: 20px;
z-index: 100;
}
.panel dd {
display: flex;
}

View File

@ -8,10 +8,12 @@ import User from 'assets/user.svg';
import styles from './UserButton.module.css';
import { AUTH_TOKEN } from 'lib/constants';
import useUser from 'hooks/useUser';
import useConfig from 'hooks/useConfig';
export default function UserButton() {
const { user } = useUser();
const router = useRouter();
const { adminDisabled } = useConfig();
const menuOptions = [
{
@ -25,7 +27,11 @@ export default function UserButton() {
value: 'username',
className: styles.username,
},
{ label: <FormattedMessage id="label.profile" defaultMessage="Profile" />, value: 'profile' },
{
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
value: 'profile',
hidden: adminDisabled,
},
{ label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' },
];

View File

@ -1,7 +1,7 @@
.username {
border-bottom: 1px solid var(--gray500);
border-bottom: 1px solid var(--base500);
}
.username:hover {
background: var(--gray50);
background: var(--base50);
}

View File

@ -8,7 +8,7 @@ import Icon from 'components/common/Icon';
import Table from 'components/common/Table';
import Modal from 'components/common/Modal';
import Toast from 'components/common/Toast';
import AccountEditForm from 'components/forms/AccountEditForm';
import UserEditForm from 'components/forms/UserEditForm';
import ButtonLayout from 'components/layout/ButtonLayout';
import DeleteForm from 'components/forms/DeleteForm';
import useFetch from 'hooks/useFetch';
@ -17,33 +17,35 @@ import Plus from 'assets/plus.svg';
import Trash from 'assets/trash.svg';
import Check from 'assets/check.svg';
import LinkIcon from 'assets/external-link.svg';
import styles from './AccountSettings.module.css';
import styles from './UserSettings.module.css';
export default function AccountSettings() {
const [addAccount, setAddAccount] = useState();
const [editAccount, setEditAccount] = useState();
const [deleteAccount, setDeleteAccount] = useState();
export default function UserSettings() {
const [addUser, setAddUser] = useState();
const [editUser, setEditUser] = useState();
const [deleteUser, setDeleteUser] = useState();
const [saved, setSaved] = useState(0);
const [message, setMessage] = useState();
const { data } = useFetch(`/accounts`, {}, [saved]);
const { data } = useFetch(`/users`, {}, [saved]);
const Checkmark = ({ is_admin }) => (is_admin ? <Icon icon={<Check />} size="medium" /> : null);
const Checkmark = ({ isAdmin }) => (isAdmin ? <Icon icon={<Check />} size="medium" /> : null);
const DashboardLink = row => (
<Link href={`/dashboard/${row.user_id}/${row.username}`}>
<a>
<Icon icon={<LinkIcon />} />
</a>
</Link>
);
const DashboardLink = row => {
return (
<Link href={`/dashboard/${row.id}/${row.username}`}>
<a>
<Icon icon={<LinkIcon />} />
</a>
</Link>
);
};
const Buttons = row => (
<ButtonLayout align="right">
<Button icon={<Pen />} size="small" onClick={() => setEditAccount(row)}>
<Button icon={<Pen />} size="small" onClick={() => setEditUser(row)}>
<FormattedMessage id="label.edit" defaultMessage="Edit" />
</Button>
{!row.is_admin && (
<Button icon={<Trash />} size="small" onClick={() => setDeleteAccount(row)}>
{!row.isAdmin && (
<Button icon={<Trash />} size="small" onClick={() => setDeleteUser(row)}>
<FormattedMessage id="label.delete" defaultMessage="Delete" />
</Button>
)}
@ -57,7 +59,7 @@ export default function AccountSettings() {
className: 'col-12 col-lg-4',
},
{
key: 'is_admin',
key: 'isAdmin',
label: <FormattedMessage id="label.administrator" defaultMessage="Administrator" />,
className: 'col-12 col-lg-3',
render: Checkmark,
@ -82,9 +84,9 @@ export default function AccountSettings() {
}
function handleClose() {
setEditAccount(null);
setAddAccount(null);
setDeleteAccount(null);
setEditUser(null);
setAddUser(null);
setDeleteUser(null);
}
if (!data) {
@ -95,33 +97,31 @@ export default function AccountSettings() {
<>
<PageHeader>
<div>
<FormattedMessage id="label.accounts" defaultMessage="Accounts" />
<FormattedMessage id="label.users" defaultMessage="Users" />
</div>
<Button icon={<Plus />} size="small" onClick={() => setAddAccount(true)}>
<FormattedMessage id="label.add-account" defaultMessage="Add account" />
<Button icon={<Plus />} size="small" onClick={() => setAddUser(true)}>
<FormattedMessage id="label.add-user" defaultMessage="Add user" />
</Button>
</PageHeader>
<Table columns={columns} rows={data} />
{editAccount && (
<Modal title={<FormattedMessage id="label.edit-account" defaultMessage="Edit account" />}>
<AccountEditForm
values={{ ...editAccount, password: '' }}
{editUser && (
<Modal title={<FormattedMessage id="label.edit-user" defaultMessage="Edit user" />}>
<UserEditForm
values={{ ...editUser, password: '' }}
onSave={handleSave}
onClose={handleClose}
/>
</Modal>
)}
{addAccount && (
<Modal title={<FormattedMessage id="label.add-account" defaultMessage="Add account" />}>
<AccountEditForm onSave={handleSave} onClose={handleClose} />
{addUser && (
<Modal title={<FormattedMessage id="label.add-user" defaultMessage="Add user" />}>
<UserEditForm onSave={handleSave} onClose={handleClose} />
</Modal>
)}
{deleteAccount && (
<Modal
title={<FormattedMessage id="label.delete-account" defaultMessage="Delete account" />}
>
{deleteUser && (
<Modal title={<FormattedMessage id="label.delete-user" defaultMessage="Delete user" />}>
<DeleteForm
values={{ type: 'account', id: deleteAccount.user_id, name: deleteAccount.username }}
values={{ type: 'users', id: deleteUser.id, name: deleteUser.username }}
onSave={handleSave}
onClose={handleClose}
/>

View File

@ -37,16 +37,16 @@ export default function WebsiteSettings() {
const [saved, setSaved] = useState(0);
const [message, setMessage] = useState();
const { data } = useFetch('/websites', { params: { include_all: !!user?.is_admin } }, [saved]);
const { data } = useFetch('/websites', { params: { include_all: !!user?.isAdmin } }, [saved]);
const Buttons = row => (
<ButtonLayout align="right">
{row.share_id && (
{row.shareId && (
<Button
icon={<LinkIcon />}
size="small"
tooltip={<FormattedMessage id="message.get-share-url" defaultMessage="Get share URL" />}
tooltipId={`button-share-${row.website_id}`}
tooltipId={`button-share-${row.id}`}
onClick={() => setShowUrl(row)}
/>
)}
@ -56,46 +56,42 @@ export default function WebsiteSettings() {
tooltip={
<FormattedMessage id="message.get-tracking-code" defaultMessage="Get tracking code" />
}
tooltipId={`button-code-${row.website_id}`}
tooltipId={`button-code-${row.id}`}
onClick={() => setShowCode(row)}
/>
<Button
icon={<Pen />}
size="small"
tooltip={<FormattedMessage id="label.edit" defaultMessage="Edit" />}
tooltipId={`button-edit-${row.website_id}`}
tooltipId={`button-edit-${row.id}`}
onClick={() => setEditWebsite(row)}
/>
<Button
icon={<Reset />}
size="small"
tooltip={<FormattedMessage id="label.reset" defaultMessage="Reset" />}
tooltipId={`button-reset-${row.website_id}`}
tooltipId={`button-reset-${row.id}`}
onClick={() => setResetWebsite(row)}
/>
<Button
icon={<Trash />}
size="small"
tooltip={<FormattedMessage id="label.delete" defaultMessage="Delete" />}
tooltipId={`button-delete-${row.website_id}`}
tooltipId={`button-delete-${row.id}`}
onClick={() => setDeleteWebsite(row)}
/>
</ButtonLayout>
);
const DetailsLink = ({ website_id, name, domain }) => (
<Link
className={styles.detailLink}
href="/websites/[...id]"
as={`/websites/${website_id}/${name}`}
>
const DetailsLink = ({ id, name, domain }) => (
<Link className={styles.detailLink} href="/websites/[...id]" as={`/websites/${id}/${name}`}>
<Favicon domain={domain} />
<OverflowText tooltipId={`${website_id}-name`}>{name}</OverflowText>
<OverflowText tooltipId={`${id}-name`}>{name}</OverflowText>
</Link>
);
const Domain = ({ domain, website_id }) => (
<OverflowText tooltipId={`${website_id}-domain`}>{domain}</OverflowText>
const Domain = ({ domain, id }) => (
<OverflowText tooltipId={`${id}-domain`}>{domain}</OverflowText>
);
const adminColumns = [
@ -112,7 +108,7 @@ export default function WebsiteSettings() {
render: Domain,
},
{
key: 'account',
key: 'user',
label: <FormattedMessage id="label.owner" defaultMessage="Owner" />,
className: 'col-12 col-lg-4 col-xl-1',
},
@ -187,7 +183,7 @@ export default function WebsiteSettings() {
<FormattedMessage id="label.add-website" defaultMessage="Add website" />
</Button>
</PageHeader>
<Table columns={user.is_admin ? adminColumns : columns} rows={data} empty={empty} />
<Table columns={user.isAdmin ? adminColumns : columns} rows={data} empty={empty} />
{editWebsite && (
<Modal title={<FormattedMessage id="label.edit-website" defaultMessage="Edit website" />}>
<WebsiteEditForm values={editWebsite} onSave={handleSave} onClose={handleClose} />
@ -203,7 +199,7 @@ export default function WebsiteSettings() {
title={<FormattedMessage id="label.reset-website" defaultMessage="Reset statistics" />}
>
<ResetForm
values={{ type: 'website', id: resetWebsite.website_id, name: resetWebsite.name }}
values={{ type: 'websites', id: resetWebsite.id, name: resetWebsite.name }}
onSave={handleSave}
onClose={handleClose}
/>
@ -214,7 +210,7 @@ export default function WebsiteSettings() {
title={<FormattedMessage id="label.delete-website" defaultMessage="Delete website" />}
>
<DeleteForm
values={{ type: 'website', id: deleteWebsite.website_id, name: deleteWebsite.name }}
values={{ type: 'websites', id: deleteWebsite.id, name: deleteWebsite.name }}
onSave={handleSave}
onClose={handleClose}
/>

Some files were not shown because too many files have changed in this diff Show More