diff --git a/.env b/.env
new file mode 100644
index 0000000..6356bc8
--- /dev/null
+++ b/.env
@@ -0,0 +1,3 @@
+NEXT_PUBLIC_API_URL = https://api-staging.constructapp.team
+NEXT_PUBLIC_PORT = 3000
+NEXT_ENCRYPTION_KEY = IBNU
\ No newline at end of file
diff --git a/next.config.js b/next.config.js
index 767719f..20419fd 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,4 +1,28 @@
/** @type {import('next').NextConfig} */
-const nextConfig = {}
+const nextConfig = {
+ images: {
+ domains: ["via.placeholder.com"],
+ remotePatterns: [
+ {
+ protocol: "https",
+ hostname: "via.placeholder.com",
+ port: "",
+ pathname: "/dashboard",
+ },
+ ],
+ },
+ // serverMiddleware: [
+ // {
+ // path: "/dashboard",
+ // handler: require.resolve("./src/app/middleware.tsx"), // Sesuaikan dengan lokasi middleware Anda
+ // },
+ // ],
+ serverMiddleware: [
+ {
+ path: "/dashboard",
+ handler: "./src/app/middleware.tsx",
+ },
+ ],
+};
-module.exports = nextConfig
+module.exports = nextConfig;
diff --git a/package-lock.json b/package-lock.json
index 12177b1..9bc04d2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,12 +8,16 @@
"name": "ta-fe-new",
"version": "0.1.0",
"dependencies": {
+ "@react-spring/web": "^9.7.3",
"@reduxjs/toolkit": "^1.9.5",
"axios": "^1.4.0",
- "boostrap": "^2.0.0",
+ "bootstrap": "^5.3.2",
"chart.js": "^4.3.0",
+ "crypto-js": "^4.1.1",
"js-cookie": "^3.0.5",
+ "moment": "^2.29.4",
"next": "13.5.4",
+ "next-auth": "^4.23.2",
"react": "^18",
"react-bootstrap": "^2.9.0",
"react-chartjs-2": "^5.2.0",
@@ -27,6 +31,7 @@
"sass-loader": "^13.2.2"
},
"devDependencies": {
+ "@types/crypto-js": "^4.1.2",
"@types/js-cookie": "^3.0.3",
"@types/node": "^20",
"@types/react": "^18",
@@ -393,6 +398,14 @@
"node": ">= 8"
}
},
+ "node_modules/@panva/hkdf": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@panva/hkdf/-/hkdf-1.1.1.tgz",
+ "integrity": "sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA==",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
"node_modules/@popperjs/core": {
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -416,6 +429,66 @@
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
}
},
+ "node_modules/@react-spring/animated": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.7.3.tgz",
+ "integrity": "sha512-5CWeNJt9pNgyvuSzQH+uy2pvTg8Y4/OisoscZIR8/ZNLIOI+CatFBhGZpDGTF/OzdNFsAoGk3wiUYTwoJ0YIvw==",
+ "dependencies": {
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/@react-spring/core": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/core/-/core-9.7.3.tgz",
+ "integrity": "sha512-IqFdPVf3ZOC1Cx7+M0cXf4odNLxDC+n7IN3MDcVCTIOSBfqEcBebSv+vlY5AhM0zw05PDbjKrNmBpzv/AqpjnQ==",
+ "dependencies": {
+ "@react-spring/animated": "~9.7.3",
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/react-spring/donate"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/@react-spring/shared": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/shared/-/shared-9.7.3.tgz",
+ "integrity": "sha512-NEopD+9S5xYyQ0pGtioacLhL2luflh6HACSSDUZOwLHoxA5eku1UPuqcJqjwSD6luKjjLfiLOspxo43FUHKKSA==",
+ "dependencies": {
+ "@react-spring/types": "~9.7.3"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/@react-spring/types": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/types/-/types-9.7.3.tgz",
+ "integrity": "sha512-Kpx/fQ/ZFX31OtlqVEFfgaD1ACzul4NksrvIgYfIFq9JpDHFwQkMVZ10tbo0FU/grje4rcL4EIrjekl3kYwgWw=="
+ },
+ "node_modules/@react-spring/web": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/web/-/web-9.7.3.tgz",
+ "integrity": "sha512-BXt6BpS9aJL/QdVqEIX9YoUy8CE6TJrU0mNCqSoxdXlIeNcEBWOfIyE6B14ENNsyQKS3wOWkiJfco0tCr/9tUg==",
+ "dependencies": {
+ "@react-spring/animated": "~9.7.3",
+ "@react-spring/core": "~9.7.3",
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/@reduxjs/toolkit": {
"version": "1.9.7",
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.7.tgz",
@@ -492,6 +565,12 @@
"tslib": "^2.4.0"
}
},
+ "node_modules/@types/crypto-js": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.2.tgz",
+ "integrity": "sha512-t33RNmTu5ufG/sorROIafiCVJMx3jz95bXUMoPAZcUD14fxMXnuTzqzXZoxpR0tNx2xpw11Dlmem9vGCsrSOfA==",
+ "dev": true
+ },
"node_modules/@types/eslint": {
"version": "8.44.3",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.3.tgz",
@@ -1177,11 +1256,23 @@
"node": ">=8"
}
},
- "node_modules/boostrap": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/boostrap/-/boostrap-2.0.0.tgz",
- "integrity": "sha512-JEeFMOweKeGXEM9rt95eaVISOkluG9aKcl0jQCETOVH9jynCZxuBZe2oWgcWJpj5wqYWZl625SnW7OgHT2Ineg==",
- "deprecated": "Package no longer supported. Contact support@npmjs.com for more info."
+ "node_modules/bootstrap": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.2.tgz",
+ "integrity": "sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/twbs"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/bootstrap"
+ }
+ ],
+ "peerDependencies": {
+ "@popperjs/core": "^2.11.8"
+ }
},
"node_modules/brace-expansion": {
"version": "1.1.11",
@@ -1426,6 +1517,14 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "node_modules/cookie": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -1440,6 +1539,11 @@
"node": ">= 8"
}
},
+ "node_modules/crypto-js": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
+ "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
+ },
"node_modules/csstype": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
@@ -3065,6 +3169,14 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
+ "node_modules/jose": {
+ "version": "4.15.2",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.2.tgz",
+ "integrity": "sha512-IY73F228OXRl9ar3jJagh7Vnuhj/GzBunPiZP13K0lOl7Am9SoWW3kEzq3MCllJMTtZqHTiDXQvoRd4U95aU6A==",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
"node_modules/js-cookie": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
@@ -3242,7 +3354,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
- "dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -3318,6 +3429,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -3397,6 +3516,33 @@
}
}
},
+ "node_modules/next-auth": {
+ "version": "4.23.2",
+ "resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.23.2.tgz",
+ "integrity": "sha512-VRmInu0r/yZNFQheDFeOKtiugu3bt90Po3owAQDnFQ3YLQFmUKgFjcE2+3L0ny5jsJpBXaKbm7j7W2QTc6Ye2A==",
+ "dependencies": {
+ "@babel/runtime": "^7.20.13",
+ "@panva/hkdf": "^1.0.2",
+ "cookie": "^0.5.0",
+ "jose": "^4.11.4",
+ "oauth": "^0.9.15",
+ "openid-client": "^5.4.0",
+ "preact": "^10.6.3",
+ "preact-render-to-string": "^5.1.19",
+ "uuid": "^8.3.2"
+ },
+ "peerDependencies": {
+ "next": "^12.2.5 || ^13",
+ "nodemailer": "^6.6.5",
+ "react": "^17.0.2 || ^18",
+ "react-dom": "^17.0.2 || ^18"
+ },
+ "peerDependenciesMeta": {
+ "nodemailer": {
+ "optional": true
+ }
+ }
+ },
"node_modules/node-releases": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@@ -3411,6 +3557,11 @@
"node": ">=0.10.0"
}
},
+ "node_modules/oauth": {
+ "version": "0.9.15",
+ "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",
+ "integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA=="
+ },
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -3419,6 +3570,14 @@
"node": ">=0.10.0"
}
},
+ "node_modules/object-hash": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
@@ -3528,6 +3687,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/oidc-token-hash": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz",
+ "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==",
+ "engines": {
+ "node": "^10.13.0 || >=12.0.0"
+ }
+ },
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -3537,6 +3704,20 @@
"wrappy": "1"
}
},
+ "node_modules/openid-client": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.0.tgz",
+ "integrity": "sha512-uFTkN/iqgKvSnmpVAS/T6SNThukRMBcmymTQ71Ngus1F60tdtKVap7zCrleocY+fogPtpmoxi5Q1YdrgYuTlkA==",
+ "dependencies": {
+ "jose": "^4.15.1",
+ "lru-cache": "^6.0.0",
+ "object-hash": "^2.2.0",
+ "oidc-token-hash": "^5.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
"node_modules/optionator": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
@@ -3681,6 +3862,26 @@
"node": "^10 || ^12 || >=14"
}
},
+ "node_modules/preact": {
+ "version": "10.18.1",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.18.1.tgz",
+ "integrity": "sha512-mKUD7RRkQQM6s7Rkmi7IFkoEHjuFqRQUaXamO61E6Nn7vqF/bo7EZCmSyrUnp2UWHw0O7XjZ2eeXis+m7tf4lg==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/preact"
+ }
+ },
+ "node_modules/preact-render-to-string": {
+ "version": "5.2.6",
+ "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-5.2.6.tgz",
+ "integrity": "sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==",
+ "dependencies": {
+ "pretty-format": "^3.8.0"
+ },
+ "peerDependencies": {
+ "preact": ">=10"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -3690,6 +3891,11 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/pretty-format": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",
+ "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
@@ -4807,6 +5013,14 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
+ "node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/warning": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
@@ -5005,8 +5219,7 @@
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/yocto-queue": {
"version": "0.1.0",
@@ -5245,6 +5458,11 @@
"fastq": "^1.6.0"
}
},
+ "@panva/hkdf": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@panva/hkdf/-/hkdf-1.1.1.tgz",
+ "integrity": "sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA=="
+ },
"@popperjs/core": {
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -5258,6 +5476,49 @@
"@swc/helpers": "^0.5.0"
}
},
+ "@react-spring/animated": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.7.3.tgz",
+ "integrity": "sha512-5CWeNJt9pNgyvuSzQH+uy2pvTg8Y4/OisoscZIR8/ZNLIOI+CatFBhGZpDGTF/OzdNFsAoGk3wiUYTwoJ0YIvw==",
+ "requires": {
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ }
+ },
+ "@react-spring/core": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/core/-/core-9.7.3.tgz",
+ "integrity": "sha512-IqFdPVf3ZOC1Cx7+M0cXf4odNLxDC+n7IN3MDcVCTIOSBfqEcBebSv+vlY5AhM0zw05PDbjKrNmBpzv/AqpjnQ==",
+ "requires": {
+ "@react-spring/animated": "~9.7.3",
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ }
+ },
+ "@react-spring/shared": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/shared/-/shared-9.7.3.tgz",
+ "integrity": "sha512-NEopD+9S5xYyQ0pGtioacLhL2luflh6HACSSDUZOwLHoxA5eku1UPuqcJqjwSD6luKjjLfiLOspxo43FUHKKSA==",
+ "requires": {
+ "@react-spring/types": "~9.7.3"
+ }
+ },
+ "@react-spring/types": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/types/-/types-9.7.3.tgz",
+ "integrity": "sha512-Kpx/fQ/ZFX31OtlqVEFfgaD1ACzul4NksrvIgYfIFq9JpDHFwQkMVZ10tbo0FU/grje4rcL4EIrjekl3kYwgWw=="
+ },
+ "@react-spring/web": {
+ "version": "9.7.3",
+ "resolved": "https://registry.npmjs.org/@react-spring/web/-/web-9.7.3.tgz",
+ "integrity": "sha512-BXt6BpS9aJL/QdVqEIX9YoUy8CE6TJrU0mNCqSoxdXlIeNcEBWOfIyE6B14ENNsyQKS3wOWkiJfco0tCr/9tUg==",
+ "requires": {
+ "@react-spring/animated": "~9.7.3",
+ "@react-spring/core": "~9.7.3",
+ "@react-spring/shared": "~9.7.3",
+ "@react-spring/types": "~9.7.3"
+ }
+ },
"@reduxjs/toolkit": {
"version": "1.9.7",
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.7.tgz",
@@ -5315,6 +5576,12 @@
"tslib": "^2.4.0"
}
},
+ "@types/crypto-js": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.2.tgz",
+ "integrity": "sha512-t33RNmTu5ufG/sorROIafiCVJMx3jz95bXUMoPAZcUD14fxMXnuTzqzXZoxpR0tNx2xpw11Dlmem9vGCsrSOfA==",
+ "dev": true
+ },
"@types/eslint": {
"version": "8.44.3",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.3.tgz",
@@ -5876,10 +6143,11 @@
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
},
- "boostrap": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/boostrap/-/boostrap-2.0.0.tgz",
- "integrity": "sha512-JEeFMOweKeGXEM9rt95eaVISOkluG9aKcl0jQCETOVH9jynCZxuBZe2oWgcWJpj5wqYWZl625SnW7OgHT2Ineg=="
+ "bootstrap": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.2.tgz",
+ "integrity": "sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==",
+ "requires": {}
},
"brace-expansion": {
"version": "1.1.11",
@@ -6045,6 +6313,11 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "cookie": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw=="
+ },
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -6056,6 +6329,11 @@
"which": "^2.0.1"
}
},
+ "crypto-js": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
+ "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
+ },
"csstype": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
@@ -7254,6 +7532,11 @@
}
}
},
+ "jose": {
+ "version": "4.15.2",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.2.tgz",
+ "integrity": "sha512-IY73F228OXRl9ar3jJagh7Vnuhj/GzBunPiZP13K0lOl7Am9SoWW3kEzq3MCllJMTtZqHTiDXQvoRd4U95aU6A=="
+ },
"js-cookie": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
@@ -7404,7 +7687,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
- "dev": true,
"requires": {
"yallist": "^4.0.0"
}
@@ -7459,6 +7741,11 @@
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true
},
+ "moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
+ },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -7504,6 +7791,22 @@
"watchpack": "2.4.0"
}
},
+ "next-auth": {
+ "version": "4.23.2",
+ "resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.23.2.tgz",
+ "integrity": "sha512-VRmInu0r/yZNFQheDFeOKtiugu3bt90Po3owAQDnFQ3YLQFmUKgFjcE2+3L0ny5jsJpBXaKbm7j7W2QTc6Ye2A==",
+ "requires": {
+ "@babel/runtime": "^7.20.13",
+ "@panva/hkdf": "^1.0.2",
+ "cookie": "^0.5.0",
+ "jose": "^4.11.4",
+ "oauth": "^0.9.15",
+ "openid-client": "^5.4.0",
+ "preact": "^10.6.3",
+ "preact-render-to-string": "^5.1.19",
+ "uuid": "^8.3.2"
+ }
+ },
"node-releases": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@@ -7515,11 +7818,21 @@
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
},
+ "oauth": {
+ "version": "0.9.15",
+ "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",
+ "integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA=="
+ },
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
},
+ "object-hash": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="
+ },
"object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
@@ -7599,6 +7912,11 @@
"es-abstract": "^1.22.1"
}
},
+ "oidc-token-hash": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz",
+ "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw=="
+ },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -7608,6 +7926,17 @@
"wrappy": "1"
}
},
+ "openid-client": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.0.tgz",
+ "integrity": "sha512-uFTkN/iqgKvSnmpVAS/T6SNThukRMBcmymTQ71Ngus1F60tdtKVap7zCrleocY+fogPtpmoxi5Q1YdrgYuTlkA==",
+ "requires": {
+ "jose": "^4.15.1",
+ "lru-cache": "^6.0.0",
+ "object-hash": "^2.2.0",
+ "oidc-token-hash": "^5.0.3"
+ }
+ },
"optionator": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
@@ -7699,12 +8028,30 @@
"source-map-js": "^1.0.2"
}
},
+ "preact": {
+ "version": "10.18.1",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.18.1.tgz",
+ "integrity": "sha512-mKUD7RRkQQM6s7Rkmi7IFkoEHjuFqRQUaXamO61E6Nn7vqF/bo7EZCmSyrUnp2UWHw0O7XjZ2eeXis+m7tf4lg=="
+ },
+ "preact-render-to-string": {
+ "version": "5.2.6",
+ "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-5.2.6.tgz",
+ "integrity": "sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==",
+ "requires": {
+ "pretty-format": "^3.8.0"
+ }
+ },
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
+ "pretty-format": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",
+ "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="
+ },
"prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
@@ -8426,6 +8773,11 @@
"integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
"requires": {}
},
+ "uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
+ },
"warning": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
@@ -8575,8 +8927,7 @@
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"yocto-queue": {
"version": "0.1.0",
diff --git a/package.json b/package.json
index a0dea33..ead3730 100644
--- a/package.json
+++ b/package.json
@@ -9,12 +9,16 @@
"lint": "next lint"
},
"dependencies": {
+ "@react-spring/web": "^9.7.3",
"@reduxjs/toolkit": "^1.9.5",
"axios": "^1.4.0",
- "boostrap": "^2.0.0",
+ "bootstrap": "^5.3.2",
"chart.js": "^4.3.0",
+ "crypto-js": "^4.1.1",
"js-cookie": "^3.0.5",
+ "moment": "^2.29.4",
"next": "13.5.4",
+ "next-auth": "^4.23.2",
"react": "^18",
"react-bootstrap": "^2.9.0",
"react-chartjs-2": "^5.2.0",
@@ -28,6 +32,7 @@
"sass-loader": "^13.2.2"
},
"devDependencies": {
+ "@types/crypto-js": "^4.1.2",
"@types/js-cookie": "^3.0.3",
"@types/node": "^20",
"@types/react": "^18",
diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx
index d36c8ba..514601d 100644
--- a/src/app/dashboard/layout.tsx
+++ b/src/app/dashboard/layout.tsx
@@ -1,20 +1,42 @@
-import React, { useState } from "react";
+"use client";
+
+import React, { useEffect, useState } from "react";
import { Nav, Collapse, Navbar, Dropdown } from "react-bootstrap";
-import { useRouter } from "next/router";
+import { usePathname, useRouter } from "next/navigation";
import Logo from "@/assets/svg/Logo.svg";
import Link from "next/link";
import Image from "next/image";
-import styles from "./layout.module.scss";
+import styles from "@/styles/dashboard.module.scss";
+import { useAppDispatch } from "@/redux/store";
+import { logoutRequest } from "@/redux/actions/AuthenticationAction";
+// import { privateMiddleware } from "@/middleware/authMiddleware";
+import { getCredential } from "@/helpers/Utils";
+import Loader from "@/components/Organisms/Loader";
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}): JSX.Element {
- const router = useRouter();
+ const pathname = usePathname();
+ const dispatch = useAppDispatch();
+
+ const middleware = getCredential();
+ const navigate = useRouter();
+
+ // TODO:MIDDLEWARE
+ useEffect(() => {
+ if (middleware === null) {
+ navigate.push("/login");
+ }
+ }, []);
+
+ const handleLogout = () => {
+ dispatch(logoutRequest());
+ };
const [adminMenu, setAdminMenu] = useState([
{
@@ -37,10 +59,10 @@ export default function DashboardLayout({
),
name: "Dashboard",
- url: "/",
+ url: "/dashboard",
isDropdown: false,
isCollapse: false,
- active: ["/"],
+ active: ["/dashboard"],
subItems: [],
},
{
@@ -67,31 +89,31 @@ export default function DashboardLayout({
isDropdown: true,
isCollapse: false,
active: [
- "/leads-overzicht",
- "/niuewe-leads",
- "/creditaties",
- "/lead-toevoegen",
+ "/dashboard/leads-overzicht",
+ "/dashboard/niuewe-leads",
+ "/dashboard/creditaties",
+ "/dashboard/lead-toevoegen",
],
subItems: [
{
id: 21,
name: "Leads Overzicht",
- url: "/leads-overzicht",
+ url: "/dashboard/leads-overzicht",
},
{
id: 22,
name: "Niuewe Leads",
- url: "/niuewe-leads",
+ url: "/dashboard/niuewe-leads",
},
{
id: 23,
name: "Creditaties",
- url: "/creditaties",
+ url: "/dashboard/creditaties",
},
{
id: 24,
name: "Lead Toevoegen",
- url: "/lead-toevoegen",
+ url: "/dashboard/lead-toevoegen",
},
],
},
@@ -118,22 +140,26 @@ export default function DashboardLayout({
url: "#",
isCollapse: false,
isDropdown: true,
- active: ["/bedrijfsoverzicht", "/dubbel-accounts", "uitgezette-accounts"],
+ active: [
+ "/dashboard/bedrijfsoverzicht",
+ "/dashboard/dubbel-accounts",
+ "/dashboard/uitgezette-accounts",
+ ],
subItems: [
{
id: 31,
name: "Bedrijfsoverzicht",
- url: "/bedrijfsoverzicht",
+ url: "/dashboard/bedrijfsoverzicht",
},
{
id: 32,
name: "Dubbel Accounts",
- url: "/dubbel-accounts",
+ url: "/dashboard/dubbel-accounts",
},
{
id: 33,
name: "Uitgezette Accounts",
- url: "/uitgezette-accounts",
+ url: "/dashboard/uitgezette-accounts",
},
],
},
@@ -157,10 +183,10 @@ export default function DashboardLayout({
),
name: "Bellijst",
- url: "/bellijst",
+ url: "/dashboard/bellijst",
isCollapse: false,
isDropdown: false,
- active: ["/bellijst"],
+ active: ["dashboard/bellijst"],
subItems: [],
},
{
@@ -186,12 +212,12 @@ export default function DashboardLayout({
url: "#",
isCollapse: false,
isDropdown: true,
- active: ["/overzicht"],
+ active: ["/dashboard/overzicht"],
subItems: [
{
id: 51,
name: "Overzicht",
- url: "/overzicht",
+ url: "/dashboard/overzicht",
},
],
},
@@ -223,38 +249,38 @@ export default function DashboardLayout({
{
id: 61,
name: "Branches",
- url: "/branches",
+ url: "/dashboard/branches",
},
{
id: 62,
name: "Werkzaamheden",
- url: "/werkzaamheden",
+ url: "/dashboard/werkzaamheden",
},
// {
// id: 43,
// name: "Add Leads",
- // url: "/add-leads",
+ // url: "/dashboard/add-leads",
// },
// {
// id: 45,
// name: "Creditaties",
- // url: "/credit-management",
+ // url: "/dashboard/credit-management",
// },
// {
// id: 46,
// name: "Formulate",
- // url: "/formulate",
+ // url: "/dashboard/formulate",
// },
// {
// id: 47,
// name: "Statistics",
- // url: "/statistics",
+ // url: "/dashboard/statistics",
// },
// {
// id: 48,
// name: "Open Invoices",
- // url: "/open-invoices",
+ // url: "/dashboard/open-invoices",
// },
],
},
@@ -286,12 +312,12 @@ export default function DashboardLayout({
{
id: 71,
name: "Leads",
- url: "/leads",
+ url: "/dashboard/leads",
},
{
id: 72,
name: "Omzet",
- url: "/omzet",
+ url: "/dashboard/omzet",
},
],
},
@@ -354,9 +380,7 @@ export default function DashboardLayout({
as={Link}
href={item.url}
className={`${styles["nav-link"]} ${
- item.active.includes(router.pathname)
- ? `${styles["active"]}`
- : ""
+ item.active.includes(pathname) ? `${styles["active"]}` : ""
}`}
>
{item.icon}
@@ -371,7 +395,7 @@ export default function DashboardLayout({
className={`d-flex justify-content-between align-items-center ${
styles["nav-link"]
} ${
- item.active.includes(router.pathname)
+ item.active.includes(pathname)
? `${styles["active"]}`
: ""
}`}
@@ -436,7 +460,7 @@ export default function DashboardLayout({
onClick={() => handleCollapse(item.id)}
className={`${styles["nav-link"]}
${
- subItem.url === router.pathname
+ subItem.url === pathname
? `${styles["active"]}`
: ""
}
@@ -497,7 +521,10 @@ export default function DashboardLayout({
- Vul hieronder je gegevens in om in te loggen. -
-+ Vul hieronder je gegevens in om in te loggen. +
+