Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
[FR-300] 🐛Fix: Proposal to improve event collections list performance (
Browse files Browse the repository at this point in the history
…#66)

* 🐛Fix: Proposal to improve event collections list performance

* 🐛Fix: Remove unused states

* ✨ Add: Replaced react-tooltip with cooltipz tooltip

(Only in activity rows)

* 🐛Fix: Tooltip opacity unit error
  • Loading branch information
guidoalp authored Mar 10, 2022
1 parent f67cd11 commit e48d446
Show file tree
Hide file tree
Showing 14 changed files with 2,178 additions and 15,073 deletions.
14,966 changes: 0 additions & 14,966 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"react-table": "^7.6.2",
"react-tooltip": "^4.2.10",
"react-tooltip": "^4.2.21",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
Expand Down
584 changes: 584 additions & 0 deletions src/assets/images/mazury.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/rainbow.png
Binary file not shown.
734 changes: 734 additions & 0 deletions src/assets/images/rainbow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/tally.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/tally.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 25 additions & 78 deletions src/pages/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,90 +249,37 @@ export function Event() {
)
}

function ExternalIconCell({url, icon, tooltipText = null, content}) {
const [isHovering, setIsHovering] = useState(false)
const [isHoveringLink, setIsHoveringLink] = useState(false)

let hoverDeactivateTimeout = null;
let hoverLinkDeactivateTimeout = null;
useEffect(()=>{
return () => {
// Clear timeouts on unmount
clearTimeout(hoverDeactivateTimeout)
clearTimeout(hoverLinkDeactivateTimeout)
}
})
const ExternalIconCell = ({url, icon, tooltipText = null}) => {
return (
<a href={url} target="_blank" rel="noopener noreferrer"
data-tip={tooltipText}
data-for='mainTooltip'
onMouseEnter={() => {setIsHovering(true)}}
onMouseLeave={() => {hoverDeactivateTimeout = setTimeout(() => {
if (!isHoveringLink) setIsHovering(false)
}, 500)}}
style={{position: 'relative', width: 27}}
>
<span>
<img src={icon}
style={{'margin': '0 5px', 'verticalAlign': 'middle', width: '20px', height: '20px'}}
alt={'Open external link'} />
</span>
<ReactTooltip id='mainTooltip' effect='solid'/>
{
isHovering &&
<><div className='external-link'
data-tip='Open external link'
data-for='linkTooltip'
onMouseEnter={() => {clearTimeout(hoverDeactivateTimeout); clearTimeout(hoverLinkDeactivateTimeout); setIsHoveringLink(true)}}
onMouseLeave={() => {hoverLinkDeactivateTimeout = setTimeout(() => {
setIsHoveringLink(false)
setIsHovering(false)
}, 500)}}
>
</div><ReactTooltip id='linkTooltip' effect='solid' place='bottom'/></> }
</a>
<a
href={url}
target="_blank"
rel="noopener noreferrer"
aria-label={tooltipText}
data-cooltipz-dir="top"
style={{ position: "relative", width: 27 }}
>
<span>{icon}</span>
</a>
);
}

function ExternalLinkCell({url, tooltipText = null, content}) {
const [isHovering, setIsHovering] = useState(false)
const [isHoveringLink, setIsHoveringLink] = useState(false)
const width = useWindowWidth()
let hoverDeactivateTimeout = null;
let hoverLinkDeactivateTimeout = null;
useEffect(()=>{
return () => {
// Clear timeouts on unmount
clearTimeout(hoverDeactivateTimeout)
clearTimeout(hoverLinkDeactivateTimeout)
}
})
const ExternalLinkCell = ({ url, tooltipText = null, content }) => {
const width = useWindowWidth();

return (
<a href={url} target="_blank" rel="noopener noreferrer"
data-tip={tooltipText}
data-for='mainTooltip'
onMouseEnter={() => {setIsHovering(true)}}
onMouseLeave={() => {hoverDeactivateTimeout = setTimeout(() => {
if (!isHoveringLink) setIsHovering(false)
}, 500)}}
style={{position: 'relative', width: 27}}
<a
href={url}
target="_blank"
rel="noopener noreferrer"
aria-label={tooltipText}
data-cooltipz-dir="top"
style={{ position: "relative", width: 27 }}
>
<span>{shrinkAddress(content, width > 768 ? 20 : 10)}</span><ReactTooltip id='mainTooltip' effect='solid'/>
{
isHovering &&
<><div className='external-link'
data-tip='Open external link'
data-for='linkTooltip'
onMouseEnter={() => {clearTimeout(hoverDeactivateTimeout); clearTimeout(hoverLinkDeactivateTimeout); setIsHoveringLink(true)}}
onMouseLeave={() => {hoverLinkDeactivateTimeout = setTimeout(() => {
setIsHoveringLink(false)
setIsHovering(false)
}, 500)}}
>
</div><ReactTooltip id='linkTooltip' effect='solid' place='bottom'/></> }
</a>
);
}
<span>{shrinkAddress(content, width > 768 ? 20 : 10)}</span>
</a>
);
};

function TableContainer({tokens, ensNames, pageCount: pc, loading}) {
const [data, setData] = useState([]);
Expand Down
2 changes: 2 additions & 0 deletions src/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ $color-medium-violet: $grayscale4;
$color-light-violet: #cabdf3;
$color-light-grey: #eef0fb;
$color-grey: #878787;
$color-dark: #222;


$gray-select-arrow: linear-gradient(45deg, transparent 50%, $grayscale4 50%),
linear-gradient(135deg, $grayscale4 50%, transparent 50%);
Expand Down
9 changes: 9 additions & 0 deletions src/scss/components/_backoffice.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
:root {
--cooltipz-bg-color: #{$color-dark};
--cooltipz-font-size: 13px;
--cooltipz-font-family: #{$font-family};
--cooltipz-border-radius: 3px;
--cooltipz-border-color: #{$color-dark};
--cooltipz-arrow-size: 0.4rem;
}

.app-content {
&.backoffice {
padding-bottom: 200px;
Expand Down
21 changes: 11 additions & 10 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* ******************************************************
Main Import File
- Base Imports (Varialbes/Utilities/Base styles)
- Components (Navigation/Tools/Modules)
- Vendor Imports (Third party plugins)
- Base Imports (Varialbes/Utilities/Base styles)
- Vendor Imports (Third party plugins)
- Components (Navigation/Tools/Modules)
****************************************************** */

/* ================================================================
Expand All @@ -18,6 +18,14 @@
@import 'globals/print';
@import 'globals/forms';

/* ================================================================
Vendor Imports
================================================================ */
// @import 'vendor/slick';
// @import "vendor/slick-theme";
@import 'vendor/aos';
@import 'vendor/_cooltipz';

/* ================================================================
Component Imports
================================================================ */
Expand All @@ -31,10 +39,3 @@
@import 'components/eventsapp';
@import 'components/footer';
@import 'components/poapapp';

/* ================================================================
Vendor Imports
================================================================ */
// @import 'vendor/slick';
// @import "vendor/slick-theme";
@import 'vendor/aos';
Loading

0 comments on commit e48d446

Please sign in to comment.