refactor
This commit is contained in:
@@ -11,7 +11,7 @@ import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { ExtendedKind } from '@/constants'
|
||||
import { useFetchEvent } from '@/hooks'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { getParentEventId, getParentEventTag, getRootEventId, isPictureEvent } from '@/lib/event'
|
||||
import { getParentBech32Id, getParentETag, getRootBech32Id, isPictureEvent } from '@/lib/event'
|
||||
import { toNote, toNoteList } from '@/lib/link'
|
||||
import { tagNameEquals } from '@/lib/tag'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -24,8 +24,8 @@ import NotFoundPage from '../NotFoundPage'
|
||||
const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => {
|
||||
const { t } = useTranslation()
|
||||
const { event, isFetching } = useFetchEvent(id)
|
||||
const parentEventId = useMemo(() => getParentEventId(event), [event])
|
||||
const rootEventId = useMemo(() => getRootEventId(event), [event])
|
||||
const parentEventId = useMemo(() => getParentBech32Id(event), [event])
|
||||
const rootEventId = useMemo(() => getRootBech32Id(event), [event])
|
||||
const rootITag = useMemo(
|
||||
() => (event?.kind === ExtendedKind.COMMENT ? event.tags.find(tagNameEquals('I')) : undefined),
|
||||
[event]
|
||||
@@ -173,7 +173,7 @@ function ParentNote({
|
||||
}
|
||||
|
||||
function isConsecutive(rootEvent?: Event, parentEvent?: Event) {
|
||||
const eTag = getParentEventTag(parentEvent)
|
||||
const eTag = getParentETag(parentEvent)
|
||||
if (!eTag) return false
|
||||
|
||||
return rootEvent?.id === eTag[1]
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Input } from '@/components/ui/input'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { RECOMMENDED_BLOSSOM_SERVERS } from '@/constants'
|
||||
import { createBlossomServerListDraftEvent } from '@/lib/draft-event'
|
||||
import { extractServersFromTags } from '@/lib/event'
|
||||
import { getServersFromServerTags } from '@/lib/tag'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import client from '@/services/client.service'
|
||||
@@ -18,7 +18,7 @@ export default function BlossomServerListSetting() {
|
||||
const { pubkey, publish } = useNostr()
|
||||
const [blossomServerListEvent, setBlossomServerListEvent] = useState<Event | null>(null)
|
||||
const serverUrls = useMemo(() => {
|
||||
return extractServersFromTags(blossomServerListEvent ? blossomServerListEvent.tags : [])
|
||||
return getServersFromServerTags(blossomServerListEvent ? blossomServerListEvent.tags : [])
|
||||
}, [blossomServerListEvent])
|
||||
const [url, setUrl] = useState('')
|
||||
const [removingIndex, setRemovingIndex] = useState(-1)
|
||||
|
||||
@@ -6,9 +6,9 @@ import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { isEmail } from '@/lib/common'
|
||||
import { createProfileDraftEvent } from '@/lib/draft-event'
|
||||
import { generateImageByPubkey } from '@/lib/pubkey'
|
||||
import { isEmail } from '@/lib/utils'
|
||||
import { useSecondaryPage } from '@/PageManager'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { Loader, Upload } from 'lucide-react'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { isEmail } from '@/lib/common'
|
||||
import { createProfileDraftEvent } from '@/lib/draft-event'
|
||||
import { isEmail } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { Loader } from 'lucide-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
Reference in New Issue
Block a user