/* Me2You - Discovery Feed: TikTok-style vertical swipe of listings.
Discovery only. Tap "Shop this item" to open the normal protected
escrow listing. Strictly C2C. */
/* global React, Icon, Price, PRODUCTS, btnPrimary, btnGhost */
const { useState: useFeedState } = React;
/* --- One action button on the right rail: icon + word, always paired --- */
function FeedAction({ icon, label, count, active, accent, onClick }) {
return (
);
}
/* --- A single full-screen feed card --- */
function FeedCard({ product, onShop, onMessage }) {
const [liked, setLiked] = useFeedState(false);
const [following, setFollowing] = useFeedState(false);
const [playing, setPlaying] = useFeedState(false);
const likeCount = (product.reviews || 12) + (liked ? 1 : 0);
return (
{/* Media area */}
{/* Tap-to-play (no autoplay sound: muted by default for low-data, public spaces) */}
Muted - tap to play
{/* Right action rail */}
setLiked(v => !v)}/>
onMessage && onMessage(product)}/>
{}}/>
setFollowing(v => !v)}/>
onShop(product)}/>
{/* Info + Shop CTA */}
{product.title}
R {product.price.toLocaleString('en-ZA')}
{product.seller} - {product.location}
Escrow protected
);
}
/* --- Feed screen: vertical, snap-scrolling column --- */
function FeedScreen({ onShop, onMessage }) {
const [tab, setTab] = useFeedState('for-you');
const items = PRODUCTS.slice(0, 6);
const tabs = [
{ key:'for-you', label:'For you' },
{ key:'nearby', label:'Nearby' },
{ key:'following', label:'Following' },
];
return (
Discover
Swipe through short clips. Tap Shop to buy on the protected listing.
{/* For you / Nearby / Following */}
{tabs.map(t => (
))}
{items.map(p => (
))}
);
}
Object.assign(window, { FeedScreen, FeedCard, FeedAction });