diff --git a/client/theme.less b/client/theme.less index 04e6e19..21aa659 100644 --- a/client/theme.less +++ b/client/theme.less @@ -40,5 +40,5 @@ } .ant-card:hover { - transform: scale(1.1); + transform: scale(1.05); } \ No newline at end of file diff --git a/imports/api/Handlers/server/publications.js b/imports/api/Handlers/server/publications.js index f9ed94b..24c781f 100644 --- a/imports/api/Handlers/server/publications.js +++ b/imports/api/Handlers/server/publications.js @@ -1,21 +1,30 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import Handlers from '../Handlers'; -import escapeRegExp from "../../../modules/regexescaper"; -import Packages from "../../Packages/server/ServerPackages"; +import Comments from '../../Comments/Comments'; +import escapeRegExp from '../../../modules/regexescaper'; +import Packages from '../../Packages/server/ServerPackages'; Meteor.publish( 'handlers', - function handlers(handlerTitleSearch = '', handlerOptionSearch = 'hot', handlerSortOrder = 'down', limit = 18) { - let sortObject = { stars: handlerSortOrder === "up" ? 1 : -1 }; + function handlers( + handlerTitleSearch = '', + handlerOptionSearch = 'hot', + handlerSortOrder = 'down', + limit = 18, + ) { + let sortObject = { stars: handlerSortOrder === 'up' ? 1 : -1 }; if (handlerOptionSearch === 'download') { - sortObject = { downloadCount: handlerSortOrder === "up" ? 1 : -1 }; + sortObject = { downloadCount: handlerSortOrder === 'up' ? 1 : -1 }; } if (handlerOptionSearch === 'latest') { - sortObject = { createdAt: handlerSortOrder === "up" ? 1 : -1 }; + sortObject = { createdAt: handlerSortOrder === 'up' ? 1 : -1 }; } if (handlerOptionSearch === 'report') { - sortObject = { reports: handlerSortOrder === "up" ? 1 : -1 }; + sortObject = { reports: handlerSortOrder === 'up' ? 1 : -1 }; + } + if (handlerOptionSearch === 'alphabetical') { + sortObject = { gameName: handlerSortOrder === 'up' ? -1 : 1 }; } return Handlers.find( { @@ -64,14 +73,39 @@ Meteor.publish( }, ); -WebApp.connectHandlers.use('/api/v1/totalDownloadCountEver', async (req, res, next) => { +WebApp.connectHandlers.use('/api/v1/hubstats', async (req, res, next) => { res.writeHead(200); - let sum = 0; + let downloadsSum = 0; + let hotnessSum = 0; + let handlerCount = 0; + let usersCount = 0; const allPackages = Packages.collection.find({}).fetch(); allPackages.forEach(pkg => { - if (pkg.meta.downloads > 0) sum = sum + pkg.meta.downloads; + if (pkg.meta.downloads > 0) { + downloadsSum = downloadsSum + pkg.meta.downloads; + } + }); + const allHandlers = Handlers.find({ private: false }).fetch(); + allHandlers.forEach(hndl => { + if (hndl.stars > 0) { + hotnessSum = hotnessSum + hndl.stars; + } }); - res.end(`Total downloads: ${sum}`); + handlerCount = allHandlers.length; + + const allUsers = Meteor.users.find({}).fetch(); + usersCount = allUsers.length; + + const allComments = Comments.find({}).fetch(); + const commentsCount = allComments.length; + + res.end( + `Total downloads: ${downloadsSum}` + + `\nTotal hotness: ${hotnessSum}` + + `\nTotal handlers: ${handlerCount}` + + `\nTotal users: ${usersCount}` + + `\nTotal comments ${commentsCount}` + ); }); Meteor.publish('handlers.edit', function handlersEdit(documentId) { @@ -104,7 +138,7 @@ Meteor.publish( private: false, }, { - sort: {stars: -1}, + sort: { stars: -1 }, limit: 500, }, ); diff --git a/imports/ui/layouts/App/AppMenu.jsx b/imports/ui/layouts/App/AppMenu.jsx index 5592d2d..0ecb35c 100644 --- a/imports/ui/layouts/App/AppMenu.jsx +++ b/imports/ui/layouts/App/AppMenu.jsx @@ -35,7 +35,7 @@ function AppMenu(props) { ( - SplitScreen Me logo + SplitScreen Me logo )} /> SplitScreen Me diff --git a/imports/ui/pages/Handlers/Handlers.jsx b/imports/ui/pages/Handlers/Handlers.jsx index 48b2018..2173588 100644 --- a/imports/ui/pages/Handlers/Handlers.jsx +++ b/imports/ui/pages/Handlers/Handlers.jsx @@ -125,6 +125,9 @@ function Handlers(props) { {props.currentSearchOption === 'latest' && } Release date + + {props.currentSearchOption === 'alphabetical' && } Alphabetical + {isAdmin && ( {props.currentSearchOption === 'report' && } Reports @@ -137,13 +140,13 @@ function Handlers(props) { } renderItem={item => ( - + { if (currentSearchOption.get() === 'report') { sortObject = { reports: reactiveCurrentOrder === 'up' ? 1 : -1 }; } + if (currentSearchOption.get() === 'alphabetical') { + sortObject = { gameName: reactiveCurrentOrder === 'up' ? -1 : 1 }; + } return { loading: !subscription.ready(),