Browse Source

Discussion view updated

imwald
Silberengel 5 months ago
parent
commit
b77ea7d78e
  1. 12
      src/pages/primary/DiscussionsPage/index.tsx
  2. 4
      src/pages/secondary/NoteListPage/index.tsx
  3. 4
      src/pages/secondary/ProfilePage/index.tsx
  4. 4
      src/pages/secondary/RelayPage/index.tsx
  5. 4
      src/pages/secondary/RelayReviewsPage/index.tsx
  6. 6
      src/pages/secondary/SearchPage/index.tsx

12
src/pages/primary/DiscussionsPage/index.tsx

@ -19,7 +19,7 @@ import SubtopicFilter from '@/pages/primary/DiscussionsPage/SubtopicFilter'
import TopicSubscribeButton from '@/components/TopicSubscribeButton' import TopicSubscribeButton from '@/components/TopicSubscribeButton'
import { NostrEvent } from 'nostr-tools' import { NostrEvent } from 'nostr-tools'
import client from '@/services/client.service' import client from '@/services/client.service'
import { useSecondaryPage } from '@/PageManager' import { useSmartNoteNavigation } from '@/PageManager'
import { toNote } from '@/lib/link' import { toNote } from '@/lib/link'
import { kinds } from 'nostr-tools' import { kinds } from 'nostr-tools'
@ -107,7 +107,7 @@ const DiscussionsPage = forwardRef((_, ref) => {
const { t } = useTranslation() const { t } = useTranslation()
const { favoriteRelays } = useFavoriteRelays() const { favoriteRelays } = useFavoriteRelays()
const { pubkey } = useNostr() const { pubkey } = useNostr()
const { push } = useSecondaryPage() const { navigateToNote } = useSmartNoteNavigation()
// State management // State management
const [selectedTopic, setSelectedTopic] = useState('all') const [selectedTopic, setSelectedTopic] = useState('all')
@ -718,7 +718,7 @@ const DiscussionsPage = forwardRef((_, ref) => {
thread={event} thread={event}
subtopics={availableSubtopics} subtopics={availableSubtopics}
onThreadClick={() => { onThreadClick={() => {
push(toNote(event)) navigateToNote(toNote(event))
}} }}
/> />
))} ))}
@ -760,7 +760,7 @@ const DiscussionsPage = forwardRef((_, ref) => {
thread={event} thread={event}
subtopics={availableSubtopics} subtopics={availableSubtopics}
onThreadClick={() => { onThreadClick={() => {
push(toNote(event)) navigateToNote(toNote(event))
}} }}
/> />
))} ))}
@ -841,7 +841,7 @@ const DiscussionsPage = forwardRef((_, ref) => {
subtopics={threadSubtopics} subtopics={threadSubtopics}
primaryTopic={entry?.categorizedTopic} primaryTopic={entry?.categorizedTopic}
onThreadClick={() => { onThreadClick={() => {
push(toNote(event)) navigateToNote(toNote(event))
}} }}
/> />
) )
@ -866,7 +866,7 @@ const DiscussionsPage = forwardRef((_, ref) => {
subtopics={threadSubtopics} subtopics={threadSubtopics}
primaryTopic={entry?.categorizedTopic} primaryTopic={entry?.categorizedTopic}
onThreadClick={() => { onThreadClick={() => {
push(toNote(event)) navigateToNote(toNote(event))
}} }}
/> />
) )

4
src/pages/secondary/NoteListPage/index.tsx

