about summary refs log tree commit diff
path: root/src/view/screens/PostThread.tsx
blob: 8da40302b7bda8266b7db88c7b71f1ebb3ae0cdc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import React, {useEffect} from 'react'
import {makeRecordUri} from '../lib/strings'
import {PostThread as PostThreadComponent} from '../com/post-thread/PostThread'
import {ScreenParams} from '../routes'
import {useStores} from '../../state'

export const PostThread = ({visible, params}: ScreenParams) => {
  const store = useStores()
  const {name, recordKey} = params
  const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey)

  useEffect(() => {
    if (visible) {
      store.nav.setTitle(`Post by ${name}`)
    }
  }, [visible, store.nav, name])

  return <PostThreadComponent uri={uri} />
}