Skip to content

Commit

Permalink
Merge pull request #230 from ecency/development
Browse files Browse the repository at this point in the history
Popular users fix and font improvements
  • Loading branch information
feruzm authored Nov 9, 2020
2 parents 22104e5 + b3a3e33 commit 2e9c71d
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 37 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
"redux-thunk": "^2.3.0",
"rss": "^1.2.2",
"serialize-javascript": "^3.0.0",
"speakingurl": "^14.0.1",
"typeface-source-serif-pro": "^1.1.13"
"speakingurl": "^14.0.1"
},
"devDependencies": {
"@types/bytebuffer": "^5.0.41",
Expand Down
2 changes: 0 additions & 2 deletions src/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import App from "../common/app";

import {AppWindow} from "./window";

import "typeface-source-serif-pro";

import "../style/theme-day.scss";
import "../style/theme-night.scss";

Expand Down
3 changes: 2 additions & 1 deletion src/common/components/entry-list-item/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
}

.item-title {
font-weight: 700;
font-weight: 600;
font-size: large;
margin-bottom: 9px;

@include themify(day) {
Expand Down
4 changes: 2 additions & 2 deletions src/common/pages/_entry.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
}

h1.entry-title {
font-size: 24px;
font-size: 30px;
margin: 16px 0 22px 0;

@media (min-width: $md-break) {
font-size: 32px;
font-size: 38px;
}

@include themify(day) {
Expand Down
2 changes: 0 additions & 2 deletions src/desktop/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import routes from "../../common/routes";

import {DesktopWindow} from "./window";

import "typeface-source-serif-pro";

import "../../style/theme-day.scss";
import "../../style/theme-night.scss";

Expand Down
60 changes: 39 additions & 21 deletions src/server/handlers/private-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,27 @@ export const popularUsers = async (req: express.Request, res: express.Response)

await client.connect();

const sql = `SELECT drv3.author AS name, ac.display_name, ac.about, ac.reputation
const minReputation = "112985730131325"; // something around 70
const sql = `SELECT drv3.author AS name, ac.posting_json_metadata AS json_metadata
FROM (
SELECT DISTINCT author
FROM (
SELECT *
FROM (
SELECT
author,
author_rep
FROM hive_posts_cache
WHERE depth = 0
ORDER BY post_id DESC
LIMIT 10000
) AS drv1
WHERE author_rep >= 70
ORDER BY author_rep DESC
) AS drv2
) AS drv3
LEFT JOIN hive_accounts AS ac ON ac.name = drv3.author
WHERE ac.display_name!='' AND ac.about != ''
ORDER BY random() LIMIT 260;`;
SELECT DISTINCT author
FROM (
SELECT *
FROM (
SELECT
ha_pp.name AS author, ha_pp.reputation AS author_rep
FROM hive_posts hp
JOIN hive_accounts ha_pp ON ha_pp.id = hp.author_id
WHERE hp.depth = 0
ORDER BY hp.id DESC
LIMIT 10000
) AS drv1
WHERE author_rep >= ${minReputation}
ORDER BY author_rep DESC)
AS drv2) AS drv3
LEFT JOIN hive_accounts AS ac ON ac.name = drv3.author
WHERE ac.posting_json_metadata != '' AND ac.posting_json_metadata != '{}'
ORDER BY random() LIMIT 260;`

let r: QueryResult;

Expand All @@ -90,7 +90,25 @@ export const popularUsers = async (req: express.Request, res: express.Response)
await client.end();
}

discovery = r.rows;
discovery = r.rows.map(x => {
let json;

try {
json = JSON.parse(x.json_metadata);
} catch (e) {
return null;
}

if (json.profile?.name && json.profile?.about) {
return {
name: x.name,
display_name: json.profile.name,
about: json.profile.about
}
}

return null;
}).filter(x => x !== null);

cache.set("discovery", discovery, 86400);
}
Expand Down
2 changes: 1 addition & 1 deletion src/style/theme-day.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "colors";

$font-family-base: "Source Serif Pro", sans-serif;
$font-family-base: -apple-system, BlinkMacSystemFont, sans-serif;

$primary: $dark-sky-blue;
$success: $green1 ;
Expand Down
2 changes: 1 addition & 1 deletion src/style/theme-night.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "colors";

$font-family-base: "Source Serif Pro", sans-serif;
$font-family-base: -apple-system, BlinkMacSystemFont, sans-serif;

$primary: $dark-sky-blue;
$success: $green1 ;
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10972,11 +10972,6 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typeface-source-serif-pro@^1.1.13:
version "1.1.13"
resolved "https://registry.yarnpkg.com/typeface-source-serif-pro/-/typeface-source-serif-pro-1.1.13.tgz#65ef53e40589fb54763abea033e394bcb412ae36"
integrity sha512-LfJYxVscKSpIK63sCO1OP2LzWTlFen/Lt3USPUUOzKqT53d83ZPy4dS2VV0Uac2IbgdQJQajhTH8dZUPGvcdBQ==

typescript@^3.5.3:
version "3.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
Expand Down

0 comments on commit 2e9c71d

Please sign in to comment.