Skip to content
Snippets Groups Projects
Commit 32ad32fc authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 0.54.

parents 223a713f 65d397ae
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [0.54] - 2024-03-05
- Close the menu/sidebar when clicking outside of it
- Fix image download for pages with SVG icons inside the chart container
## [0.53] - 2024-03-04 ## [0.53] - 2024-03-04
- COMP-386/384: Text change - COMP-386/384: Text change
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"chart.js": "^4.2.1", "chart.js": "^4.2.1",
"chartjs-plugin-datalabels": "^2.2.0", "chartjs-plugin-datalabels": "^2.2.0",
"core-js": "^3.26.1", "core-js": "^3.26.1",
"dom-to-image": "^2.6.0", "html-to-image": "^1.11.11",
"install": "^0.13.0", "install": "^0.13.0",
"npm": "^9.2.0", "npm": "^9.2.0",
"react": "^18.2.0", "react": "^18.2.0",
...@@ -5251,11 +5251,6 @@ ...@@ -5251,11 +5251,6 @@
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
} }
}, },
"node_modules/dom-to-image": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/dom-to-image/-/dom-to-image-2.6.0.tgz",
"integrity": "sha512-Dt0QdaHmLpjURjU7Tnu3AgYSF2LuOmksSGsUcE6ItvJoCWTBEmiMXcqBdNSAm9+QbbwD7JMoVsuuKX6ZVQv1qA=="
},
"node_modules/domelementtype": { "node_modules/domelementtype": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
...@@ -7337,6 +7332,11 @@ ...@@ -7337,6 +7332,11 @@
"integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==",
"dev": true "dev": true
}, },
"node_modules/html-to-image": {
"version": "1.11.11",
"resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.11.tgz",
"integrity": "sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA=="
},
"node_modules/http-cache-semantics": { "node_modules/http-cache-semantics": {
"version": "3.8.1", "version": "3.8.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
...@@ -19035,11 +19035,6 @@ ...@@ -19035,11 +19035,6 @@
"entities": "^2.0.0" "entities": "^2.0.0"
} }
}, },
"dom-to-image": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/dom-to-image/-/dom-to-image-2.6.0.tgz",
"integrity": "sha512-Dt0QdaHmLpjURjU7Tnu3AgYSF2LuOmksSGsUcE6ItvJoCWTBEmiMXcqBdNSAm9+QbbwD7JMoVsuuKX6ZVQv1qA=="
},
"domelementtype": { "domelementtype": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
...@@ -20608,6 +20603,11 @@ ...@@ -20608,6 +20603,11 @@
"integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==",
"dev": true "dev": true
}, },
"html-to-image": {
"version": "1.11.11",
"resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.11.tgz",
"integrity": "sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA=="
},
"http-cache-semantics": { "http-cache-semantics": {
"version": "3.8.1", "version": "3.8.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
"chart.js": "^4.2.1", "chart.js": "^4.2.1",
"chartjs-plugin-datalabels": "^2.2.0", "chartjs-plugin-datalabels": "^2.2.0",
"core-js": "^3.26.1", "core-js": "^3.26.1",
"dom-to-image": "^2.6.0", "html-to-image": "^1.11.11",
"install": "^0.13.0", "install": "^0.13.0",
"npm": "^9.2.0", "npm": "^9.2.0",
"react": "^18.2.0", "react": "^18.2.0",
......
import React, { useContext, useState, useRef, useEffect } from 'react'; import React, { useContext, useState, useRef, useEffect } from 'react';
import domtoimage from 'dom-to-image'; import * as htmlToImage from 'html-to-image';
import { ImageType } from "../helpers/constants"; import { ImageType } from "../helpers/constants";
import { ChartContainerContext } from "../helpers/ChartContainerProvider"; import { ChartContainerContext } from "../helpers/ChartContainerProvider";
import { FaDownload } from 'react-icons/fa'; import { FaDownload } from 'react-icons/fa';
...@@ -27,19 +27,19 @@ const DownloadImageChartButton: React.FC<DownloadImageChartProps> = ({ filename ...@@ -27,19 +27,19 @@ const DownloadImageChartButton: React.FC<DownloadImageChartProps> = ({ filename
let dataUrl; let dataUrl;
switch (exportType) { switch (exportType) {
case ImageType.JPEG: case ImageType.JPEG:
dataUrl = await domtoimage.toJpeg(chartContainerRef.current, { dataUrl = await htmlToImage.toJpeg(chartContainerRef.current, {
quality: 0.95, quality: 0.95,
style: commonStyle style: commonStyle
}); });
break; break;
case ImageType.SVG: case ImageType.SVG:
dataUrl = await domtoimage.toSvg(chartContainerRef.current, { dataUrl = await htmlToImage.toSvg(chartContainerRef.current, {
style: commonStyle style: commonStyle
}); });
break; break;
case ImageType.PNG: case ImageType.PNG:
default: default:
dataUrl = await domtoimage.toPng(chartContainerRef.current, { dataUrl = await htmlToImage.toPng(chartContainerRef.current, {
style: commonStyle style: commonStyle
}); });
break; break;
......
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
// import { sidebarContext } from "../helpers/SidebarProvider"; // import { sidebarContext } from "../helpers/SidebarProvider";
import { AiOutlineClose, AiOutlinePlus } from 'react-icons/ai'; import { AiOutlineClose, AiOutlinePlus } from 'react-icons/ai';
...@@ -7,6 +7,8 @@ interface Props { ...@@ -7,6 +7,8 @@ interface Props {
children: React.ReactNode; children: React.ReactNode;
} }
// check if click outside of sidebar, then toggle it
const Sidebar: React.FC<Props> = ({ children }) => { const Sidebar: React.FC<Props> = ({ children }) => {
const [show, setShow] = useState<boolean>(false); const [show, setShow] = useState<boolean>(false);
...@@ -15,6 +17,21 @@ const Sidebar: React.FC<Props> = ({ children }) => { ...@@ -15,6 +17,21 @@ const Sidebar: React.FC<Props> = ({ children }) => {
setShow(!show); setShow(!show);
}; };
const clickOutside = (e) => {
// check if the click was inside the sidebar or the menu button
// if it was outside, close the sidebar
if (e.target.closest('#sidebar') || e.target.closest('.toggle-btn')) {
return;
}
setShow(false);
}
useEffect(() => {
document.addEventListener('click', clickOutside);
return () => {
document.removeEventListener('click', clickOutside);
}
});
return ( return (
<div className="sidebar-wrapper"> <div className="sidebar-wrapper">
<nav className={show ? '' : 'no-sidebar'} id="sidebar"> <nav className={show ? '' : 'no-sidebar'} id="sidebar">
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='compendium-v2', name='compendium-v2',
version="0.53", version="0.54",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='Flask and React project for displaying ' description='Flask and React project for displaying '
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment