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

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

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

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

@ -3,11 +3,11 @@ import { useFetchProfile } from '@/hooks' @@ -3,11 +3,11 @@ import { useFetchProfile } from '@/hooks'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
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)
return (
<SecondaryPageLayout index={index} title={profile?.username} displayScrollToTopButton ref={ref}>
<SecondaryPageLayout index={index} title={hideTitlebar ? undefined : profile?.username} displayScrollToTopButton ref={ref}>
<Profile id={id} />
</SecondaryPageLayout>
)

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

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

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

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

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

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

Loading…
Cancel
Save