ഉള്ളടക്കത്തിലേക്ക് പോകുക
Yuva discussions hooksമെനു

Yuva discussions hooks

A React provider and hooks over the useyuva headless client: discussions of a page, one thread, reader sign-in, the channel's discussion mode and page ratings. Labels with English defaults.

readersigned out

Loading

പ്രിവ്യൂ സാമ്പിൾ ഡാറ്റയിലാണ് പ്രവർത്തിക്കുന്നത്. നെറ്റ്‌വർക്കോ ചാനലോ വേണ്ട.

ഇൻസ്റ്റലേഷൻ

ഇത് ഒരു shadcn പ്രോജക്റ്റിൽ പ്രവർത്തിപ്പിക്കുക. ഫയലുകൾ നിങ്ങളുടെ സ്വന്തം കോഡിലേക്ക് പകർത്തപ്പെടും.

Shell
npx shadcn@latest add https://useyuva.com/r/use-yuva-discussions.json

ഉപയോഗം

tsx
import { useDiscussions, YuvaDiscussionsProvider } from "@/hooks/use-yuva-discussions"

const { discussions, loading } = useDiscussions(page, "top")

Props

YuvaDiscussionsProviderProps

Propതരം
server?string
channel?string
identityToken?IdentityTokenSource | null
client?YuvaClient
labels?Partial<YuvaDiscussionsLabels>
locale?string
children?React.ReactNode

DiscussionsResult

Propതരം
discussionsDiscussion[]
loadingboolean
errorunknown
hasMoreboolean
loadMore() => Promise<void>
reload() => Promise<void>
start(input: Omit<ClientDiscussionCreate, "page_url"> & { page_url?: string }) => Promise<Discussion>

DiscussionResult

Propതരം
discussionDiscussion | null
openingDiscussionPost | null
postsDiscussionPost[]
loadingboolean
errorunknown
reload() => Promise<void>
reply(body: string, parentPostId?: string) => Promise<DiscussionPost>
vote(post: DiscussionPost) => Promise<void>
follow(following: boolean) => Promise<void>
accept(postId: string | null) => Promise<void>
edit(postId: string, input: ClientDiscussionPostUpdate) => Promise<void>
remove(postId: string) => Promise<boolean>

YuvaReaderState

Propതരം
readerReaderSession | null
writerYuvaWriter
readyboolean
signIn() => Promise<ReaderSession>
signOut() => Promise<void>

ലേബലുകൾ

ഓരോ ലേബലിനും ഇംഗ്ലീഷ് ഡിഫോൾട്ട് ഉണ്ട്. അവ മാറ്റാനോ വിവർത്തനം ചെയ്യാനോ labels ഒബ്ജക്റ്റിന്റെ ഒരു ഭാഗം നൽകുക.

ലേബൽഡിഫോൾട്ട്
heading"Discussions"
sortNew"New"
sortTop"Top"
sortUnanswered"Unanswered"
newDiscussion"New discussion"
empty"No discussions on this page yet. Start the first one."
emptyUnanswered"Every discussion on this page has an answer."
loadMore"Load more"
loadError"Discussions could not be loaded."
retry"Try again"
back"All discussions"
replies(count) => (count === 1 ? "1 reply" : `${count} replies`)
votes(count) => (count === 1 ? "1 vote" : `${count} votes`)
answered"Answered"
acceptedAnswer"Accepted answer"
markAnswer"Mark as answer"
unmarkAnswer"Unmark as answer"
locked"Locked"
lockedNote"This discussion is locked. It takes no new replies."
pending"Awaiting approval"
pendingNote"Only you can see this until a moderator approves it."
upvote"Upvote"
removeUpvote"Remove upvote"
reply"Reply"
follow"Follow"
unfollow"Unfollow"
edit"Edit"
save"Save"
cancel"Cancel"
delete"Delete"
deleteConfirm"Delete this post?"
edited"edited"
deletedPost"This post was deleted."
deletedAuthor"Deleted reader"
deletedMember"Deleted member"
anonymous"Anonymous"
team"Team"
signIn"Sign in"
signInHint"Sign in to start a discussion, reply and vote."
signOut"Sign out"
signedInAs(name) => `Signed in as ${name}`
titleLabel"Title"
titlePlaceholder"What is your question or idea?"
bodyLabel"Message"
bodyPlaceholder"Add the details. Markdown works."
replyPlaceholder"Write a reply. Markdown works."
write"Write"
preview"Preview"
previewEmpty"Nothing to preview."
markdownHint"Markdown is supported."
startDiscussion"Start discussion"
postReply"Reply"
errorSignIn"Sign in to post."
errorLocked"This discussion is locked."
errorEditWindow"Posts can be edited for 30 minutes after posting."
errorRateLimited"Too many posts. Wait a minute and try again."
errorPopupBlocked"Allow pop-ups for this site to sign in."
errorOff"Discussions are turned off."
errorGeneric"Something went wrong. Try again."
feedbackQuestion"Was this page helpful?"
feedbackYes"Yes"
feedbackNo"No"
feedbackThanks"Thanks for your feedback."

ആശ്രിതത്വങ്ങൾ

ഈ ഇനം ഇൻസ്റ്റാൾ ചെയ്യുമ്പോൾ താഴെയുള്ളവയും ചേർക്കപ്പെടും.

npm പാക്കേജുകൾ