mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
commented unused const
This commit is contained in:
parent
bff430602d
commit
87b053a283
1 changed files with 23 additions and 24 deletions
|
@ -33,8 +33,8 @@ const filterCategoryColors = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const PAGE_SIZE = 20;
|
const PAGE_SIZE = 20;
|
||||||
const TOTAL_ITEMS_TO_SHOW_GO_UP_BUTTOM = 10
|
const TOTAL_ITEMS_TO_SHOW_GO_UP_BUTTOM = 10;
|
||||||
const LIMIT_SCROLL_TO_DISAPEAR_GO_UP_BUTTOM = 225
|
// const LIMIT_SCROLL_TO_DISAPEAR_GO_UP_BUTTOM = 225;
|
||||||
|
|
||||||
export default function Catalogue() {
|
export default function Catalogue() {
|
||||||
const abortControllerRef = useRef<AbortController | null>(null);
|
const abortControllerRef = useRef<AbortController | null>(null);
|
||||||
|
@ -51,7 +51,7 @@ export default function Catalogue() {
|
||||||
|
|
||||||
const [results, setResults] = useState<any[]>([]);
|
const [results, setResults] = useState<any[]>([]);
|
||||||
|
|
||||||
const [wantGoUpButtonIsVisible, setWantGoUpButtonIsVisible] = useState(false)
|
const [wantGoUpButtonIsVisible, setWantGoUpButtonIsVisible] = useState(false);
|
||||||
|
|
||||||
const [itemsCount, setItemsCount] = useState(0);
|
const [itemsCount, setItemsCount] = useState(0);
|
||||||
|
|
||||||
|
@ -85,19 +85,21 @@ export default function Catalogue() {
|
||||||
).current;
|
).current;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
results.length > 0 && results.length <= TOTAL_ITEMS_TO_SHOW_GO_UP_BUTTOM ? setWantGoUpButtonIsVisible(true) : setWantGoUpButtonIsVisible(false)
|
results.length > 0 && results.length <= TOTAL_ITEMS_TO_SHOW_GO_UP_BUTTOM
|
||||||
console.log(cataloguePageRef.current?.scrollTop)
|
? setWantGoUpButtonIsVisible(true)
|
||||||
}, [results])
|
: setWantGoUpButtonIsVisible(false);
|
||||||
|
console.log(cataloguePageRef.current?.scrollTop);
|
||||||
|
}, [results]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
if (cataloguePageRef.current) {
|
if (cataloguePageRef.current) {
|
||||||
console.log(cataloguePageRef.current.scrollTop)
|
console.log(cataloguePageRef.current.scrollTop);
|
||||||
// setScrollPosition(cataloguePageRef.current.scrollTop);
|
// setScrollPosition(cataloguePageRef.current.scrollTop);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(cataloguePageRef.current){
|
if (cataloguePageRef.current) {
|
||||||
cataloguePageRef.current.addEventListener("scroll", handleScroll);
|
cataloguePageRef.current.addEventListener("scroll", handleScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,14 +259,14 @@ export default function Catalogue() {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleWantGoUpButtonClick = () => {
|
const handleWantGoUpButtonClick = () => {
|
||||||
if(cataloguePageRef.current){
|
if (cataloguePageRef.current) {
|
||||||
cataloguePageRef.current.scrollTo({
|
cataloguePageRef.current.scrollTo({
|
||||||
top: 0,
|
top: 0,
|
||||||
behavior: 'smooth'
|
behavior: "smooth",
|
||||||
})
|
});
|
||||||
setWantGoUpButtonIsVisible(false)
|
setWantGoUpButtonIsVisible(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="catalogue" ref={cataloguePageRef}>
|
<div className="catalogue" ref={cataloguePageRef}>
|
||||||
|
@ -370,18 +372,15 @@ export default function Catalogue() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{wantGoUpButtonIsVisible && (
|
{wantGoUpButtonIsVisible && (
|
||||||
<div style={{position: 'fixed', bottom: 16, left: 16 }}>
|
<div style={{ position: "fixed", bottom: 16, left: 16 }}>
|
||||||
<Button
|
<Button onClick={handleWantGoUpButtonClick} theme="outline">
|
||||||
onClick={handleWantGoUpButtonClick}
|
{t("result_count", {
|
||||||
theme="outline"
|
resultCount: formatNumber(itemsCount),
|
||||||
>
|
})}
|
||||||
{t("result_count", {
|
, voltar ao topo <ArrowUpIcon />
|
||||||
resultCount: formatNumber(itemsCount),
|
|
||||||
})}, voltar ao topo <ArrowUpIcon />
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="catalogue__filters-container">
|
<div className="catalogue__filters-container">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue