|
|
@@ -125,6 +125,8 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
|
|
|
const { data, error } = useSWRxPageChildren(isOpen ? page._id : null);
|
|
|
|
|
|
+ const hasDescendants = (page.descendantCount != null && page?.descendantCount > 0);
|
|
|
+
|
|
|
const [{ isDragging }, drag] = useDrag(() => ({
|
|
|
type: 'PAGE_TREE',
|
|
|
item: { page },
|
|
|
@@ -247,17 +249,21 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
<div className={`grw-pagetree-item-container ${isOver ? 'grw-pagetree-is-over' : ''}`}>
|
|
|
<li
|
|
|
ref={(c) => { drag(c); drop(c) }}
|
|
|
- className={`list-group-item list-group-item-action border-0 py-1 d-flex align-items-center ${page.isTarget ? 'grw-pagetree-is-target' : ''}`}
|
|
|
+ className={`list-group-item list-group-item-action border-0 py-1 d-flex align-items-center ${page.isTarget ? 'grw-pagetree-is-target' : ''}`}
|
|
|
>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- className={`grw-pagetree-button btn ${isOpen ? 'grw-pagetree-open' : ''}`}
|
|
|
- onClick={onClickLoadChildren}
|
|
|
- >
|
|
|
- <div className="grw-triangle-icon">
|
|
|
- <TriangleIcon />
|
|
|
- </div>
|
|
|
- </button>
|
|
|
+ <div className="grw-triangle-container d-flex justify-content-center">
|
|
|
+ {hasDescendants && (
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ className={`grw-pagetree-button btn ${isOpen ? 'grw-pagetree-open' : ''}`}
|
|
|
+ onClick={onClickLoadChildren}
|
|
|
+ >
|
|
|
+ <div className="grw-triangle-icon d-flex justify-content-center">
|
|
|
+ <TriangleIcon />
|
|
|
+ </div>
|
|
|
+ </button>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
{ isRenameInputShown && (
|
|
|
<ClosableTextInput
|
|
|
isShown
|
|
|
@@ -268,7 +274,10 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
/>
|
|
|
)}
|
|
|
{ !isRenameInputShown && (
|
|
|
- <a href={page._id} className="grw-pagetree-title-anchor flex-grow-1">
|
|
|
+ <a
|
|
|
+ href={page._id}
|
|
|
+ className="grw-pagetree-title-anchor flex-grow-1"
|
|
|
+ >
|
|
|
<p className={`text-truncate m-auto ${page.isEmpty && 'text-muted'}`}>{nodePath.basename(page.path as string) || '/'}</p>
|
|
|
</a>
|
|
|
)}
|