fix: signup URL and content type filters

- ?signup=1 now opens clean signup form (clears old messages)
- Live filter only shows camera/live/stream (excludes video)
- Video filter shows only recorded videos

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sociowire Dev 2026-01-15 03:33:30 +00:00
parent 1902515d4a
commit 6d9c96e1bd
4 changed files with 25 additions and 11 deletions

View File

@ -40,13 +40,15 @@ export function matchesContentFilter(post, filter) {
case "links":
return cat === "news" || ct === "news";
case "video":
return hasVideo || ct === "video" || ct === "camera";
// Recorded videos only
return ct === "video";
case "image":
return hasImage && !hasVideo && ct !== "camera";
return hasImage && !hasVideo && ct !== "camera" && ct !== "video";
case "text":
return ct === "post" || ct === "text" || ct === "blog" || cat === "friends";
case "live":
return ct === "live" || ct === "stream" || ct === "camera" || hasVideo;
// Only live content: cameras (quebec511), live streams - NOT recorded videos
return ct === "live" || ct === "stream" || ct === "camera";
case "event":
return cat === "event" || cat === "events" || ct === "event";
default:

View File

@ -377,13 +377,14 @@ export default function TopBar({ theme = "dark", onChangeTheme, onIslandsClick,
const prefill = (uname || email || last?.username || last?.email || "").trim();
if (prefill) setLoginUser(prefill);
} else if (truthyParam(signup)) {
const who = (email || uname || last?.email || last?.username || "").trim();
setSignupInfo("✅ " + t('auth.accountCreatedMsg') + (who ? " (" + who + ")" : ""));
setMode("login");
// Open FRESH signup form - clear all old data
try { localStorage.removeItem(LAST_SIGNUP_KEY); } catch {}
setSignupInfo("");
setSignupError("");
setAuthNotice("");
setLoginUser("");
setMode("signup");
setShowAuth(true);
const prefill = (uname || email || last?.username || last?.email || "").trim();
if (prefill) setLoginUser(prefill);
} else if (notice) {
const msg = decodeURIComponent(notice);
if (msg && msg.trim()) {

View File

@ -203,6 +203,17 @@ export default function MapView({
return []; // Empty = All
});
// Content type filter: all, link, picture, live (camera/live/stream)
const CONTENT_TYPE_KEY = "sociowire:contentType";
const [contentTypeFilter, setContentTypeFilter] = useState(() => {
try {
return localStorage.getItem(CONTENT_TYPE_KEY) || "all";
} catch { return "all"; }
});
useEffect(() => {
localStorage.setItem(CONTENT_TYPE_KEY, contentTypeFilter);
}, [contentTypeFilter]);
// Computed subFilter for backend compatibility
const subFilter = subFilters.length === 0 ? "All" :
subFilters.length === 1 ? subFilters[0].split(":")[1] : "All";

View File

@ -1118,8 +1118,8 @@ export function usePostsEngine({
// Map contentFilter to content_type for API
let contentTypeParam = undefined;
if (contentFilter && contentFilter !== "all") {
if (contentFilter === "live") contentTypeParam = "live,camera";
else if (contentFilter === "video") contentTypeParam = "video,camera";
if (contentFilter === "live") contentTypeParam = "live,camera,stream";
else if (contentFilter === "video") contentTypeParam = "video";
else if (contentFilter === "image") contentTypeParam = "image";
else if (contentFilter === "text") contentTypeParam = "post";
else if (contentFilter === "links") contentTypeParam = "news";