Skip to content

Conversation

Coussecousse
Copy link

@Coussecousse Coussecousse commented Sep 25, 2025

Hello

Objectif : Highligh new items when they're uploaded.

Why : Because when there are too many elements on the window we can lose them depending on the way the folder is sorted.

⚠️ Cozy-ui need to be updated. See : cozy/cozy-ui#2861 and cozy/cozy-ui#2867

Demonstration :
Capture vidéo du 2025-09-25 12-39-59.webm

Now we're using a provider. I'm not familiar with it so feel free to add your recommandations.
And yes it work with a folderId undefined.
Yes when selecting just after an upload, all the file are selected. The bug is already reported and under investigation.
Ps: All the changed reguarding the lint are under the style commit normally.

Flag:

drive.highlight-new-items.enabled

Copy link

bundlemon bot commented Sep 25, 2025

BundleMon

Files updated (6)
Status Path Size Limits
public/static/js/cozy.(hash).js
727.75KB (+1.12KB +0.15%) -
static/js/cozy.(hash).js
870.82KB (+635B +0.07%) -
public/static/js/public.(hash).js
109.31KB (+483B +0.43%) -
static/js/main.(hash).js
145.55KB (+456B +0.31%) -
services/qualificationMigration.js
282.45KB (+145B +0.05%) -
services/dacc.js
262.26KB (+128B +0.05%) -
Unchanged files (15)
Status Path Size Limits
static/js/(chunkId).(hash).js
958.28KB -
public/static/js/(chunkId).(hash).js
870.08KB -
(hash).js
336.11KB -
public/(hash).js
336.11KB -
public/static/js/lib-react.(hash).js
39.24KB -
static/js/lib-react.(hash).js
39.24KB -
public/static/css/cozy.(hash).css
33.38KB -
static/css/cozy.(hash).css
33.38KB -
public/static/js/lib-router.(hash).js
21.86KB -
static/js/lib-router.(hash).js
21.86KB -
static/css/main.(hash).css
16.77KB -
public/static/css/public.(hash).css
6.46KB -
manifest.webapp
2.96KB -
index.html
690B -
assets/manifest.json
185B -

Total files change +2.92KB +0.06%

Groups updated (1)
Status Path Size Limits
**/*.js
6.74MB (+3.26KB +0.05%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.17MB -
**/*.css
129.68KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@lethemanh lethemanh force-pushed the ean_highlight_files branch 4 times, most recently from 0bfbb04 to 9981ef6 Compare October 1, 2025 19:14
@lethemanh lethemanh force-pushed the ean_highlight_files branch 4 times, most recently from 6104b29 to a743fca Compare October 6, 2025 02:31
@lethemanh lethemanh requested a review from rezk2ll October 6, 2025 02:32
@lethemanh lethemanh force-pushed the ean_highlight_files branch from a743fca to bfa164a Compare October 6, 2025 12:21
@rezk2ll
Copy link
Contributor

rezk2ll commented Oct 6, 2025

We have two issues:

  • The sidebar is duplicated
image
  • The dark mode color does not match the selected color
image

you can switch to the selected attribute instead here:
https://github.com/cozy/cozy-ui/pull/2861/files#diff-1e5051806541a5c5c5c23512d4a2f1660e5507c6e205419beb54e8fdc30047f5R90

@lethemanh
Copy link
Contributor

We have two issues:

  • The sidebar is duplicated
image * The dark mode color does not match the selected color image you can switch to the selected attribute instead here: https://github.com/cozy/cozy-ui/pull/2861/files#diff-1e5051806541a5c5c5c23512d4a2f1660e5507c6e205419beb54e8fdc30047f5R90

They have been fixed

@lethemanh lethemanh force-pushed the ean_highlight_files branch from 4214f1c to 4597ee5 Compare October 9, 2025 03:50
event.preventDefault()

if (disabled || isRenaming) return

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to check the flag inside the clearHighlightedItems() function istead of wrapping it with an if each time you call it .

Inside that function if the flag is enabled simply return

}

if (flag('drive.highlight-new-items.enabled')) {
clearHighlightedItems()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, flag inside

)}
{canUpload && !isUploadDisabled && (
<>
<NewItemHighlightProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

either conditionally wrap the child elements with this provider using the flag or inside the provider make sure to perform nothing with the flag is disabled

showAlert,
displayedFolder?.driveId
displayedFolder?.driveId,
flag('drive.highlight-new-items.enabled') ? addItems : undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing, check the flag inside the additems function not outside because it's easy to miss and you will repeat this if sometimes .

You already missed it above

afterSubmit={handleAfterSubmit}
afterAbort={handleAfterAbort}
addItems={
flag('drive.highlight-new-items.enabled') ? addItems : undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, flag inside the function

},
displayedFolder.driveId
displayedFolder.driveId,
flag('drive.highlight-new-items.enabled') ? addItems : undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing

},
displayedFolder.driveId
displayedFolder.driveId,
flag('drive.highlight-new-items.enabled') ? addItems : undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

},
displayedFolder.driveId
displayedFolder.driveId,
flag('drive.highlight-new-items.enabled') ? addItems : undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

}
}, [currentFolderId, isDesktop])

if (flag('drive.highlight-new-items.enabled')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

</BreakpointsProvider>
</ViewSwitcherContextProvider>
</SelectionProvider>
<NewItemHighlightProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above

@lethemanh lethemanh force-pushed the ean_highlight_files branch 3 times, most recently from a036730 to 5056d2a Compare October 9, 2025 09:57
@lethemanh lethemanh requested a review from rezk2ll October 9, 2025 09:58
- New items are added to a list when a new upload is in progress.
- cozy-ui check if the item rendered is part of the list

Use UploadProvider :
- Add the function addNewItem in parameters when using old redux thunk actions
- Clear the newItems list when :
	- Dragging items
	- Selecting an item
	- Passing from a folder to another

test: correct the tests because we're using a uploadProvider

fix(AddMenuContent): wrap UploadItem with UploadProvider for context

fix(AddFolder): integrate UploadContext to handle the highlight of new folders

fix(UploadProvider): optimize functions with useCallback

Prevents functions from changing on every render. This avoids infinite loops and crashes

style: correct the lint

resolve conflict

chore: Upgrade cozy-ui to 130.5.0 ⬆️

fix: Resolve comments in PR 🎨

fix: Resolve incorrect mocking module :✅

feat: Apply highlight new items into grid view :spakles:

feat: Add feature flag ✨

chore: Upgrade version of cozy-ui to 130.7.0 ⬆️

feat: Clear highlighted items when using long press ✨

style: Change the way apply feature flag 🎨

fix: Resolve failed test cases 🐛
@lethemanh lethemanh force-pushed the ean_highlight_files branch from 5056d2a to c3c57d5 Compare October 13, 2025 06:44
@lethemanh lethemanh merged commit 92d5404 into master Oct 13, 2025
4 checks passed
@lethemanh lethemanh deleted the ean_highlight_files branch October 13, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants