|
|
@@ -23,9 +23,14 @@ import type { NiconicoMetadata, |
|
|
type TheatreInfo = { |
|
|
type TheatreInfo = { |
|
|
hostFlg: boolean |
|
|
hostFlg: boolean |
|
|
postId: number | null |
|
|
postId: number | null |
|
|
postStartedAt: string | null } |
|
|
|
|
|
|
|
|
postStartedAt: string | null |
|
|
|
|
|
watchingUsers: { id: number; name: string }[] } |
|
|
|
|
|
|
|
|
const INITIAL_THEATRE_INFO = { hostFlg: false, postId: null, postStartedAt: null } as const |
|
|
|
|
|
|
|
|
const INITIAL_THEATRE_INFO = |
|
|
|
|
|
{ hostFlg: false, |
|
|
|
|
|
postId: null, |
|
|
|
|
|
postStartedAt: null, |
|
|
|
|
|
watchingUsers: [] as { id: number; name: string }[] } as const |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default (() => { |
|
|
export default (() => { |
|
|
@@ -93,7 +98,7 @@ export default (() => { |
|
|
commentsRef.current?.scrollTo ({ |
|
|
commentsRef.current?.scrollTo ({ |
|
|
top: commentsRef.current.scrollHeight, |
|
|
top: commentsRef.current.scrollHeight, |
|
|
behavior: 'smooth' }) |
|
|
behavior: 'smooth' }) |
|
|
}, [commentsRef]) |
|
|
|
|
|
|
|
|
}, [comments]) |
|
|
|
|
|
|
|
|
useEffect (() => { |
|
|
useEffect (() => { |
|
|
if (!(id)) |
|
|
if (!(id)) |
|
|
@@ -265,7 +270,7 @@ export default (() => { |
|
|
|
|
|
|
|
|
<SidebarComponent> |
|
|
<SidebarComponent> |
|
|
<form |
|
|
<form |
|
|
className="w-full h-5/6" |
|
|
|
|
|
|
|
|
className="w-full h-auto border border-black dark:border-white rounded" |
|
|
onSubmit={async e => { |
|
|
onSubmit={async e => { |
|
|
e.preventDefault () |
|
|
e.preventDefault () |
|
|
|
|
|
|
|
|
@@ -286,25 +291,42 @@ export default (() => { |
|
|
setSending (false) |
|
|
setSending (false) |
|
|
} |
|
|
} |
|
|
}}> |
|
|
}}> |
|
|
|
|
|
<div className="p-2"> |
|
|
|
|
|
現在の同接数:{theatreInfo.watchingUsers.length} |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div className="overflow-x-hidden overflow-y-scroll text-wrap w-full h-32 |
|
|
|
|
|
border rounded"> |
|
|
|
|
|
<ul className="list-inside list-disc"> |
|
|
|
|
|
{theatreInfo.watchingUsers.map (user => ( |
|
|
|
|
|
<li key={user.id} className="px-4 py-1 text-sm"> |
|
|
|
|
|
{user.name || `名もなきニジラー(#${ user.id })`} |
|
|
|
|
|
</li>))} |
|
|
|
|
|
</ul> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div |
|
|
<div |
|
|
ref={commentsRef} |
|
|
ref={commentsRef} |
|
|
className="overflow-x-hidden overflow-y-scroll text-wrap |
|
|
|
|
|
border border-black dark:border-white w-full h-[80vh]"> |
|
|
|
|
|
|
|
|
className="overflow-x-hidden overflow-y-scroll text-wrap w-full |
|
|
|
|
|
h-[32vh] md:h-[64vh] border rounded"> |
|
|
{comments.map (comment => ( |
|
|
{comments.map (comment => ( |
|
|
<div key={comment.no} className="p-2"> |
|
|
<div key={comment.no} className="p-2"> |
|
|
<div className="w-full"> |
|
|
<div className="w-full"> |
|
|
{comment.content} |
|
|
{comment.content} |
|
|
</div> |
|
|
</div> |
|
|
<div className="w-full text-sm text-right"> |
|
|
<div className="w-full text-sm text-right"> |
|
|
by {comment.user ? (comment.user.name || '名もなきニジラー') : '運営'} |
|
|
|
|
|
|
|
|
by {comment.user |
|
|
|
|
|
? (comment.user.name || `名もなきニジラー(#${ comment.user.id })`) |
|
|
|
|
|
: '運営'} |
|
|
</div> |
|
|
</div> |
|
|
<div className="w-full text-sm text-right"> |
|
|
<div className="w-full text-sm text-right"> |
|
|
{dateString (comment.createdAt)} |
|
|
{dateString (comment.createdAt)} |
|
|
</div> |
|
|
</div> |
|
|
</div>))} |
|
|
</div>))} |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<input |
|
|
<input |
|
|
className="w-full p-2 border border-black dark:border-white" |
|
|
|
|
|
|
|
|
className="w-full p-2 border rounded" |
|
|
type="text" |
|
|
type="text" |
|
|
value={content} |
|
|
value={content} |
|
|
onChange={e => setContent (e.target.value)} |
|
|
onChange={e => setContent (e.target.value)} |
|
|
|