33 useCreateDocumentMutation ,
44 useGetWorkspaceDocumentListQuery ,
55} from "../../hooks/api/workspaceDocument" ;
6- import { useDeleteWorkSpaceMutation , useGetWorkspaceQuery } from "../../hooks/api/workspace" ;
6+ import { useGetWorkspaceQuery } from "../../hooks/api/workspace" ;
77import {
88 Backdrop ,
99 Box ,
@@ -25,8 +25,6 @@ import CreateModal from "../../components/modals/CreateModal";
2525import AddIcon from "@mui/icons-material/Add" ;
2626import BoardTab from "../../components/workspace/BoardTab" ;
2727import TableTab from "../../components/workspace/TableTab" ;
28- import DeleteIcon from "@mui/icons-material/Delete" ;
29- import DeleteModal from "../../components/modals/DeleteModal" ;
3028
3129const TABS = [ "BOARD" , "TABLE" ] as const ;
3230type TabType = ( typeof TABS ) [ number ] ;
@@ -52,9 +50,6 @@ function WorkspaceIndex() {
5250 const { mutateAsync : createDocument } = useCreateDocumentMutation ( workspace ?. id || "" ) ;
5351 const [ createDocumentModalOpen , setCreateDocumentModalOpen ] = useState ( false ) ;
5452
55- const { mutateAsync : deleteWorkspace } = useDeleteWorkSpaceMutation ( workspace ?. id ) ;
56- const [ deleteWorkspaceModalOpen , setDeleteWorkspaceModalOpen ] = useState ( false ) ;
57-
5853 const documentList = useMemo ( ( ) => {
5954 return (
6055 documentPageList ?. pages . reduce ( ( prev , page ) => {
@@ -85,16 +80,6 @@ function WorkspaceIndex() {
8580 setSearch ( e . target . value ) ;
8681 } ;
8782
88- const handleDeleteWorkspaceModalOpen = ( ) => {
89- setDeleteWorkspaceModalOpen ( ( prev ) => ! prev ) ;
90- } ;
91-
92- const handleDeleteWorkspace = async ( ) => {
93- await deleteWorkspace ( ) ;
94- setDeleteWorkspaceModalOpen ( false ) ;
95- navigate ( "/" , { replace : true } ) ;
96- } ;
97-
9883 return (
9984 < Stack position = "relative" pb = { 6 } >
10085 < Paper
@@ -104,24 +89,35 @@ function WorkspaceIndex() {
10489 top : 64 ,
10590 left : 0 ,
10691 width : "100%" ,
107- pb : 4 ,
92+ pb : { xs : 2 , sm : 4 } ,
10893 zIndex : 3 ,
10994 } }
11095 >
111- < Stack direction = "row" justifyContent = "space-between" alignItems = "center" pt = { 6 } >
112- < Typography variant = "h5" fontWeight = "bold" >
113- { workspace ?. title } { " " }
96+ < Stack
97+ direction = { { xs : "column" , sm : "row" } }
98+ justifyContent = "space-between"
99+ alignItems = { { xs : "flex-start" , sm : "center" } }
100+ gap = { 2 }
101+ pt = { { xs : 2 , sm : 6 } }
102+ >
103+ < Typography
104+ variant = "h6"
105+ fontWeight = "bold"
106+ sx = { { fontSize : { xs : "1rem" , sm : "1.25rem" } } }
107+ >
108+ Documents{ " " }
114109 < Typography component = "span" variant = "inherit" color = "primary" >
115110 { documentPageList ?. pages [ 0 ] . totalLength }
116111 </ Typography >
117112 </ Typography >
118- < Stack direction = "row" alignItems = "center" gap = { 2 } >
113+ < Stack direction = "row" alignItems = "center" gap = { 2 } flexWrap = "wrap" >
119114 < TextField
120- placeholder = "Search notes ..."
115+ placeholder = "Search documents ..."
121116 variant = "outlined"
122117 value = { search }
123118 onChange = { handleSearchChange }
124119 size = "small"
120+ sx = { { minWidth : { xs : "100%" , sm : 200 } } }
125121 slotProps = { {
126122 input : {
127123 startAdornment : (
@@ -136,31 +132,25 @@ function WorkspaceIndex() {
136132 variant = "contained"
137133 startIcon = { < AddIcon /> }
138134 onClick = { handleCreateDocumentModalOpen }
135+ sx = { { minWidth : { xs : "100%" , sm : "auto" } } }
139136 >
140- New Note
137+ New Document
141138 </ Button >
142- { /* NOTE(kokodak): Delete workspace button should be visible after
143- the following requirements are met:
144- - Members should NOT see the delete button.
145- - Even Owners should go through an extra confirmation step before delete.
146- Once these requirements are met, we can safely remove the MODE condition below.
147- For more details, see PR #556: https://github.com/yorkie-team/codepair/pull/556
148- */ }
149- { import . meta. env . MODE !== "production" && (
150- < Button
151- variant = "contained"
152- color = "error"
153- startIcon = { < DeleteIcon /> }
154- onClick = { handleDeleteWorkspaceModalOpen }
155- >
156- Delete
157- </ Button >
158- ) }
159139 </ Stack >
160140 </ Stack >
161141 </ Paper >
162- < Box sx = { { borderBottom : 1 , borderColor : "divider" } } mb = { 4 } >
163- < Tabs value = { currentTab } onChange = { handleTabChange } >
142+ < Box sx = { { borderBottom : 1 , borderColor : "divider" } } mb = { { xs : 2 , sm : 4 } } >
143+ < Tabs
144+ value = { currentTab }
145+ onChange = { handleTabChange }
146+ sx = { {
147+ minHeight : { xs : 40 , sm : 48 } ,
148+ "& .MuiTab-root" : {
149+ minHeight : { xs : 40 , sm : 48 } ,
150+ py : { xs : 1 , sm : 1.5 } ,
151+ } ,
152+ } }
153+ >
164154 { TABS . map ( ( tab ) => (
165155 < Tab key = { tab } label = { tab } value = { tab } />
166156 ) ) }
@@ -187,12 +177,6 @@ function WorkspaceIndex() {
187177 onSuccess = { handleCreateWorkspace }
188178 onClose = { handleCreateDocumentModalOpen }
189179 />
190- < DeleteModal
191- open = { deleteWorkspaceModalOpen }
192- title = { workspace ?. title }
193- onSuccess = { handleDeleteWorkspace }
194- onClose = { handleDeleteWorkspaceModalOpen }
195- />
196180 </ Stack >
197181 ) ;
198182}
0 commit comments