diff --git a/client/package.json b/client/package.json index 78f1aeeb..acc4fe11 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,7 @@ "sass": "^1.69.5" }, "devDependencies": { - "@types/react": "^18.2.37", + "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", "@vitejs/plugin-react-swc": "^3.5.0", "eslint": "^8.53.0", diff --git a/client/src/assets/styles/_vars.scss b/client/src/assets/styles/_vars.scss index 7186fd13..d5cc3a95 100644 --- a/client/src/assets/styles/_vars.scss +++ b/client/src/assets/styles/_vars.scss @@ -8,4 +8,5 @@ $--Red-700: #C81E1E; $--green-700: #046C4E; $--Yellow-500: #C27803; $--Primary-900: #0e0218; +$--Primary-600: #650DA6; $--text-color: #e2efee; \ No newline at end of file diff --git a/client/src/assets/styles/components/StatisitcTable.scss b/client/src/assets/styles/components/StatisitcTable.scss new file mode 100644 index 00000000..d02bfea9 --- /dev/null +++ b/client/src/assets/styles/components/StatisitcTable.scss @@ -0,0 +1,67 @@ +.table-box { + display: flex; + padding: 30px 4px; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 11px; + + border: 1px solid var(--Primary-600, #650DA6); + width: 90%; + + justify-self: center; + +} + +table { + width: inherit; + +} + +.columns-name-box { + display: flex; + flex-direction: row; + justify-content: end; + +} + +.columns-title-box { + + width: 100%; + display: flex; + flex-direction: row; + direction: rtl; + +} + +.columns-value-box { + display: flex; + flex-direction: column; +} + + +.single-row { + width: 100%; + + direction: rtl; + display: flex; + flex-direction: row; + + padding-bottom: 10px; + + height: fit-content; + +} + +th, +td { + text-align: center; + width: 100px; +} + +.table-outlier { + direction: rtl; + width: 80%; + display: block; + overflow-x: scroll; +} \ No newline at end of file diff --git a/client/src/assets/styles/global/_layout.scss b/client/src/assets/styles/global/_layout.scss index 8a7e7a7e..ca52215c 100644 --- a/client/src/assets/styles/global/_layout.scss +++ b/client/src/assets/styles/global/_layout.scss @@ -21,7 +21,7 @@ section, .col-1 { flex: 0 1 calc(25% - var(--side-spacing) * 2); } - + .col-2 { flex: 0 1 calc(50% - var(--side-spacing) * 2); } @@ -34,3 +34,13 @@ section, flex: 0 1 calc(100% - var(--side-spacing) * 2); } } + +.PopUp { + width: 80%; + height: fit-content; + border-radius: 14px; + background: linear-gradient(115deg, #201429 2.95%, #360C55 95.69%); + + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/client/src/components/common/StatisticTable.jsx b/client/src/components/common/StatisticTable.jsx new file mode 100644 index 00000000..22827bde --- /dev/null +++ b/client/src/components/common/StatisticTable.jsx @@ -0,0 +1,65 @@ +import React from "react"; + +import "../../assets/styles/components/StatisitcTable.scss"; + +const StatisticTable = ({ title, columnNames, dataRows }) => { + const columnsNo = Object.keys(dataRows[0]).length; + + return ( +
+
{title}
+ +
+ + { + + + {columnNames.map((col, index) => { + return ( + + ); + })} + + + } + + + + + + { + +
+ {dataRows.map((row, rowIndex) => ( + // Map over rows +
+ {Object.values(row).map((cell, cellIndex) => ( + // Map over cells within each row + + ))} + + ))} + + + } +
+ {col.name} +
+ {cell} +
+
+
+ ); +}; + +export default StatisticTable; diff --git a/client/src/components/landingpage/LandingPage.jsx b/client/src/components/landingpage/LandingPage.jsx index 0203440c..873a96e7 100644 --- a/client/src/components/landingpage/LandingPage.jsx +++ b/client/src/components/landingpage/LandingPage.jsx @@ -2,9 +2,11 @@ import Button from "../common/Button"; import FancyBlobs from "./FancyBlobs"; +import PageTitle from "../common/PageTitle"; + import "./LandingPage.scss"; -import PageTitle from "../common/PageTitle"; +import TestTable from "../testing/TestTable"; import { FolderIcon, @@ -79,6 +81,9 @@ export default function LandingPage() { + + {/* uncomment to test statistics Table */} + {/* */} ); } diff --git a/client/src/components/landingpage/LandingPage.scss b/client/src/components/landingpage/LandingPage.scss index f7d2be7d..c2c041fc 100644 --- a/client/src/components/landingpage/LandingPage.scss +++ b/client/src/components/landingpage/LandingPage.scss @@ -16,6 +16,7 @@ padding-inline: 5px; line-height: 1.5; } + .btn__container { display: flex; flex-direction: column; @@ -23,7 +24,7 @@ justify-content: center; gap: 20px; - > * { + >* { min-width: 70%; } } @@ -57,7 +58,8 @@ .icon { color: var(--primary-100); - > * { + + >* { width: var(--icon-size); height: var(--icon-size); } @@ -70,3 +72,9 @@ } } } + +.test-box { + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/client/src/components/testing/TestTable.jsx b/client/src/components/testing/TestTable.jsx new file mode 100644 index 00000000..52b05303 --- /dev/null +++ b/client/src/components/testing/TestTable.jsx @@ -0,0 +1,37 @@ +import React from "react"; +import StatisticTable from "../common/StatisticTable"; + +const TestTable = () => { + const columnNames = [ + { name: "الاسم" }, + { name: "النوع" }, + { name: "الحالة" }, + { name: "الوضع" }, + { name: "أهي ماشية" }, + ]; + const dataRows = [ + { + name: "إسماعيل أحمد قنباوي", + type: "ذكر", + status: "مقيد", + }, + + { + name: "يعقوب غيتة", + type: "ذكر", + status: "غير مقيد", + }, + ]; + + return ( +
+ +
+ ); +}; + +export default TestTable; diff --git a/server/database/db.js b/server/database/db.js index 7bb1e1dc..59ff1c3b 100644 --- a/server/database/db.js +++ b/server/database/db.js @@ -1,15 +1,13 @@ -import pg from "pg"; -import dotenv from "dotenv"; +import pg from 'pg' +import dotenv from 'dotenv' -dotenv.config(); -dotenv.config(); +dotenv.config() const db = new pg.Pool({ - host: process.env.DB_HOST, - port: process.env.DB_PORT, - user: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_DATABASE, -}); + host: process.env.DB_HOST, + port: process.env.DB_PORT, + user: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_DATABASE, +}) - -export default db; +export default db