mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 20:02:26 +00:00
feed: stop the grid re-sorting ranked feeds chronologically; Trending defaults
The real reason every tab looked identical: VideoListView.render re-sorts displayVideos by date UNLESS metadata.preserveOrder is set, and only Explore set it. So For You's tiering, Trending's view-count ranking, and Kids' scoring were all discarded at render and shown in plain chronological order — i.e. the #21 feed-identity work was invisible. Set preserveOrder for For You, Trending, and Kids so their feed-engine order survives to the grid. Also per request: - Sidebar: Trending now sits above Recently Added. - Default homepage: logged-out users land on Trending (gated by FEATURE_TRENDING_FEED, falls back to Recent); logged-in stays For You. The logout-from-For-You redirect follows the same rule. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
02854d4fb5
commit
04621efc52
4 files changed
+29
-15
No files matched your search
@@ -54,15 +54,6 @@
|
|||||||
/>
|
/>
|
||||||
<span class="sidebar-text">For You</span>
|
<span class="sidebar-text">For You</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="#view=most-recent-videos" class="sidebar-nav-link" title="Recently Added">
|
|
||||||
<img
|
|
||||||
src="assets/svg/globe-icon.svg"
|
|
||||||
alt=""
|
|
||||||
aria-hidden="true"
|
|
||||||
class="sidebar-icon"
|
|
||||||
/>
|
|
||||||
<span class="sidebar-text">Recently Added</span>
|
|
||||||
</a>
|
|
||||||
<a
|
<a
|
||||||
id="trendingLink"
|
id="trendingLink"
|
||||||
href="#view=trending"
|
href="#view=trending"
|
||||||
@@ -85,6 +76,15 @@
|
|||||||
</svg>
|
</svg>
|
||||||
<span class="sidebar-text">Trending</span>
|
<span class="sidebar-text">Trending</span>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#view=most-recent-videos" class="sidebar-nav-link" title="Recently Added">
|
||||||
|
<img
|
||||||
|
src="assets/svg/globe-icon.svg"
|
||||||
|
alt=""
|
||||||
|
aria-hidden="true"
|
||||||
|
class="sidebar-icon"
|
||||||
|
/>
|
||||||
|
<span class="sidebar-text">Recently Added</span>
|
||||||
|
</a>
|
||||||
<a href="#view=kids" class="sidebar-nav-link" title="For Kids">
|
<a href="#view=kids" class="sidebar-nav-link" title="For Kids">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
import { clearDecryptionSchemeCache } from "../nostr/decryptionSchemeCache.js";
|
import { clearDecryptionSchemeCache } from "../nostr/decryptionSchemeCache.js";
|
||||||
import { clearWatchHistoryConversationKeyCache } from "../nostr/watchHistory.js";
|
import { clearWatchHistoryConversationKeyCache } from "../nostr/watchHistory.js";
|
||||||
import { clearWatchHistoryDecryptedChunkCache } from "../nostr/watchHistoryDecryptCache.js";
|
import { clearWatchHistoryDecryptedChunkCache } from "../nostr/watchHistoryDecryptCache.js";
|
||||||
import { FEED_TYPES } from "../constants.js";
|
import { FEED_TYPES, FEATURE_TRENDING_FEED } from "../constants.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick a background watch-history refresh after login, once the feed-driving
|
* Kick a background watch-history refresh after login, once the feed-driving
|
||||||
@@ -988,7 +988,11 @@ export function createAuthSessionCoordinator(deps) {
|
|||||||
typeof logoutView === "string" &&
|
typeof logoutView === "string" &&
|
||||||
logoutView.trim().toLowerCase() === FEED_TYPES.FOR_YOU
|
logoutView.trim().toLowerCase() === FEED_TYPES.FOR_YOU
|
||||||
) {
|
) {
|
||||||
setHashView(FEED_TYPES.RECENT);
|
// For You is logged-in only; send logged-out users to the same landing
|
||||||
|
// as the default homepage — Trending (or Recent if Trending is off).
|
||||||
|
setHashView(
|
||||||
|
FEATURE_TRENDING_FEED ? FEED_TYPES.TRENDING : FEED_TYPES.RECENT
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeModalVideo =
|
const activeModalVideo =
|
||||||
|
|||||||
@@ -848,14 +848,18 @@ export function createFeedCoordinator(deps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
runtime = this.buildForYouFeedRuntime({ watchHistoryItems });
|
runtime = this.buildForYouFeedRuntime({ watchHistoryItems });
|
||||||
|
// Keep the scorer/sorter's "your people first" order — without this
|
||||||
|
// VideoListView re-sorts chronologically and For You looks like Recent.
|
||||||
|
metadataModifier = (m) => ({ ...m, preserveOrder: true });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FEED_TYPES.KIDS:
|
case FEED_TYPES.KIDS:
|
||||||
runtime = this.buildKidsFeedRuntime();
|
runtime = this.buildKidsFeedRuntime();
|
||||||
metadataModifier = (m) => {
|
metadataModifier = (m) => {
|
||||||
if (runtime?.ageGroup && !m.ageGroup)
|
const next = { ...m, preserveOrder: true };
|
||||||
m.ageGroup = runtime.ageGroup;
|
if (runtime?.ageGroup && !next.ageGroup)
|
||||||
return m;
|
next.ageGroup = runtime.ageGroup;
|
||||||
|
return next;
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case FEED_TYPES.EXPLORE:
|
case FEED_TYPES.EXPLORE:
|
||||||
@@ -869,6 +873,8 @@ export function createFeedCoordinator(deps) {
|
|||||||
break;
|
break;
|
||||||
case FEED_TYPES.TRENDING:
|
case FEED_TYPES.TRENDING:
|
||||||
runtime = buildTrendingFeedRuntime(this);
|
runtime = buildTrendingFeedRuntime(this);
|
||||||
|
// Preserve the view-count ranking (otherwise re-sorted by date).
|
||||||
|
metadataModifier = (m) => ({ ...m, preserveOrder: true });
|
||||||
break;
|
break;
|
||||||
case "recent":
|
case "recent":
|
||||||
runtime = this.buildRecentFeedRuntime();
|
runtime = this.buildRecentFeedRuntime();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { devLogger as defaultDevLogger, userLogger as defaultUserLogger } from "./utils/logger.js";
|
import { devLogger as defaultDevLogger, userLogger as defaultUserLogger } from "./utils/logger.js";
|
||||||
import { FEED_TYPES } from "./constants.js";
|
import { FEED_TYPES, FEATURE_TRENDING_FEED } from "./constants.js";
|
||||||
|
|
||||||
const LEGACY_DOCS_VIEWS = {
|
const LEGACY_DOCS_VIEWS = {
|
||||||
about: "about",
|
about: "about",
|
||||||
@@ -90,8 +90,12 @@ export function createHashChangeHandler({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!match || !match[1]) {
|
if (!match || !match[1]) {
|
||||||
|
// Logged in → personalized For You; logged out → Trending (the best
|
||||||
|
// not-personalized landing), falling back to Recent if Trending is off.
|
||||||
const defaultViewName = resolveIsLoggedIn()
|
const defaultViewName = resolveIsLoggedIn()
|
||||||
? FEED_TYPES.FOR_YOU
|
? FEED_TYPES.FOR_YOU
|
||||||
|
: FEATURE_TRENDING_FEED
|
||||||
|
? FEED_TYPES.TRENDING
|
||||||
: FEED_TYPES.RECENT;
|
: FEED_TYPES.RECENT;
|
||||||
|
|
||||||
if (defaultViewName === currentViewName) {
|
if (defaultViewName === currentViewName) {
|
||||||
|
|||||||
Reference in new issue
Block a user