import React from 'react'; import { IcTabHome, IcTabCreate, IcTabChat, IcTabInbox } from '../res/icons'; import { useLocation } from 'react-router-dom'; import { useRedditGestures } from '../hooks/useRedditGestures'; const asset = (r: unknown) => { const s = String(r ?? '').trim(); return (!s || s.startsWith('http')) ? s : `/@app-assets/Reddit/${s}`; }; const ANSWERS_TAB_ICON_SRC = asset('tabbar/answers.png'); export const BottomTabBar: React.FC = () => { const { pathname } = useLocation(); const { bindTap } = useRedditGestures(); const getIconColor = (isActive: boolean) => isActive ? 'text-black' : 'text-app-text-muted'; const getLabelClass = (isActive: boolean) => `text-[10px] mt-1 ${isActive ? 'text-black font-medium' : 'text-app-text-muted'}`; const isHome = pathname === '/'; const isCommunities = pathname === '/communities'; const isCreate = pathname === '/create'; const isChat = pathname === '/chat'; const isInbox = pathname === '/inbox'; return (
{/* Home */}
Home
{/* Communities */}
Answers { // if missing asset, don't show a broken icon (e.currentTarget as HTMLImageElement).style.display = 'none'; }} /> Answers
{/* Create */}
Create
{/* Chat */}
Chat
{/* Inbox */}
Inbox
); };