Skip to content

Conversation

@Ovgodd
Copy link
Collaborator

@Ovgodd Ovgodd commented Oct 30, 2025

Purpose

Improve mobile user experience by indicating when a document or a subdocument has children.

issue : 1314

image

Proposal

  • Display the number of sub-documents in mobile view only and only if they exist
  • Adjust the UI to accommodate the new child count information
  • Create a DocHeaderInfo component to encapsulate related logic and rendering

@Ovgodd Ovgodd requested a review from AntoLC October 30, 2025 10:02
@Ovgodd Ovgodd self-assigned this Oct 30, 2025
@Ovgodd Ovgodd added enhancement improve an existing feature frontend labels Oct 30, 2025
helps users notice root documents have children in mobile view

Signed-off-by: Cyril <c.gromoff@gmail.com>
@Ovgodd Ovgodd force-pushed the feat/1314-show-sub-docs-count branch from e79dba5 to 050189f Compare October 30, 2025 10:03
@Ovgodd Ovgodd marked this pull request as ready for review October 30, 2025 10:03
Comment on lines +64 to +94
{isDesktop ? (
<>
<Text
$variation="600"
$size="s"
$weight="bold"
$theme={isEditable ? 'greyscale' : 'warning'}
>
{transRole(
isEditable ? doc.user_role || doc.link_role : Role.READER,
)}
&nbsp;·&nbsp;
</Text>
<Text $variation="600" $size="s">
{dateToDisplay}
</Text>
</>
) : (
<>
<Text $variation="400" $size="s">
{hasChildren ? relativeOnly : dateToDisplay}
</Text>
{hasChildren ? (
<Text $variation="400" $size="s">
&nbsp;•&nbsp;
{t('Contains {{count}} sub-documents', {
count: childrenCount,
})}
</Text>
) : null}
</>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AntoLC I was hesitating to create DocHeaderInfoDesktop and DocHeaderInfoMobile components to make this component clearer and more readable. We would just have a bit of props drilling, what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ok, but to improve a bit readability you can maybe do:

if(isDesktop){
   return ...
}

return ...

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Size Change: +232 B (+0.01%)

Total Size: 3.68 MB

Filename Size Change
apps/impress/out/_next/static/2b04d6d7/_buildManifest.js 0 B -878 B (removed) 🏆
apps/impress/out/_next/static/ffbbb779/_buildManifest.js 877 B +877 B (new file) 🆕

compressed-size-action

Comment on lines +86 to +93
{hasChildren ? (
<Text $variation="400" $size="s">
&nbsp;•&nbsp;
{t('Contains {{count}} sub-documents', {
count: childrenCount,
})}
</Text>
) : null}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{hasChildren ? (
<Text $variation="400" $size="s">
&nbsp;&nbsp;
{t('Contains {{count}} sub-documents', {
count: childrenCount,
})}
</Text>
) : null}
{hasChildren && (
<Text $variation="400" $size="s">
&nbsp;&nbsp;
{t('Contains {{count}} sub-documents', {
count: childrenCount,
})}
</Text>
)}

Comment on lines +31 to +46
const { data: childrenPage } = useDocChildren(
{ docId: doc.id, page_size: 1 },
{ enabled: true },
);
const countFromTreeContext =
treeContext?.root?.id === doc.id
? treeContext?.treeData?.nodes?.length
: undefined;

const childrenCount =
countFromTreeContext ??
childrenPage?.count ??
doc.numchild ??
tree?.children?.length ??
0;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need all that ? Why is doc.numchild not enough ?

Comment on lines +47 to +51
let dateToDisplay = t('Last update: {{update}}', {
update: relativeDate(doc.updated_at),
});
const relativeOnly = relativeDate(doc.updated_at);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let dateToDisplay = t('Last update: {{update}}', {
update: relativeDate(doc.updated_at),
});
const relativeOnly = relativeDate(doc.updated_at);
const relativeOnly = relativeDate(doc.updated_at);
let dateToDisplay = t('Last update: {{update}}', {
update: relativeOnly,
});

Comment on lines +64 to +94
{isDesktop ? (
<>
<Text
$variation="600"
$size="s"
$weight="bold"
$theme={isEditable ? 'greyscale' : 'warning'}
>
{transRole(
isEditable ? doc.user_role || doc.link_role : Role.READER,
)}
&nbsp;·&nbsp;
</Text>
<Text $variation="600" $size="s">
{dateToDisplay}
</Text>
</>
) : (
<>
<Text $variation="400" $size="s">
{hasChildren ? relativeOnly : dateToDisplay}
</Text>
{hasChildren ? (
<Text $variation="400" $size="s">
&nbsp;•&nbsp;
{t('Contains {{count}} sub-documents', {
count: childrenCount,
})}
</Text>
) : null}
</>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ok, but to improve a bit readability you can maybe do:

if(isDesktop){
   return ...
}

return ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve an existing feature frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants