|
|
|
@ -74,7 +74,7 @@ const SearchResultsHeader = memo(({ query, resultsCount, limit, type, tab }) =>
|
|
|
|
|
* @component
|
|
|
|
|
* @returns {React.MemoExoticComponent<function(): React.ReactElement>}
|
|
|
|
|
*/
|
|
|
|
|
const ContentBody = memo(({ community, display, showBanners, filteredResults, type, limit, resultsCount, handleResultsCount }) => {
|
|
|
|
|
const ContentBody = memo(({ community, display, filteredResults, type, limit, resultsCount, handleResultsCount }) => {
|
|
|
|
|
const { emptyStateImage } = getModule('emptyStateImage', 'emptyStateSubtext');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -93,7 +93,6 @@ const ContentBody = memo(({ community, display, showBanners, filteredResults, ty
|
|
|
|
|
<AddonCard
|
|
|
|
|
community={community}
|
|
|
|
|
display={display}
|
|
|
|
|
showBanner={showBanners}
|
|
|
|
|
type={type}
|
|
|
|
|
addonId={item.addonId}
|
|
|
|
|
/>
|
|
|
|
@ -121,7 +120,7 @@ const ContentBody = memo(({ community, display, showBanners, filteredResults, ty
|
|
|
|
|
* @component
|
|
|
|
|
* @returns {React.MemoExoticComponent<function(): React.ReactElement>}
|
|
|
|
|
*/
|
|
|
|
|
const StickyBar = memo(({ query, type, showBanners, resetSearchOptions, handleShowBanners, display, handleTabChange, handleClearQuery, handleQueryChange, handleDisplayChange }) => {
|
|
|
|
|
const StickyBar = memo(({ query, type, tab, resetSearchOptions, handleTabChange, display, handleQueryChange, handleDisplayChange }) => {
|
|
|
|
|
const [ sticky, setSticky ] = useState(false);
|
|
|
|
|
const PopoutDispatcher = getModule('openPopout');
|
|
|
|
|
|
|
|
|
@ -182,8 +181,6 @@ const StickyBar = memo(({ query, type, showBanners, resetSearchOptions, handleSh
|
|
|
|
|
<DisplayMenu
|
|
|
|
|
onClose={onClose}
|
|
|
|
|
handleDisplayChange={handleDisplayChange}
|
|
|
|
|
showBanners={showBanners}
|
|
|
|
|
handleShowBanners={handleShowBanners}
|
|
|
|
|
display={display}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
@ -279,7 +276,7 @@ const StickyBar = memo(({ query, type, showBanners, resetSearchOptions, handleSh
|
|
|
|
|
* Renders the addons list.
|
|
|
|
|
* @returns {React.MemoExoticComponent<function(): React.ReactElement>}
|
|
|
|
|
*/
|
|
|
|
|
export default memo(({ source, type, tab, search, display, limit, showBanners, className, showOptionsBar = true }) => {
|
|
|
|
|
export default memo(({ source, type, tab, search, display, limit, className, community, showOptionsBar = true }) => {
|
|
|
|
|
const { path, url } = useRouteMatch();
|
|
|
|
|
type = type || (/(\/plugins\/)/).test(path) ? 'plugin' : (/(\/themes\/)/).test(path) ? 'theme' : 'plugin';
|
|
|
|
|
const { getSetting, updateSetting } = vizality.api.settings._fluxProps('addon-manager');
|
|
|
|
@ -287,7 +284,6 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
community = community || currentTab === 'browse';
|
|
|
|
|
const [ currentSource, setCurrentSource ] = useState(source || (type === 'plugin' || type === 'theme' ? [ ...vizality.manager[toPlural(type)].values ] : currentTab === 'browse' ? [ ...vizality.manager.community[toPlural(type)].values() ] : [ ...vizality.manager[toPlural(type)].values ]));
|
|
|
|
|
const [ displayType, setDisplay ] = useState(display || getSetting('listDisplay', 'card'));
|
|
|
|
|
const [ banners, setShowBanners ] = useState(showBanners || getSetting('showBanners', false));
|
|
|
|
|
const [ query, setQuery, filteredResults ] = useFilter({
|
|
|
|
|
keys: [ 'manifest.name', 'manifest.author.name', 'manifest.author', 'manifest.description' ],
|
|
|
|
|
data: currentSource
|
|
|
|
@ -332,7 +328,7 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
vizality.manager[toPlural(type)].removeListener(Events.VIZALITY_ADDON_INSTALL, forceUpdate);
|
|
|
|
|
vizality.manager[toPlural(type)].removeListener(Events.VIZALITY_ADDON_UNINSTALL, forceUpdate);
|
|
|
|
|
};
|
|
|
|
|
}, [ source, type, tab, display, search, limit, showBanners, displayType, currentTab, banners, currentSource, resultsCount ]);
|
|
|
|
|
}, [ source, type, tab, display, search, limit, displayType, currentSource, resultsCount, currentTab ]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @todo Need to come up with a better way to handle tab changes. Hardcoding the source
|
|
|
|
@ -355,14 +351,12 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles the "Show Banners" option.
|
|
|
|
|
* @param {boolean} show Whether to show addon card banners
|
|
|
|
|
* @returns {void}
|
|
|
|
|
/*
|
|
|
|
|
* Including these in this component so we can forceUpdate the switches.
|
|
|
|
|
* There's probably a better way to do it.
|
|
|
|
|
*/
|
|
|
|
|
const handleShowBanners = show => {
|
|
|
|
|
updateSetting('showBanners', show);
|
|
|
|
|
return setShowBanners(show);
|
|
|
|
|
const resetSearchOptions = () => {
|
|
|
|
|
return setQuery('');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -388,7 +382,6 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
<div
|
|
|
|
|
className={joinClassNames('vz-addons-list', className, colorStandard)}
|
|
|
|
|
vz-display={displayType}
|
|
|
|
|
vz-banners={Boolean(banners) && ''}
|
|
|
|
|
vz-type={type}
|
|
|
|
|
>
|
|
|
|
|
{showOptionsBar && (
|
|
|
|
@ -403,8 +396,6 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
resetSearchOptions={resetSearchOptions}
|
|
|
|
|
getSetting={getSetting}
|
|
|
|
|
updateSetting={updateSetting}
|
|
|
|
|
showBanners={banners}
|
|
|
|
|
handleShowBanners={handleShowBanners}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<DeferredRender
|
|
|
|
@ -427,7 +418,6 @@ export default memo(({ source, type, tab, search, display, limit, showBanners, c
|
|
|
|
|
filteredResults={filteredResults}
|
|
|
|
|
community={community}
|
|
|
|
|
display={displayType}
|
|
|
|
|
showBanners={banners}
|
|
|
|
|
type={type}
|
|
|
|
|
limit={limit}
|
|
|
|
|
resultsCount={resultsCount}
|
|
|
|
|