Back to list
Smarter-Poker

social-community

by Smarter-Poker

Smarter-Poker-World-Hub

0🍴 0📅 Jan 26, 2026

SKILL.md


name: Social & Community description: "Build social features including posts, comments, likes, and user interactions. READ BEFORE MODIFYING ANY SOCIAL MEDIA CODE."

🛡️ Social Media Protection & Development Guide

🚨 CRITICAL: This skill documents ALL working features in the social hub. Before making ANY change to social-media.js or related files, you MUST verify all features still work after your changes.

Why This Exists

The social media page (/hub/social-media.js) is a 2700+ line file with 60+ functions that powers the entire social experience. It has been broken and rebuilt MULTIPLE times. Small changes have catastrophic consequences.


Complete Feature Registry

📰 Feed & Posts (WORKING - DO NOT BREAK)

FeatureLocationState VariablesProps
Post FeedLines 1669-1866posts, feedOffset, hasMorePosts-
Post CardLines 1072-1300-onOpenArticle, onLike, onComment
Create PostLines 850-1070isPosting, postContent, media-
Infinite ScrollLines 1868-1919loadingMore, feedCycle-
Like/ReactLines 2008-2020-via PostCard
Delete PostLines 2022-2025--

📖 Stories (WORKING - DO NOT BREAK)

FeatureLocationStateComponent
Stories BarLine ~2330stories from API<StoriesBar />
Story ViewerExternal component-StoriesBar handles

🎬 Reels (WORKING - DO NOT BREAK)

FeatureLocationNotes
Reels CarouselLine ~2510Inserted after every 3 posts
Reel ViewerExternal componentOpens full-screen

📰 Article Reader (WORKING - DO NOT BREAK)

FeatureLocationStateDependencies
Article CardPostCard ~1186-1200-onOpenArticle prop
Reader ModalLine ~2509articleReader: {open, url, title}ArticleReaderModal
In-App Display--/api/proxy route

Critical Flow:

PostCard → onOpenArticle → setArticleReader → ArticleReaderModal

🔴 Live Streaming (WORKING - DO NOT BREAK)

FeatureLocationStateComponents
Go Live ButtonLine ~2360showGoLiveModalGoLiveModal
Live Stream CardsLine ~2380liveStreamsLiveStreamCard
Stream ViewerLine ~2400watchingStreamLiveStreamViewer

💬 Chat Windows (WORKING - DO NOT BREAK)

FeatureLocationState
Chat PopupsLine ~2668openChats, chatMsgs
Send MessageLine 2119-2126via fn_send_message

🔔 Notifications (WORKING - DO NOT BREAK)

FeatureLocationState
Notification BellLine ~2650notifications
Unread CountLine ~2652-2653filtered from notifications
Mark as ReadLines 1655-1667auto on dropdown open

🔍 Search (WORKING - DO NOT BREAK)

FeatureLocationState
User SearchLines 2041-2050searchResults
Global SearchLines 2052-2098globalSearchResults

Verification Checklist

Before committing ANY change, manually verify:

  • Feed loads (scroll should show posts)
  • Posts have author avatar and name
  • Posts with images show images
  • Posts with videos show video player
  • Posts with articles show proper thumbnail card
  • Clicking article opens IN-APP modal (NOT new tab!)
  • Like button works (updates count)
  • Comment button opens comment section
  • Stories bar shows at top
  • Clicking story opens viewer
  • Reels carousel appears between posts
  • Notifications bell shows count
  • Search finds users
  • Chat windows open/work
  • New post creation works

Common Breakages & How to Avoid

The Article Reader Pattern

// ❌ BREAKS IT - removes the modal handler
<PostCard post={p} />

// ✅ CORRECT - passes the modal handler
<PostCard 
    post={p} 
    onOpenArticle={(url, title) => setArticleReader({ open: true, url, title })} 
/>

The FK Join Pattern

// ❌ BREAKS IT - crashes on null profile
const author = authorMap[post.author_id].username;

// ✅ CORRECT - handles null gracefully
const author = authorMap[post.author_id]?.username || 'Player';

The Filter Pattern

// ❌ BREAKS IT - silently removes items
items.filter(item => item.profile);

// ✅ CORRECT - keeps with fallback
items.map(item => ({ ...item, profile: item.profile || DEFAULT }));

Files That Affect Social Media

pages/hub/social-media.js          # Main file - 2700+ lines
src/components/social/Stories.jsx   # Stories component
src/components/social/PostCard.jsx  # If extracted
src/components/social/ArticleReaderModal.jsx
src/services/UnifiedSocialService.js
services/MessagingService.js
src/stores/socialStore.js
pages/api/proxy.js                 # Article reader backend

Before You Start

  1. Read the workflow: /social-feed-protection
  2. Run tests: node scripts/test-article-reader.js
  3. Understand the feature you're changing: Read this skill
  4. Make minimal changes: One feature at a time
  5. Test EVERYTHING: Use the checklist above

The Golden Rule

If you don't understand how a feature works, DON'T MODIFY IT.

Ask questions first. Break nothing. Test everything.

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon