From 0b4256e98f8db08f132c84a389a4839798f8fea8 Mon Sep 17 00:00:00 2001 From: Natacha De la Rosa Date: Mon, 4 Jul 2022 17:25:56 -0400 Subject: [PATCH 1/6] feat(banner): add top banner to site --- .../layout/components/header/HeaderBanner.tsx | 22 +++++++++++++++++++ .../components/header/HeaderWrapper.tsx | 14 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/_start/layout/components/header/HeaderBanner.tsx diff --git a/src/_start/layout/components/header/HeaderBanner.tsx b/src/_start/layout/components/header/HeaderBanner.tsx new file mode 100644 index 0000000..5c82bf7 --- /dev/null +++ b/src/_start/layout/components/header/HeaderBanner.tsx @@ -0,0 +1,22 @@ +import React, { useState, FC } from "react"; + +const HeaderBanner: FC = ({ children }) => { + const [showHeader, setShowHeader] = useState(true); + + const handleBanner = () => { + setShowHeader(false); + }; + + return showHeader ? ( +
+
+ {children} +
+ +
+ ) : null; +}; + +export default HeaderBanner; diff --git a/src/_start/layout/components/header/HeaderWrapper.tsx b/src/_start/layout/components/header/HeaderWrapper.tsx index 7290aa3..f026463 100644 --- a/src/_start/layout/components/header/HeaderWrapper.tsx +++ b/src/_start/layout/components/header/HeaderWrapper.tsx @@ -2,6 +2,7 @@ import React from "react"; import { IThemeCSSClasses, useTheme } from "../../core"; import { Header } from "./Header"; +import HeaderBanner from "./HeaderBanner"; type Props = { classes: IThemeCSSClasses; @@ -54,6 +55,19 @@ export function HeaderWrapper() { const { header } = config; return ( <> + +

+ Support our Aletheia on{" "} + + GitCoin Grants + +

+
{header.fixed.desktop && header.fixed.tabletAndMobile && ( )} From e2b01c694c65061827fdbabcfc7d5a14a095169c Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Mon, 4 Jul 2022 18:50:18 -0400 Subject: [PATCH 2/6] small style and copy changes --- .../assets/sass/components/_banner.scss | 19 +++++++++++++++++++ .../assets/sass/components/components.scss | 1 + .../layout/components/header/HeaderBanner.tsx | 2 +- .../components/header/HeaderWrapper.tsx | 10 +++++----- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 src/_start/assets/sass/components/_banner.scss diff --git a/src/_start/assets/sass/components/_banner.scss b/src/_start/assets/sass/components/_banner.scss new file mode 100644 index 0000000..e343482 --- /dev/null +++ b/src/_start/assets/sass/components/_banner.scss @@ -0,0 +1,19 @@ +.banner{ + text-align: center; + padding: 0 20px; + + h3 { + font-size: small; + color: $primary-light; + margin: 0; + } + + a { + color: $primary-light; + text-decoration: underline; + } + + a:hover { + text-decoration: none; + } +} \ No newline at end of file diff --git a/src/_start/assets/sass/components/components.scss b/src/_start/assets/sass/components/components.scss index 3f5a0a4..b90013d 100644 --- a/src/_start/assets/sass/components/components.scss +++ b/src/_start/assets/sass/components/components.scss @@ -1,6 +1,7 @@ // // Components @import "./_clipboard"; +@import "_banner"; // // Import Dependencies diff --git a/src/_start/layout/components/header/HeaderBanner.tsx b/src/_start/layout/components/header/HeaderBanner.tsx index 5c82bf7..eadd76a 100644 --- a/src/_start/layout/components/header/HeaderBanner.tsx +++ b/src/_start/layout/components/header/HeaderBanner.tsx @@ -8,7 +8,7 @@ const HeaderBanner: FC = ({ children }) => { }; return showHeader ? ( -
+
{children}
diff --git a/src/_start/layout/components/header/HeaderWrapper.tsx b/src/_start/layout/components/header/HeaderWrapper.tsx index f026463..1dae44d 100644 --- a/src/_start/layout/components/header/HeaderWrapper.tsx +++ b/src/_start/layout/components/header/HeaderWrapper.tsx @@ -56,15 +56,15 @@ export function HeaderWrapper() { return ( <> -

- Support our Aletheia on{" "} +

+ Please note that this is a beta version of our system. Don't forget to + support our effort on{" "} - GitCoin Grants + Open Collective

From 9177532c296c07a850fccd37516ab3782e051849 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Mon, 4 Jul 2022 19:03:54 -0400 Subject: [PATCH 3/6] fix loader on stats --- .../partials/components/Stats/index.tsx | 252 +++++++++--------- 1 file changed, 128 insertions(+), 124 deletions(-) diff --git a/src/_start/partials/components/Stats/index.tsx b/src/_start/partials/components/Stats/index.tsx index 745486f..8c36f48 100644 --- a/src/_start/partials/components/Stats/index.tsx +++ b/src/_start/partials/components/Stats/index.tsx @@ -14,15 +14,20 @@ type Props = { }; // TODO: move to global -const colorPDF = '#F1416C'; -const colorCSV = '#FFC700'; -const colorXLS = '#20D489'; -const colorODS = '#A2A7F7'; -const colorOTHER = '#00A3FF'; - -const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => { +const colorPDF = "#F1416C"; +const colorCSV = "#FFC700"; +const colorXLS = "#20D489"; +const colorODS = "#A2A7F7"; +const colorOTHER = "#00A3FF"; + +const Stats: React.FC = ({ + id, + title, + className, + innerPadding = "", +}) => { const [activeTab, setActiveTab] = useState(`#${id}_tab1`); - const [activeTabTotal, setActiveTabTotal] = useState(''); + const [activeTabTotal, setActiveTabTotal] = useState(""); const [activeChart, setActiveChart] = useState(); const [items, setItems] = useState([{}]); @@ -38,53 +43,52 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => activeChart.destroy(); } }; - }, [items]); - useEffect(()=>{ - + useEffect(() => { let entity; switch (id) { - case 'src': - entity = 'sources' + case "src": + entity = "sources"; break; - case 'dep': - entity = 'departments' + case "dep": + entity = "departments"; break; - case 'cat': - entity = 'categories' + case "cat": + entity = "categories"; break; default: - return + return; } - fetch(`${process.env.REACT_APP_ALETHEIA_API}/v1/api/${entity}/getAll?limit=5`, { - method: 'get', - headers: { - 'Access-Control-Request-Headers': '*' + fetch( + `${process.env.REACT_APP_ALETHEIA_API}/v1/api/${entity}/getAll?limit=5`, + { + method: "get", + headers: { + "Access-Control-Request-Headers": "*", + }, } - }) - .then(res => { - return res.json() - }) - .then(newData => { - const body = JSON.parse(newData.body) - setItems(body); - setLoading(false); - }) - .catch(err => { - console.log(err) - setLoading(false); - }); - - }, []) + ) + .then((res) => { + return res.json(); + }) + .then((newData) => { + const body = JSON.parse(newData.body); + setItems(body); + setLoading(false); + }) + .catch((err) => { + console.log(err); + setLoading(false); + }); + }, []); const getFilesType = (item: string, id: string) => { return new Promise((resolve, reject) => { - let query; switch (item) { - case 'cat': + case "cat": query = ` query TypeGroupBy { alexandriasConnection(where: { @@ -105,7 +109,7 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => } `; break; - case 'dep': + case "dep": query = ` query TypeGroupBy { alexandriasConnection(where: { @@ -126,7 +130,7 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => } `; break; - case 'src': + case "src": query = ` query TypeGroupBy { alexandriasConnection(where: { @@ -151,30 +155,28 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => const endpoint = `${process.env.REACT_APP_API_ENDPOINT}/graphql`; // console.log('fetching data: ', endpoint) fetch(endpoint, { - method: 'post', + method: "post", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, body: JSON.stringify({ - query: query - }) + query: query, + }), }) - .then(response => response.json()) - .then(data => { - //console.log(data) + .then((response) => response.json()) + .then((data) => { + console.log(data); resolve(data); }) - .catch(err => { - console.log(err) + .catch((err) => { + console.log(err); reject(err); }); - }); - } - - const setTab = (items:any, tab_n: number) => { + }; - setActiveTabTotal('') + const setTab = (items: any, tab_n: number) => { + setActiveTabTotal(""); if (activeChart) { activeChart.destroy(); @@ -187,49 +189,52 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => ) as HTMLElement; if (element) { - element.innerHTML = ''; + element.innerHTML = ""; } if (!element) return; - let item:any = items[tab_n - 1]; + let item: any = items[tab_n - 1]; getFilesType(id, item._id) .then((res: any) => { const types = res.data.alexandriasConnection.groupBy.type; - const pdf = types.filter((type: any) => type.key === 'pdf'); - const csv = types.filter((type: any) => type.key === 'csv'); - const xls = types.filter((type: any) => type.key === 'xls' || type.key === "xlsx"); - const other = types.filter((type: any) => type.key === 'other'); + const pdf = types.filter((type: any) => type.key === "pdf"); + const csv = types.filter((type: any) => type.key === "csv"); + const xls = types.filter( + (type: any) => type.key === "xls" || type.key === "xlsx" + ); + const other = types.filter((type: any) => type.key === "other"); const pdfFile = pdf.length > 0 ? pdf[0].connection.aggregate.count : 0; const csvFile = csv.length > 0 ? csv[0].connection.aggregate.count : 0; const xlsFile = xls.length > 0 ? xls[0].connection.aggregate.count : 0; - const otherFile = other.length > 0 ? other[0].connection.aggregate.count : 0; + const otherFile = + other.length > 0 ? other[0].connection.aggregate.count : 0; - setActiveTabTotal( - pdfFile + csvFile + xlsFile + otherFile - ) + setActiveTabTotal(pdfFile + csvFile + xlsFile + otherFile); const dataCharts = { pdfFile, csvFile, xlsFile, - otherFile + otherFile, }; const height = parseInt(getCss(element, "height")); if (height) { - const chart = new ApexCharts(element, getChartOptions(tab_n, height, dataCharts)); + const chart = new ApexCharts( + element, + getChartOptions(tab_n, height, dataCharts) + ); chart.render(); setActiveChart(chart); } }) - .catch(err => { + .catch((err) => { console.log(err); - }) - + }); }; if (loading) { @@ -239,7 +244,10 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) =>

{title} - + Please wait...{" "} @@ -266,14 +274,14 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => {/* begin::Body */}
- +
{/* end: Card Body */}

- ) + ); } return ( @@ -286,10 +294,7 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) =>
{/* begin::Dropdown */} - + = ({ id, title, className, innerPadding = "" }) => {/* begin::Nav */} - ) - }) - } + ); + })}
{/* end::Nav */} {/* begin::Tab Content */} -
{/* begin::Tab Pane */} - { - items.length > 0 && items.map((item: any, i: number) => { + {items.length > 0 && + items.map((item: any, i: number) => { // console.log(item); let type = id; let entity; switch (type) { - case 'src': + case "src": entity = item.name; break; - case 'dep': + case "dep": entity = item.name; break; - case 'cat': + case "cat": entity = item.title; break; default: @@ -396,18 +404,21 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) => // increase index by 1 i++; const getChart = (index: number) => { - return ( -
- ) - } +
+ ); + }; + console.log(activeTabTotal); + return (
@@ -415,25 +426,26 @@ const Stats: React.FC = ({ id, title, className, innerPadding = "" }) =>
{/* begin::Item */}
- Archivos + + Archivos + - { - !activeTabTotal && - + {activeTabTotal === "" && ( + - } + )} {activeTabTotal}
{/* end::Item */} -
{/* end::Content */} - { - getChart(i) - } + {getChart(i)} = ({ id, title, className, innerPadding = "" }) => {`Ver ${entity}`}
- ) - }) - } + ); + })} {/* end::Tab Pane */} -
{/* end::Tab Content */}
@@ -463,7 +473,6 @@ function getChartOptions( height: string | number | undefined, data: any ): ApexOptions { - let series = [ { name: "PDF", @@ -480,8 +489,8 @@ function getChartOptions( { name: "Others", data: [data.otherFile], - } - ] + }, + ]; return { series: series, @@ -564,20 +573,15 @@ function getChartOptions( fontSize: "12px", }, x: { - show: false + show: false, }, y: { formatter: function (val: number) { return `${val} archivos`; }, - } + }, }, - colors: [ - colorPDF, - colorCSV, - colorXLS, - colorOTHER - ], + colors: [colorPDF, colorCSV, colorXLS, colorOTHER], grid: { borderColor: getCSSVariableValue("--bs-gray-200"), strokeDashArray: 4, From 45db6644cf2ae6f88ecf74c536bf48a51a06898f Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Mon, 4 Jul 2022 19:13:33 -0400 Subject: [PATCH 4/6] added meta tags --- public/index.html | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 29e4562..3588d6d 100644 --- a/public/index.html +++ b/public/index.html @@ -4,10 +4,24 @@ - + + Aletheia Data | We make public information usable + + + + + + + + + + + + + + + + Date: Mon, 4 Jul 2022 19:27:42 -0400 Subject: [PATCH 5/6] fix category link and remove link actions on broken links --- .../helpers/GetCollectionPageColumns.tsx | 45 +++++++---- .../partials/widgets/engage/EngageWidget6.tsx | 78 +++++++++++-------- 2 files changed, 75 insertions(+), 48 deletions(-) diff --git a/src/_start/helpers/GetCollectionPageColumns.tsx b/src/_start/helpers/GetCollectionPageColumns.tsx index 7e166fc..dd4b70e 100644 --- a/src/_start/helpers/GetCollectionPageColumns.tsx +++ b/src/_start/helpers/GetCollectionPageColumns.tsx @@ -23,7 +23,11 @@ export const getCollectionPageColumns = ( className={`text-gray-800 fw-bolder text-hover-primary fs-6 ${ recordItem.cid ? "" : "disabled" }`} - to={recordItem.cid ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` : "#"} + to={ + recordItem.cid + ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` + : "#" + } > {recordItem.name || recordItem.title} @@ -87,18 +91,27 @@ export const getCollectionPageColumns = ( }, { title: "Action", - cells: data?.map((recordItem: Record) => ( - - - - )), + cells: data?.map((recordItem: Record) => { + console.log(recordItem); + + if ( + recordItem.status === "on_line" || + recordItem.status === "under_review" + ) { + return ( + + + + ); + } + }), }, ]; } else { @@ -111,7 +124,11 @@ export const getCollectionPageColumns = ( className={`text-gray-800 fw-bolder text-hover-primary fs-6 ${ recordItem.cid ? "" : "disabled" }`} - to={recordItem.cid ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` : "#"} + to={ + recordItem.cid + ? `/${type}/${entity}/${recordItem.cid}?assetId=${recordItem.id}` + : "#" + } > {recordItem.name || recordItem.title} diff --git a/src/_start/partials/widgets/engage/EngageWidget6.tsx b/src/_start/partials/widgets/engage/EngageWidget6.tsx index b59b195..f3dacbb 100644 --- a/src/_start/partials/widgets/engage/EngageWidget6.tsx +++ b/src/_start/partials/widgets/engage/EngageWidget6.tsx @@ -126,30 +126,36 @@ const EngageWidget6: React.FC = ({ {/*begin::Info*/} - - - - - - - - - - - - + {data?.source?.id && ( + + + + + )} + {data?.department?.id && ( + + + + + )} + {data?.category?.id && ( + + + + + )} {proof && ( @@ -164,16 +170,20 @@ const EngageWidget6: React.FC = ({ )} - - - - - - - - + {data.type && ( + + + + + )} + {data.updatedAt && ( + + + + + )}
Fuente - - {data.source?.name} - -
Ministerio - - {data.department?.name} - -
Categoria - - {data.category?.title} - -
Fuente + + {data.source?.name} + +
Ministerio + + {data.department?.name} + +
Categoria + + {data.category?.title} + +
Prueba
Formato{data.type}
Ultimo Archivo - {moment(data.updatedAt).format("DD/MM/YYYY")} -
Formato{data.type}
Ultimo Archivo + {moment(data.updatedAt).format("DD/MM/YYYY")} +
Deals From 19e794b276d824110e0fb04fbca3d057f07ef291 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Mon, 4 Jul 2022 19:33:21 -0400 Subject: [PATCH 6/6] release v1.3.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4add621..80bde01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "App-Aletheia-data", - "version": "1.2.8", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 197a018..d6c4da9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "App-Aletheia-data", - "version": "1.2.8", + "version": "1.3.0", "homepage": "/", "repository": { "type": "git",