Skip to content

Commit f4959db

Browse files
committed
Fix weighting to remove some sketchy packages
1 parent ba40a85 commit f4959db

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/pages/plugins/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useEffect, useState} from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import classnames from 'classnames';
33

44
import Layout from '@theme/Layout';
@@ -62,9 +62,9 @@ class Plugin {
6262
}
6363

6464
if (homepage &&
65-
homepage !== npm &&
66-
homepage !== repository &&
67-
homepage !== `${repository}#readme`) {
65+
homepage !== npm &&
66+
homepage !== repository &&
67+
homepage !== `${repository}#readme`) {
6868
links.push({ text: 'homepage', href: homepage });
6969
}
7070

@@ -120,7 +120,7 @@ function noop(evt) {
120120
evt && evt.preventDefault();
121121
}
122122

123-
function Paginate({onPage = noop}) {
123+
function Paginate({ onPage = noop }) {
124124
return (
125125
<div className="row padding-vert--md">
126126
<div className="col col--4 col--offset-4">
@@ -159,11 +159,11 @@ async function fetchPackages(keywords, searchText = '', pageNumber = 0) {
159159
const text = search.join(' ');
160160

161161
try {
162-
const initialUrl = `${baseUrl}?from=${from}&text=${text}`;
162+
const initialUrl = `${baseUrl}?from=${from}&text=${text}&quality=0.5&popularity=1.0&maintenance=0.1`;
163163
const response = await fetch(initialUrl);
164164
const { total, objects } = await response.json();
165165
return { total, plugins: objects.map(toPlugin) };
166-
} catch(err) {
166+
} catch (err) {
167167
console.log(err);
168168
return { total: 0, plugins: [] };
169169
}
@@ -277,7 +277,7 @@ function useSearch() {
277277

278278

279279
function PluginsPage() {
280-
const [{title, plugins, placeholder, hasMore}, {search, paginate}] = useSearch();
280+
const [{ title, plugins, placeholder, hasMore }, { search, paginate }] = useSearch();
281281
const [searchInput, setSearchInput] = useState(``);
282282

283283
let onSubmit = (evt) => {

0 commit comments

Comments
 (0)