1- import { Box , Button , Paper , TextField , Typography } from "@mui/material" ;
21import { useSearchParams } from "next/navigation" ;
32import { useSnackbar } from "notistack" ;
43import { useCallback , useEffect , useRef , useState } from "react" ;
@@ -29,7 +28,9 @@ export function RoomWindow() {
2928 : null ;
3029
3130 if ( ! room ) {
32- return < Typography > 部屋が見つかりません。</ Typography > ;
31+ return (
32+ < div className = "text-center text-gray-600" > 部屋が見つかりません。</ div >
33+ ) ;
3334 }
3435
3536 const {
@@ -163,109 +164,56 @@ export function RoomWindow() {
163164
164165 return (
165166 < >
166- < Box
167- sx = { {
168- position : "fixed" ,
169- width : "100%" ,
170- zIndex : 500 ,
171- backgroundColor : "white" ,
172- top : "56px" ,
173- } }
174- >
167+ < div className = "fixed top-14 z-50 w-full bg-white" >
175168 < RoomHeader room = { room } />
176- </ Box >
177- < Box
178- sx = { {
179- display : "flex" ,
180- flexDirection : "column" ,
181- position : "absolute" ,
182- top : "56px" ,
183- bottom : "56px" ,
184- left : 0 ,
185- right : 0 ,
186- overflowY : "auto" ,
187- } }
188- >
169+ </ div >
170+ < div className = "absolute top-14 right-0 bottom-14 left-0 flex flex-col overflow-y-auto" >
189171 { messages && messages . length > 0 ? (
190- < Box
191- sx = { { flexGrow : 1 , overflowY : "auto" , padding : 1 } }
192- ref = { scrollDiv }
193- >
172+ < div className = "flex-grow overflow-y-auto p-2" ref = { scrollDiv } >
194173 { messages . map ( ( m ) => (
195- < Box
174+ < div
196175 key = { m . id }
197- sx = { {
198- display : "flex" ,
199- justifyContent :
200- m . creator === myId ? "flex-end" : "flex-start" ,
201- marginBottom : 1 ,
202- } }
176+ className = { `mb-2 flex ${
177+ m . creator === myId ? "justify-end" : "justify-start"
178+ } `}
203179 >
204180 { editingMessageId === m . id ? (
205- < Box
206- sx = { {
207- display : "flex" ,
208- flexDirection : "column" ,
209- width : "60%" ,
210- } }
211- >
212- < TextField
181+ < div className = "flex w-3/5 flex-col" >
182+ < textarea
213183 value = { editedContent }
214184 onChange = { ( e ) => setEditedContent ( e . target . value ) }
215185 onKeyDown = { ( e ) => {
216186 if ( ( e . metaKey || e . ctrlKey ) && e . key === "Enter" ) {
217187 commitEdit ( editingMessageId , editedContent ) ;
218188 }
219189 } }
220- fullWidth
221- variant = "outlined"
222- multiline
223- rows = { 3 }
190+ className = "textarea textarea-bordered h-24 w-full"
224191 />
225- < Box
226- sx = { {
227- display : "flex" ,
228- gap : 1 ,
229- marginTop : 1 ,
230- justifyContent : "space-evenly" ,
231- } }
232- >
233- < Button
234- variant = "contained"
192+ < div className = "mt-2 flex justify-evenly gap-2" >
193+ { /* biome-ignore lint/a11y/useButtonType: <explanation> */ }
194+ < button
195+ className = "btn btn-primary"
235196 onClick = { ( ) =>
236197 commitEdit ( editingMessageId , editedContent )
237198 }
238- sx = { { minWidth : 100 } }
239199 >
240200 保存
241- </ Button >
242- < Button
243- variant = "outlined"
244- onClick = { cancelEdit }
245- sx = { { minWidth : 100 } }
246- >
201+ </ button >
202+ { /* biome-ignore lint/a11y/useButtonType: <explanation> */ }
203+ < button className = "btn btn-outline" onClick = { cancelEdit } >
247204 キャンセル
248- </ Button >
249- </ Box >
250- </ Box >
205+ </ button >
206+ </ div >
207+ </ div >
251208 ) : (
252- < Paper
253- sx = { {
254- display : "flex" ,
255- maxWidth : "60%" ,
256- padding : 1 ,
257- borderRadius : 2 ,
258- backgroundColor :
259- m . creator === myId ? "secondary.main" : "#FFF" ,
260- boxShadow : 1 ,
261- border : 1 ,
262- } }
209+ < div
210+ className = { `rounded-xl p-2 shadow ${
211+ m . creator === myId ? "bg-secondary" : "bg-white"
212+ } `}
263213 >
264- < Typography
265- sx = { { wordBreak : "break-word" , whiteSpace : "pre-wrap" } }
266- >
214+ < p className = "whitespace-pre-wrap break-words" >
267215 { m . content }
268- </ Typography >
216+ </ p >
269217 { m . creator === myId && (
270218 < Dots
271219 actions = { [
@@ -289,26 +237,20 @@ export function RoomWindow() {
289237 ] }
290238 />
291239 ) }
292- </ Paper >
240+ </ div >
293241 ) }
294- </ Box >
242+ </ div >
295243 ) ) }
296- </ Box >
244+ </ div >
297245 ) : (
298- < Typography > 最初のメッセージを送ってみましょう!</ Typography >
246+ < div className = "text-center text-gray-500" >
247+ 最初のメッセージを送ってみましょう!
248+ </ div >
299249 ) }
300- </ Box >
301- < Box
302- sx = { {
303- position : "fixed" ,
304- bottom : "52px" ,
305- width : "100%" ,
306- backgroundColor : "#fff" ,
307- padding : "0px" ,
308- } }
309- >
250+ </ div >
251+ < div className = "fixed bottom-0 w-full bg-white p-0" >
310252 < MessageInput send = { sendDMMessage } room = { room } />
311- </ Box >
253+ </ div >
312254 </ >
313255 ) ;
314256}
0 commit comments