mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
add charts and reset stats function
This commit is contained in:
Generated
+331
-3
@@ -16,6 +16,7 @@
|
||||
"next-auth": "^5.0.0-beta.25",
|
||||
"next-qrcode": "^2.5.1",
|
||||
"react-hot-toast": "^2.5.2",
|
||||
"recharts": "^2.15.1",
|
||||
"ua-parser-js": "^2.0.3",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
@@ -1672,6 +1673,69 @@
|
||||
"integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-array": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz",
|
||||
"integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-color": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
|
||||
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-ease": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
|
||||
"integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-interpolate": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
|
||||
"integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-color": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-path": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
|
||||
"integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-scale": {
|
||||
"version": "4.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
|
||||
"integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-time": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-shape": {
|
||||
"version": "3.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",
|
||||
"integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-path": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/d3-time": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
|
||||
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/d3-timer": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
|
||||
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/json5": {
|
||||
"version": "0.0.29",
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
@@ -2592,6 +2656,15 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/color": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
|
||||
@@ -2693,6 +2766,127 @@
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/d3-array": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
|
||||
"integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"internmap": "1 - 2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-color": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
||||
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-ease": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
|
||||
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-format": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz",
|
||||
"integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-interpolate": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
||||
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-path": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
|
||||
"integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-scale": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
|
||||
"integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2.10.0 - 3",
|
||||
"d3-format": "1 - 3",
|
||||
"d3-interpolate": "1.2.0 - 3",
|
||||
"d3-time": "2.1.1 - 3",
|
||||
"d3-time-format": "2 - 4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-shape": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
|
||||
"integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-path": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-time": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
|
||||
"integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-time-format": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
|
||||
"integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-time": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-timer": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
|
||||
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/damerau-levenshtein": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz",
|
||||
@@ -2781,6 +2975,12 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js-light": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
|
||||
"integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/deep-is": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||
@@ -2895,6 +3095,16 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dom-helpers": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
|
||||
"integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
@@ -3621,6 +3831,12 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@@ -3628,6 +3844,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-equals": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.2.2.tgz",
|
||||
"integrity": "sha512-V7/RktU11J3I36Nwq2JnZEM7tNm17eBJz+u25qdxBZeCKiX6BkVSZQjwWIr+IobgnZy+ag73tTZgZi7tr0LrBw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
|
||||
@@ -4247,6 +4472,15 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/internmap": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
|
||||
"integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/is-array-buffer": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
|
||||
@@ -5125,6 +5359,12 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
@@ -5421,7 +5661,6 @@
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -5848,7 +6087,6 @@
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.4.0",
|
||||
@@ -5958,7 +6196,6 @@
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/react-redux": {
|
||||
@@ -5984,6 +6221,75 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-smooth": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz",
|
||||
"integrity": "sha512-gnGKTpYwqL0Iii09gHobNolvX4Kiq4PKx6eWBCYYix+8cdw+cGo3do906l1NBPKkSWx1DghC1dlWG9L2uGd61Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-equals": "^5.0.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-transition-group": "^4.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-transition-group": {
|
||||
"version": "4.4.5",
|
||||
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
|
||||
"integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"dom-helpers": "^5.0.1",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.6.0",
|
||||
"react-dom": ">=16.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/recharts": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.1.tgz",
|
||||
"integrity": "sha512-v8PUTUlyiDe56qUj82w/EDVuzEFXwEHp9/xOowGAZwfLjB9uAy3GllQVIYMWF6nU+qibx85WF75zD7AjqoT54Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"clsx": "^2.0.0",
|
||||
"eventemitter3": "^4.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"react-is": "^18.3.1",
|
||||
"react-smooth": "^4.0.4",
|
||||
"recharts-scale": "^0.4.4",
|
||||
"tiny-invariant": "^1.3.1",
|
||||
"victory-vendor": "^36.6.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/recharts-scale": {
|
||||
"version": "0.4.5",
|
||||
"resolved": "https://registry.npmjs.org/recharts-scale/-/recharts-scale-0.4.5.tgz",
|
||||
"integrity": "sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"decimal.js-light": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/recharts/node_modules/react-is": {
|
||||
"version": "18.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
||||
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/redux": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||
@@ -7148,6 +7454,28 @@
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor": {
|
||||
"version": "36.9.2",
|
||||
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz",
|
||||
"integrity": "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ==",
|
||||
"license": "MIT AND ISC",
|
||||
"dependencies": {
|
||||
"@types/d3-array": "^3.0.3",
|
||||
"@types/d3-ease": "^3.0.0",
|
||||
"@types/d3-interpolate": "^3.0.1",
|
||||
"@types/d3-scale": "^4.0.2",
|
||||
"@types/d3-shape": "^3.1.0",
|
||||
"@types/d3-time": "^3.0.0",
|
||||
"@types/d3-timer": "^3.0.0",
|
||||
"d3-array": "^3.1.6",
|
||||
"d3-ease": "^3.0.1",
|
||||
"d3-interpolate": "^3.0.1",
|
||||
"d3-scale": "^4.0.2",
|
||||
"d3-shape": "^3.1.0",
|
||||
"d3-time": "^3.0.0",
|
||||
"d3-timer": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"next-auth": "^5.0.0-beta.25",
|
||||
"next-qrcode": "^2.5.1",
|
||||
"react-hot-toast": "^2.5.2",
|
||||
"recharts": "^2.15.1",
|
||||
"ua-parser-js": "^2.0.3",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
|
||||
@@ -208,3 +208,32 @@ export async function pinPageToRoot(prevState: any, fromData: FormData) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function deletePageStats(prevState: any, formData: FormData) {
|
||||
const schema = z.object({
|
||||
uuid: z.string().uuid()
|
||||
});
|
||||
|
||||
const data = schema.safeParse({
|
||||
uuid: formData.get("uuid")
|
||||
});
|
||||
|
||||
if (!data.success) {
|
||||
return {
|
||||
message: "Invalid data",
|
||||
error: data.error.flatten().fieldErrors,
|
||||
};
|
||||
}
|
||||
|
||||
await prisma.stat.deleteMany({
|
||||
where: {
|
||||
pageUuid: data.data.uuid
|
||||
}
|
||||
});
|
||||
|
||||
revalidatePath(`/~/dash/${data.data.uuid}`);
|
||||
|
||||
return {
|
||||
message: "Stats deleted",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
'use server'
|
||||
|
||||
import prisma from "../../prisma/prisma";
|
||||
|
||||
export async function getDailyStats(pageUuid: string) {
|
||||
const sevenDaysAgo = new Date();
|
||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
|
||||
|
||||
const dailyStats = await prisma.stat.groupBy({
|
||||
by: ['accessedAt'],
|
||||
where: {
|
||||
pageUuid: pageUuid,
|
||||
accessedAt: {
|
||||
gte: sevenDaysAgo
|
||||
}
|
||||
},
|
||||
_count: {
|
||||
uuid: true
|
||||
},
|
||||
orderBy: {
|
||||
accessedAt: 'asc'
|
||||
}
|
||||
});
|
||||
|
||||
// Group by date only (ignoring time)
|
||||
const groupedByDate = dailyStats.reduce((acc, stat) => {
|
||||
const date = stat.accessedAt.toISOString().split('T')[0];
|
||||
if (!acc[date]) {
|
||||
acc[date] = {
|
||||
date: stat.accessedAt.toISOString(),
|
||||
clicks: 0
|
||||
};
|
||||
}
|
||||
acc[date].clicks += stat._count.uuid;
|
||||
return acc;
|
||||
}, {} as Record<string, { date: string; clicks: number }>);
|
||||
|
||||
return Object.values(groupedByDate);
|
||||
}
|
||||
|
||||
export async function getPageData(uuid: string) {
|
||||
return await prisma.page.findUnique({
|
||||
where: { uuid: uuid },
|
||||
include: {
|
||||
pinnedPage: true,
|
||||
redirectPage: true,
|
||||
customPage: true,
|
||||
stat: { orderBy: { accessedAt: "desc" } },
|
||||
_count: {
|
||||
select: { stat: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function getPageStats(uuid: string) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
const [stats, clicksToday, lastVisit] = await Promise.all([
|
||||
prisma.stat.groupBy({
|
||||
by: ['hash', 'userAgent'],
|
||||
where: {
|
||||
pageUuid: uuid
|
||||
},
|
||||
_count: {
|
||||
uuid: true
|
||||
},
|
||||
_max: {
|
||||
accessedAt: true
|
||||
},
|
||||
orderBy: {
|
||||
_max: {
|
||||
accessedAt: "desc"
|
||||
}
|
||||
}
|
||||
}),
|
||||
prisma.stat.count({
|
||||
where: {
|
||||
pageUuid: uuid,
|
||||
accessedAt: {
|
||||
gte: today
|
||||
}
|
||||
}
|
||||
}),
|
||||
prisma.stat.findFirst({
|
||||
where: {
|
||||
pageUuid: uuid
|
||||
},
|
||||
orderBy: {
|
||||
accessedAt: 'desc'
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
return {
|
||||
stats,
|
||||
clicksToday,
|
||||
lastVisit: lastVisit?.accessedAt
|
||||
};
|
||||
}
|
||||
|
||||
export async function getCustomPageData(customPageUuid: string) {
|
||||
const [linkPages, linkBlocks] = await Promise.all([
|
||||
prisma.redirectPage.findMany({
|
||||
include: { page: true }
|
||||
}),
|
||||
prisma.linkBlock.findMany({
|
||||
where: {
|
||||
customPageUuid: customPageUuid
|
||||
},
|
||||
orderBy: {
|
||||
order: "asc"
|
||||
},
|
||||
include: {
|
||||
redirectPage: { include: { page: true } }
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
const shortcodes = linkPages.map((p) => p.page.shortcode);
|
||||
|
||||
return {
|
||||
linkPages,
|
||||
linkBlocks,
|
||||
shortcodes
|
||||
};
|
||||
}
|
||||
@@ -9,6 +9,9 @@ import { hashToColor } from "@/utils";
|
||||
import PinPageToRootForm from "@/components/forms/pinPageToRootForm";
|
||||
import { ArrowTopRightOnSquareIcon, BookmarkIcon } from "@heroicons/react/24/solid";
|
||||
import QRCode from "@/components/QRCode";
|
||||
import ResetStatsForm from "@/components/forms/resetStatsForm";
|
||||
import LineChart from "@/components/LineChart";
|
||||
import { getDailyStats, getPageData, getPageStats, getCustomPageData } from "@/actions/stats";
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{
|
||||
@@ -17,68 +20,25 @@ interface PageProps {
|
||||
}
|
||||
|
||||
export default async function DetailedStats({ params }: PageProps) {
|
||||
|
||||
const { uuid } = await params;
|
||||
|
||||
const page = await prisma.page.findUnique({
|
||||
where: { uuid: uuid },
|
||||
include: {
|
||||
pinnedPage: true,
|
||||
redirectPage: true,
|
||||
customPage: true,
|
||||
stat: { orderBy: { accessedAt: "desc" } },
|
||||
_count: {
|
||||
select: { stat: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// group stats by hash
|
||||
|
||||
const stats = await prisma.stat.groupBy({
|
||||
by: ['hash', 'userAgent'],
|
||||
where: {
|
||||
pageUuid: uuid
|
||||
},
|
||||
_count: {
|
||||
uuid: true
|
||||
},
|
||||
_max: {
|
||||
accessedAt: true
|
||||
},
|
||||
orderBy: {
|
||||
_max: {
|
||||
accessedAt: "desc"
|
||||
}
|
||||
}
|
||||
});
|
||||
const [page, pageStats] = await Promise.all([
|
||||
getPageData(uuid),
|
||||
getPageStats(uuid)
|
||||
]);
|
||||
|
||||
if (!page) {
|
||||
redirect("/~/dash");
|
||||
//return notFound();
|
||||
}
|
||||
|
||||
const redirectPage = page.redirectPage[0];
|
||||
const customPage = page.customPage[0];
|
||||
|
||||
// get shortcodes if the page is a custom page to use in the link block form
|
||||
const linkPages = customPage ? await prisma.redirectPage.findMany({ include: { page: true } }) : undefined
|
||||
const shortcodes = linkPages ? linkPages.map((p) => p.page.shortcode) : undefined
|
||||
// get custom page data if needed
|
||||
const customPageData = customPage ? await getCustomPageData(customPage.uuid) : undefined;
|
||||
|
||||
// get link blocks if the page is a custom page
|
||||
const linkBlocks = customPage ? await prisma.linkBlock.findMany({
|
||||
where: {
|
||||
customPageUuid: customPage.uuid
|
||||
},
|
||||
orderBy: {
|
||||
order: "asc"
|
||||
},
|
||||
include: {
|
||||
redirectPage: { include: { page: true } }
|
||||
}
|
||||
}) : undefined;
|
||||
// Get chart data using server action
|
||||
const chartData = await getDailyStats(uuid);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -125,23 +85,28 @@ export default async function DetailedStats({ params }: PageProps) {
|
||||
<QRCode url={page.shortcode} />
|
||||
</div>
|
||||
|
||||
{customPage ? <CustomPageDashboard customPage={customPage} linkBlocks={linkBlocks || []} shortcodes={shortcodes || []} /> : ""}
|
||||
{customPage ? <CustomPageDashboard customPage={customPage} linkBlocks={customPageData?.linkBlocks || []} shortcodes={customPageData?.shortcodes || []} /> : ""}
|
||||
|
||||
<h2 className="mt-10">Visitors</h2>
|
||||
<p className="my-2">All visits (not unique): {page._count.stat}</p>
|
||||
<div className="flex justify-between items-center mt-10">
|
||||
<h2 className="m-0">Stats</h2>
|
||||
<div className="ml-auto">
|
||||
<ResetStatsForm uuid={page.uuid} />
|
||||
</div>
|
||||
</div>
|
||||
<p className="my-2">Clicks today: {pageStats.clicksToday}</p>
|
||||
<p className="my-2">Last visit: {pageStats.lastVisit?.toLocaleString()}</p>
|
||||
<p className="my-2">Unique visitors: {pageStats.stats.length}</p>
|
||||
<p className="my-2">All clicks: {page._count.stat}</p>
|
||||
|
||||
{stats.map((stat) => (<div className="zebra" key={stat.hash}>
|
||||
<h3 className="mt-10">Last 7 Days</h3>
|
||||
<LineChart data={chartData} />
|
||||
|
||||
<h3 className="mt-10">All Visits</h3>
|
||||
{pageStats.stats.map((stat) => (<div className="zebra" key={stat.hash}>
|
||||
<p style={{ color: hashToColor(stat.hash) }}>{stat.userAgent}</p>
|
||||
<p>Visits: {"" + stat._count.uuid}</p>
|
||||
<p>Last Visit: {stat._max.accessedAt?.toDateString()}</p>
|
||||
<p>Last Visit: {stat._max.accessedAt?.toLocaleString()}</p>
|
||||
</div>))}
|
||||
|
||||
{/* <h2>All Visits</h2>
|
||||
{page.stat.map((stat) => (<div className="my-5" key={stat.uuid}>
|
||||
<p>{stat.accessedAt.toDateString()}</p>
|
||||
<p>{stat.userAgent}</p>
|
||||
<p style={{ color: hashToColor(stat.hash) }}>{stat.hash}</p>
|
||||
</div>))} */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
"use client"
|
||||
|
||||
import { LineChart as RechartsLineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
|
||||
|
||||
interface LineChartProps {
|
||||
data: {
|
||||
date: string;
|
||||
clicks: number;
|
||||
}[];
|
||||
}
|
||||
|
||||
export default function LineChart({ data }: LineChartProps) {
|
||||
return (
|
||||
<div className="w-full h-[300px] mt-5">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<RechartsLineChart data={data}>
|
||||
<CartesianGrid strokeDasharray="3 3" stroke="#374151" />
|
||||
<XAxis
|
||||
dataKey="date"
|
||||
stroke="#9CA3AF"
|
||||
tickFormatter={(value: string) => new Date(value).toLocaleDateString()}
|
||||
/>
|
||||
<YAxis
|
||||
stroke="#9CA3AF"
|
||||
allowDecimals={false}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: '#1F2937',
|
||||
border: 'none',
|
||||
borderRadius: '0.5rem',
|
||||
color: '#9CA3AF'
|
||||
}}
|
||||
labelFormatter={(value: string) => new Date(value).toLocaleDateString()}
|
||||
/>
|
||||
<Line
|
||||
type="monotone"
|
||||
dataKey="clicks"
|
||||
stroke="#10B981"
|
||||
strokeWidth={2}
|
||||
dot={{ fill: '#10B981', strokeWidth: 2 }}
|
||||
/>
|
||||
</RechartsLineChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
"use client"
|
||||
|
||||
import { deletePageStats } from "@/actions/page_actions";
|
||||
import { useActionState, useEffect } from "react";
|
||||
import SubmitButton from "../SubmitButton";
|
||||
import { handleToast } from "@/utils";
|
||||
import { ArrowPathIcon } from "@heroicons/react/24/solid";
|
||||
|
||||
export default function ResetStatsForm({ uuid }: { uuid: string }) {
|
||||
const initialState = {
|
||||
message: "",
|
||||
error: {}
|
||||
};
|
||||
|
||||
const [state, formAction] = useActionState(deletePageStats, initialState);
|
||||
|
||||
useEffect(() => { handleToast(state); }, [state]);
|
||||
|
||||
return (
|
||||
<form action={formAction}>
|
||||
<input type="hidden" name="uuid" value={uuid} />
|
||||
<SubmitButton><ArrowPathIcon className="button-icon" /></SubmitButton>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user