@@ -5,11 +5,12 @@ import {
55 mdiDotsVertical ,
66 mdiEarth ,
77 mdiFileEditOutline ,
8+ mdiFileTreeOutline ,
89 mdiPackageDown ,
910 mdiShare ,
1011 mdiStar ,
1112 mdiStarOutline ,
12- mdiUpload ,
13+ mdiUpload
1314} from "@mdi/js" ;
1415import Icon from "@mdi/react" ;
1516import {
@@ -22,7 +23,7 @@ import {
2223 MenuItem ,
2324 Skeleton ,
2425 Stack ,
25- Tooltip ,
26+ Tooltip
2627} from "@mui/material" ;
2728import { push } from "connected-react-router" ;
2829import R from "ramda" ;
@@ -33,6 +34,7 @@ import { useParams } from "react-router";
3334import { Link } from "react-router-dom" ;
3435import LinkComponent from "_atoms/LinkComponent" ;
3536import TypeIcon from "_atoms/TypeIcon" ;
37+ import ItemList from "_frontend/components/organisms/ItemList" ;
3638import { dateElapsed , dateToString } from "_frontend/utils/date" ;
3739import BreadCrumbs from "_molecules/BreadCrumbs" ;
3840import Editor from "_molecules/Editor" ;
@@ -42,12 +44,12 @@ import {
4244 attemptDeleteItem ,
4345 attemptGetItem ,
4446 attemptGetItemChildren ,
45- attemptPublishItem ,
47+ attemptPublishItem
4648} from "_thunks/item" ;
4749import {
4850 attemptAddBookmark ,
4951 attemptGetUser ,
50- attemptRemoveBookmark ,
52+ attemptRemoveBookmark
5153} from "_thunks/user" ;
5254import { deepEqual } from "_utils/compare" ;
5355
@@ -127,11 +129,6 @@ export default function ItemPage() {
127129 dispatch ( attemptGetItem ( itemId ) )
128130 . then ( ( item ) => {
129131 setItem ( item ) ;
130- if ( item . type !== "card" ) {
131- dispatch ( attemptGetItemChildren ( item . path ) ) . then ( ( items ) => {
132- setItemChildren ( items ) ;
133- } ) ;
134- }
135132 } )
136133 . catch ( ( ) => setVisible ( false ) ) ;
137134 } else {
@@ -149,12 +146,6 @@ export default function ItemPage() {
149146 }
150147 } )
151148 . catch ( ( ) => setVisible ( false ) ) ;
152-
153- if ( item . type !== "card" && itemChildren == null ) {
154- dispatch ( attemptGetItemChildren ( item . path ) ) . then ( ( children ) => {
155- setItemChildren ( children ) ;
156- } ) ;
157- }
158149 }
159150
160151 // setting recents of localstorage
@@ -177,6 +168,12 @@ export default function ItemPage() {
177168 setItemOwner ( user ) ;
178169 } ) ;
179170
171+ if ( item . type !== "card" ) {
172+ dispatch ( attemptGetItemChildren ( item . path ) ) . then ( ( children ) => {
173+ setItemChildren ( children . filter ( i => i . _id != item . _id ) ) ;
174+ } ) ;
175+ }
176+
180177 switch ( item . type ) {
181178 case "cabinet" : // will have 0 parents because it's the root item
182179 console . log ( "switch: case =" , item . type , pathArray ) ;
@@ -333,8 +330,10 @@ export default function ItemPage() {
333330 < TypeIcon type = { item . type } size = { 1.5 } opacity = { 0.7 } />
334331 </ Badge >
335332 </ Tooltip >
333+
336334 { /* Item title */ }
337- < div className = "item-title" > { item . title } </ div >
335+ < div className = "item-header-title" > { item . title } </ div >
336+
338337 { /* Item action menus */ }
339338 < Stack direction = "row" >
340339 < Tooltip title = "북마크에 추가" arrow >
@@ -351,13 +350,18 @@ export default function ItemPage() {
351350 </ Stack >
352351 </ div >
353352 </ Stack >
353+
354354 { /* Item BreadCrumbs */ }
355355 { itemParents != null ? (
356356 < BreadCrumbs itemArray = { [ ...itemParents , item ] } />
357357 ) : (
358358 < BreadCrumbs hierarchyLevel = { hierarchyLevel [ item . type ] } />
359359 ) }
360- { /* Item owner profile */ }
360+
361+ { /* Item content */ }
362+ { item . content && < Editor content = { item . content } editable = { false } /> }
363+
364+ { /* Item metadata (owner profile, created date) */ }
361365 { itemOwner != null ? (
362366 < Stack className = "item-profile" >
363367 < img
@@ -381,7 +385,14 @@ export default function ItemPage() {
381385 < Skeleton width = { 200 } height = "1em" />
382386 </ Stack >
383387 ) }
384- { item . content && < Editor content = { item . content } editable = { false } /> }
388+
389+ { /* Item children */ }
390+ { item . type !== "card" && < ItemList
391+ items = { itemChildren }
392+ title = "하위 항목"
393+ icon = { mdiFileTreeOutline }
394+ /> }
395+
385396 < div >
386397 < div className = "outer-div" >
387398 < div className = "grid-container" >
0 commit comments