mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-11 18:29:17 +00:00
Refactor MostViewedScripts to ensure proper type annotations and improve array concatenation method for better readability
This commit is contained in:
parent
2169131863
commit
306fd8e26c
@ -136,13 +136,12 @@ export function LatestScripts({ items }: { items: Category[] }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function MostViewedScripts({ items }: { items: Category[] }) {
|
export function MostViewedScripts({ items }: { items: Category[] }) {
|
||||||
const mostViewedScripts = items.reduce((acc, category) => {
|
const mostViewedScripts = items.reduce((acc: Script[], category) => {
|
||||||
const foundScripts = category.scripts.filter((script) =>
|
const foundScripts = category.scripts.filter((script) =>
|
||||||
mostPopularScripts.includes(script.name),
|
mostPopularScripts.includes(script.name),
|
||||||
);
|
);
|
||||||
acc.push(...foundScripts);
|
return acc.concat(foundScripts);
|
||||||
return acc;
|
}, []);
|
||||||
}, [] as Script[]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<div className="">
|
||||||
|
Loading…
Reference in New Issue
Block a user