@ -14,7 +14,7 @@ import { UserRound } from 'lucide-react'
import React, { forwardRef, useEffect, useState } from 'react' import React, { forwardRef, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => { const NoteListPage = forwardRef(({ index, hideTitlebar = false }: { index?: number; hideTitlebar?: boolean }, ref) => {
const { t } = useTranslation() const { t } = useTranslation()
const { push } = useSecondaryPage() const { push } = useSecondaryPage()
const { relayList, pubkey } = useNostr() const { relayList, pubkey } = useNostr()
@ -130,7 +130,7 @@ const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
<SecondaryPageLayout <SecondaryPageLayout
ref={ref} ref={ref}
index={index} index={index}
title={title} title={hideTitlebar ? undefined : title}
controls={controls} controls={controls}
displayScrollToTopButton displayScrollToTopButton
> >

4
src/pages/secondary/ProfilePage/index.tsx

@ -3,11 +3,11 @@ import { useFetchProfile } from '@/hooks'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { forwardRef } from 'react' import { forwardRef } from 'react'
const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { const ProfilePage = forwardRef(({ id, index, hideTitlebar = false }: { id?: string; index?: number; hideTitlebar?: boolean }, ref) => {
const { profile } = useFetchProfile(id) const { profile } = useFetchProfile(id)
return ( return (
<SecondaryPageLayout index={index} title={profile?.username} displayScrollToTopButton ref={ref}> <SecondaryPageLayout index={index} title={hideTitlebar ? undefined : profile?.username} displayScrollToTopButton ref={ref}>
<Profile id={id} /> <Profile id={id} />
</SecondaryPageLayout> </SecondaryPageLayout>
) )

4
src/pages/secondary/RelayPage/index.tsx

@ -4,7 +4,7 @@ import { normalizeUrl, simplifyUrl } from '@/lib/url'
import { forwardRef, useMemo } from 'react' import { forwardRef, useMemo } from 'react'
import NotFoundPage from '../NotFoundPage' import NotFoundPage from '../NotFoundPage'
const RelayPage = forwardRef(({ url, index }: { url?: string; index?: number }, ref) => { const RelayPage = forwardRef(({ url, index, hideTitlebar = false }: { url?: string; index?: number; hideTitlebar?: boolean }, ref) => {
const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url]) const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url])
const title = useMemo(() => (url ? simplifyUrl(url) : undefined), [url]) const title = useMemo(() => (url ? simplifyUrl(url) : undefined), [url])
@ -13,7 +13,7 @@ const RelayPage = forwardRef(({ url, index }: { url?: string; index?: number },
} }
return ( return (
<SecondaryPageLayout ref={ref} index={index} title={title} displayScrollToTopButton> <SecondaryPageLayout ref={ref} index={index} title={hideTitlebar ? undefined : title} displayScrollToTopButton>
<Relay url={normalizedUrl} /> <Relay url={normalizedUrl} />
</SecondaryPageLayout> </SecondaryPageLayout>
) )

4
src/pages/secondary/RelayReviewsPage/index.tsx

@ -6,7 +6,7 @@ import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import NotFoundPage from '../NotFoundPage' import NotFoundPage from '../NotFoundPage'
const RelayReviewsPage = forwardRef(({ url, index }: { url?: string; index?: number }, ref) => { const RelayReviewsPage = forwardRef(({ url, index, hideTitlebar = false }: { url?: string; index?: number; hideTitlebar?: boolean }, ref) => {
const { t } = useTranslation() const { t } = useTranslation()
const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url]) const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url])
const title = useMemo( const title = useMemo(
@ -19,7 +19,7 @@ const RelayReviewsPage = forwardRef(({ url, index }: { url?: string; index?: num
} }
return ( return (
<SecondaryPageLayout ref={ref} index={index} title={title} displayScrollToTopButton> <SecondaryPageLayout ref={ref} index={index} title={hideTitlebar ? undefined : title} displayScrollToTopButton>
<NoteList <NoteList
showKinds={[ExtendedKind.RELAY_REVIEW]} showKinds={[ExtendedKind.RELAY_REVIEW]}
subRequests={[ subRequests={[

6
src/pages/secondary/SearchPage/index.tsx

@ -8,7 +8,7 @@ import { TSearchParams } from '@/types'
import { ChevronLeft } from 'lucide-react' import { ChevronLeft } from 'lucide-react'
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react' import { forwardRef, useEffect, useMemo, useRef, useState } from 'react'
const SearchPage = forwardRef(({ index }: { index?: number }, ref) => { const SearchPage = forwardRef(({ index, hideTitlebar = false }: { index?: number; hideTitlebar?: boolean }, ref) => {
const { push, pop } = useSecondaryPage() const { push, pop } = useSecondaryPage()
const [input, setInput] = useState('') const [input, setInput] = useState('')
const searchBarRef = useRef<TSearchBarRef>(null) const searchBarRef = useRef<TSearchBarRef>(null)
@ -49,14 +49,14 @@ const SearchPage = forwardRef(({ index }: { index?: number }, ref) => {
<SecondaryPageLayout <SecondaryPageLayout
ref={ref} ref={ref}
index={index} index={index}
titlebar={ titlebar={hideTitlebar ? undefined : (
<div className="flex items-center gap-1 h-full"> <div className="flex items-center gap-1 h-full">
<Button variant="ghost" size="titlebar-icon" onClick={() => pop()}> <Button variant="ghost" size="titlebar-icon" onClick={() => pop()}>
<ChevronLeft /> <ChevronLeft />
</Button> </Button>
<SearchBar ref={searchBarRef} input={input} setInput={setInput} onSearch={onSearch} /> <SearchBar ref={searchBarRef} input={input} setInput={setInput} onSearch={onSearch} />
</div> </div>
} )}
displayScrollToTopButton displayScrollToTopButton
> >
<SearchResult searchParams={searchParams} /> <SearchResult searchParams={searchParams} />

Loading…
Cancel
Save