diff --git a/packages/app/src/Components/TabSelectors/TabSelectors.tsx b/packages/app/src/Components/TabSelectors/TabSelectors.tsx index 93ed4160..3e91a6c2 100644 --- a/packages/app/src/Components/TabSelectors/TabSelectors.tsx +++ b/packages/app/src/Components/TabSelectors/TabSelectors.tsx @@ -12,6 +12,7 @@ export interface Tab { interface TabsProps { tabs: Tab[]; tab: Tab; + className?: string; setTab: (t: Tab) => void; } @@ -23,7 +24,7 @@ export const TabSelector = ({ t, tab, setTab }: TabElementProps) => { return (
{ ); }; -const TabSelectors = ({ tabs, tab, setTab }: TabsProps) => { +const TabSelectors = ({ tabs, tab, className, setTab }: TabsProps) => { const horizontalScroll = useHorizontalScroll(); return ( -
+
{tabs.map((t, index) => ( ))} diff --git a/packages/app/src/Pages/Discover.tsx b/packages/app/src/Pages/Discover.tsx index 2dd171ef..19438901 100644 --- a/packages/app/src/Pages/Discover.tsx +++ b/packages/app/src/Pages/Discover.tsx @@ -1,7 +1,7 @@ import { useState } from "react"; import { useIntl } from "react-intl"; -import { Tab, TabSelector } from "@/Components/TabSelectors/TabSelectors"; +import TabSelectors, { Tab } from "@/Components/TabSelectors/TabSelectors"; import TrendingNotes from "@/Components/Trending/TrendingPosts"; import TrendingUsers from "@/Components/Trending/TrendingUsers"; @@ -9,8 +9,8 @@ export default function Discover() { const { formatMessage } = useIntl(); // tabs const Tabs = { - Posts: { text: formatMessage({ defaultMessage: "Trending Notes", id: "Ix8l+B" }), value: 1 }, - Profiles: { text: formatMessage({ defaultMessage: "Trending People", id: "CVWeJ6" }), value: 0 }, + Posts: { text: formatMessage({ defaultMessage: "Trending Notes" }), value: 1 }, + Profiles: { text: formatMessage({ defaultMessage: "Trending People" }), value: 0 }, }; const [tab, setTab] = useState(Tabs.Profiles); @@ -30,11 +30,7 @@ export default function Discover() { return ( <> -
- {[Tabs.Profiles, Tabs.Posts].map(a => ( - - ))} -
+ {renderTab()} ); diff --git a/packages/app/src/Pages/Profile/ProfilePage.tsx b/packages/app/src/Pages/Profile/ProfilePage.tsx index 1ac4ff70..8f2bfd29 100644 --- a/packages/app/src/Pages/Profile/ProfilePage.tsx +++ b/packages/app/src/Pages/Profile/ProfilePage.tsx @@ -8,11 +8,10 @@ import { useLocation, useNavigate, useParams } from "react-router-dom"; import { ProxyImg } from "@/Components/ProxyImg"; import { SpotlightMediaModal } from "@/Components/Spotlight/SpotlightMedia"; -import { Tab, TabSelector } from "@/Components/TabSelectors/TabSelectors"; +import TabSelectors, { Tab } from "@/Components/TabSelectors/TabSelectors"; import FollowsList from "@/Components/User/FollowListBase"; import MutedList from "@/Components/User/MutedList"; import useFollowsFeed from "@/Feed/FollowsFeed"; -import useHorizontalScroll from "@/Hooks/useHorizontalScroll"; import useLogin from "@/Hooks/useLogin"; import AvatarSection from "@/Pages/Profile/AvatarSection"; import ProfileDetails from "@/Pages/Profile/ProfileDetails"; @@ -67,7 +66,6 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) { const optionalTabs = [ProfileTabSelectors.Zaps, ProfileTabSelectors.Relays, ProfileTabSelectors.Bookmarks].filter(a => unwrap(a), ) as Tab[]; - const horizontalScroll = useHorizontalScroll(); useEffect(() => { if ( @@ -112,7 +110,7 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) { } case ProfileTabType.FOLLOWS: { if (isMe) { - return ; + return ; } else { return ; } @@ -135,10 +133,6 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) { } } - function renderTabSelector(v: Tab) { - return ; - } - const bannerWidth = Math.min(window.innerWidth, 940); return ( @@ -167,16 +161,17 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) {
-
- {[ + + ].concat(isMe ? [...optionalTabs, ProfileTabSelectors.Muted] : optionalTabs)} + className="p" + tab={tab} + setTab={setTab} + />
{tabContent()}
{modalImage && setModalImage("")} media={[modalImage]} idx={0} />} diff --git a/packages/app/src/Pages/onboarding/topics.tsx b/packages/app/src/Pages/onboarding/topics.tsx index 021623fd..3d304b86 100644 --- a/packages/app/src/Pages/onboarding/topics.tsx +++ b/packages/app/src/Pages/onboarding/topics.tsx @@ -18,7 +18,13 @@ export function Topics() { const active = topics.includes(name); return (
setTopics(s => (active ? s.filter(a => a !== name) : appendDedupe(s, [name])))}> {text}
@@ -30,7 +36,9 @@ export function Topics() {

-
{Object.entries(FixedTopics).map(([k, v]) => tab(k, v.text))}
+
+ {Object.entries(FixedTopics).map(([k, v]) => tab(k, v.text))} +
{