Skip to content

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Oct 2, 2025

Purpose

We want to be able to see the deleted documents, and to restore them if needed.

Proposal

  • ✨(frontend) add trashbin list
  • ✨(frontend) can restore from trashbin list actions
  • ✨(frontend) doc page when deleted

Demo

image

🚨 Take care

After TRASHBIN_CUTOFF_DAYS days, the doc will be definitively deleted, 30 by default.

TRASHBIN_CUTOFF_DAYS = values.Value(
30, environ_name="TRASHBIN_CUTOFF_DAYS", environ_prefix=None
)

@AntoLC AntoLC self-assigned this Oct 2, 2025
@AntoLC AntoLC added frontend feature add a new feature labels Oct 2, 2025
@AntoLC AntoLC marked this pull request as draft October 2, 2025 16:25
Copy link

github-actions bot commented Oct 2, 2025

Size Change: +2.11 kB (+0.06%)

Total Size: 3.66 MB

Filename Size Change
apps/impress/out/_next/static/4df21e30/_buildManifest.js 0 B -881 B (removed) 🏆
apps/impress/out/_next/static/chunks/8495.js 53.9 kB +1.78 kB (+3.42%)
apps/impress/out/_next/static/css/2ee6d170e518968d.css 0 B -25.4 kB (removed) 🏆
apps/impress/out/_next/static/b42ccd61/_buildManifest.js 882 B +882 B (new file) 🆕
apps/impress/out/_next/static/css/60e2be63c8d26a80.css 25.4 kB +25.4 kB (new file) 🆕

compressed-size-action

@AntoLC AntoLC force-pushed the feature/bin-in-docs branch 3 times, most recently from 6155329 to 9bb3f51 Compare October 3, 2025 11:03
@AntoLC AntoLC changed the title feature/bin-in-docs ✨ List and restore deleted docs Oct 3, 2025
@AntoLC AntoLC force-pushed the feature/bin-in-docs branch from 7616ea8 to a9be1c2 Compare October 7, 2025 07:41
@AntoLC AntoLC added the preview label Oct 7, 2025
@AntoLC AntoLC force-pushed the feature/bin-in-docs branch from 304c07c to 3ec8300 Compare October 8, 2025 13:01
@AntoLC AntoLC marked this pull request as ready for review October 8, 2025 13:01
@AntoLC AntoLC force-pushed the feature/bin-in-docs branch 3 times, most recently from 3256335 to 21e1bf6 Compare October 8, 2025 13:32
@AntoLC
Copy link
Collaborator Author

AntoLC commented Oct 8, 2025

You can test this feature now from https://1450-docs.ppr-docs.beta.numerique.gouv.fr/ !

Login: docs
Pass: docs

@AntoLC AntoLC force-pushed the feature/bin-in-docs branch 2 times, most recently from 6d6ef73 to 33928f0 Compare October 8, 2025 15:14
@AntoLC AntoLC requested a review from Ovgodd October 8, 2025 15:28
@Ovgodd
Copy link
Collaborator

Ovgodd commented Oct 9, 2025

hey @AntoLC This is pretty good I like it ! juste One thing :
In the deleted doc, when we tab from the doc : "test deletion" the focus goes on greyed subitem, it should go on the
Document deleted title then resterore button

tabfocu.mp4
image

Copy link
Collaborator

@Ovgodd Ovgodd left a comment

Choose a reason for hiding this comment

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

Nice ! I suggested some little things !

const parentDoc = parentNode?.data.value as Doc;
if (!parentDoc) {
return currentDoc.abilities.move && isDesktop;
<Overlayer isOverlay={currentDoc.deleted_at != 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 we can do this, avoiding the unwanted tabfocus into the greyed subitem,
But react thinks Inert is not valid html ,
So maybe we can add this too :

// global.d.ts declare module 'react' { interface HTMLAttributes<T> { inert?: '' | undefined; } }

Suggested change
<Overlayer isOverlay={currentDoc.deleted_at != null}>
<section
aria-disabled={!!doc.deleted_at}
{...(doc.deleted_at
? ({ inert: '' } satisfies React.HTMLAttributes<HTMLElement>)
: {})}
<Overlayer isOverlay={currentDoc.deleted_at != null}>

WDYT ? it is a proposition but I am not sure of it

Or I can look at the a11y of it after merging the main feature !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines +212 to +221
let dateToDisplay = relativeDate(doc.updated_at);

if (isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at) {
const daysLeft = calculateDaysLeft(
doc.deleted_at,
config.TRASHBIN_CUTOFF_DAYS,
);

dateToDisplay = `${daysLeft} ${t('days', { count: daysLeft })}`;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

little suggestion, something like that for better readability ?

Suggested change
let dateToDisplay = relativeDate(doc.updated_at);
if (isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at) {
const daysLeft = calculateDaysLeft(
doc.deleted_at,
config.TRASHBIN_CUTOFF_DAYS,
);
dateToDisplay = `${daysLeft} ${t('days', { count: daysLeft })}`;
}
const shouldShowDaysLeft = isInTrashbin && config?.TRASHBIN_CUTOFF_DAYS && doc.deleted_at
const daysLeft =
shouldShowDaysLeft
? calculateDaysLeft(doc.deleted_at, config.TRASHBIN_CUTOFF_DAYS)
: null;
const dateToDisplay =
daysLeft !== null
? `${daysLeft} ${t('days', { count: daysLeft })}`
: relativeDate(doc.updated_at);

Copy link
Collaborator Author

@AntoLC AntoLC Oct 10, 2025

Choose a reason for hiding this comment

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

By doing shouldShowDaysLeft we get linter warning, the clear "if" condition helps the linter to know that doc.deleted_at is not undefined. I think it's ok, multiple ternaires do not improve a lot the readability.

AntoLC and others added 7 commits October 10, 2025 09:53
To know when a document in the trashbin will be
permanently deleted.
The front needs to know when a document has been deleted. We expose the
deleted_at property on a document object,
The abilities for a deleted document were too open. We want to restrict
them. Only the restore, retrieve and tree is allowed. The tree method
will need some modifications to get the right informations.
The tree endpoint will now return a result only for owners. For other
users the endpoint still returns a 403. Also, the endpoint does look for
ancestors anymore, it only stay on the current document.
The design uses Material Symbols for icons.
This commit adds the font to the project and
updates the Icon component to be able to use it.
List the docs deleted in the trashbin list,
it is displayed in the docs grid.
We can now restore a doc from the trashbin list actions.
Whe the doc is deleted, the doc page is a bit
different, we have to adapt the doc header
to add some information and actions that
are relevant for a deleted doc.
@AntoLC AntoLC force-pushed the feature/bin-in-docs branch from 33928f0 to d50d8b3 Compare October 10, 2025 08:36
We want to improve the accessibility of our BoxButton
component by adding a theme focus visible style.
This will help users who navigate using the
keyboard to easily identify which button is currently
focused.
To do so we have to move some theme styles to
the Box component to be able to use them in
BoxButton.
@AntoLC AntoLC force-pushed the feature/bin-in-docs branch from d50d8b3 to 5af1da5 Compare October 10, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants