Skip to content

Conversation

lethemanh
Copy link
Contributor

@lethemanh lethemanh commented Jul 10, 2025

CleanShot 2025-07-10 at 14 53 13@2x
CleanShot 2025-07-10 at 14 55 03@2x

</ModalContextProvider>
</ThumbnailSizeContextProvider>
<ViewSwitcherContextProvider>
<ThumbnailSizeContextProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you replace this thumbnail size, you should remove it from everywhere.

[styles['fil-content-column-selected']]: selected,
[styles['fil-content-column-actioned']]: actionMenuVisible,
[styles['fil-content-column-disabled']]: styleDisabled,
[styles['fil-content-column-bigger']]: thumbnailSizeBig
Copy link
Contributor

Choose a reason for hiding this comment

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

can we still have thumbnailSizeBig ?

)}
</TableRow>
</>
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need to have this full copy / past between list & grid? Can't we make a few if? Because it seems that there is a lot of stuff that are just duplicated

@@ -76,11 +76,11 @@ const FileListHeaderMobile = ({
<Button
variant="text"
onClick={() => {
toggleThumbnailSize()
toggleViewType(viewType === 'list' ? 'grid' : 'list')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we just toggleViewType()? For me, toggle can only have two values and we change from one to another. So we should not test the previous value every time we want to change. This should be done within the provider.

Otherwise, rename this method to switchViewType and in that case you can do what you did, but I still prefer the first solution.

)
import { useViewSwitcherContext } from '@/lib/ViewSwitcherContext'

const SelectBox = ({ withSelectionCheckbox, selected, onClick, disabled }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This component should be dump, and should not rely on the hook. Pass a viewType props directly.

<FileIcon file={file} size={48} isEncrypted={isEncrypted} />
<FileIcon
file={file}
size={viewType === 'grid' ? 96 : 48}
Copy link
Contributor

Choose a reason for hiding this comment

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

why don't you pass 96 when you call FileThumbnail? Like that, no need to rely on the hook.

.fil-content-file-select
position absolute
top -4px
left -3px
Copy link
Contributor

Choose a reason for hiding this comment

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

what are those magic numbers? Are you sure it still works if you change your font size? Should we use rem or something here?

position absolute
top -4px
left -3px
z-index 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you @require 'settings/z-index.styl' and then use the zIndex variable you need?

white-space normal
height auto
padding-right 0
margin-top 10px
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use px, you rem please

</BreakpointsProvider>
</ThumbnailSizeContextProvider>
<ViewSwitcherContextProvider>
<ThumbnailSizeContextProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

remove ThumbnailSizeContextProvider

@Crash--
Copy link
Contributor

Crash-- commented Jul 10, 2025

Can you split your PR into at least 2 commits:

  • One that add this "grid view"
  • One that add the "select all"

Also, what about FolderViewBodyVz? You only change what is not "virtualized", but it seems that this is not what we'll be used anymore?

@lethemanh
Copy link
Contributor Author

Can you split your PR into at least 2 commits:

  • One that add this "grid view"
  • One that add the "select all"

Also, what about FolderViewBodyVz? You only change what is not "virtualized", but it seems that this is not what we'll be used anymore?

@Crash-- the FolderViewBodyVz is using virtualized table from cozy-ui, I think this is a big change if we want to apply grid layout
cc @rezk2ll

Copy link

bundlemon bot commented Jul 11, 2025

BundleMon

Files updated (5)
Status Path Size Limits
static/js/main.(hash).js
117.9KB (+805B +0.67%) -
public/static/js/public.(hash).js
86.83KB (+744B +0.84%) -
static/css/main.(hash).css
16.61KB (+419B +2.53%) -
public/static/css/public.(hash).css
6.29KB (+409B +6.78%) -
public/static/js/cozy.(hash).js
711.88KB (+348B +0.05%) -
Unchanged files (16)
Status Path Size Limits
static/js/(chunkId).(hash).js
967.38KB -
public/static/js/(chunkId).(hash).js
872.3KB -
static/js/cozy.(hash).js
845.89KB -
(hash).js
337.62KB -
public/(hash).js
337.62KB -
services/qualificationMigration.js
282.6KB -
services/dacc.js
264.84KB -
public/static/js/lib-react.(hash).js
39.37KB -
static/js/lib-react.(hash).js
39.37KB -
public/static/css/cozy.(hash).css
33.69KB -
static/css/cozy.(hash).css
33.69KB -
public/static/js/lib-router.(hash).js
22.05KB -
static/js/lib-router.(hash).js
22.05KB -
manifest.webapp
1.89KB -
index.html
688B -
assets/manifest.json
185B -

Total files change +2.66KB +0.05%

Groups updated (2)
Status Path Size Limits
**/*.js
6.45MB (+1.94KB +0.03%) -
**/*.css
129.78KB (+1.29KB +1%) -
Unchanged groups (1)
Status Path Size Limits
**/*.{png,svg,ico}
2.15MB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@lethemanh lethemanh force-pushed the grid-layout branch 2 times, most recently from 6fa0052 to 5475442 Compare July 11, 2025 08:18
text-overflow ellipsis
white-space normal

max-width 96px
Copy link
Contributor

Choose a reason for hiding this comment

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

This will unnecessarily truncate the file/folder names, and it's in px.

use max-width 100% instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If use max-width 100%, we cannot limit the long text, so I changed to 6rem instead

@@ -0,0 +1,4 @@
.fil-folder-body-grid
display grid
grid-template-columns repeat(auto-fill, minmax(140px, 1fr))
Copy link
Contributor

@rezk2ll rezk2ll Jul 11, 2025

Choose a reason for hiding this comment

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

Suggested change
grid-template-columns repeat(auto-fill, minmax(140px, 1fr))
grid-template-columns repeat(auto-fill, minmax(8.4rem, 1fr))

Copy link
Contributor

Choose a reason for hiding this comment

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

In the Figma design, we have each item having a 136px width ( say 8.5rem ) and the row should have 12 items

image

If we use the current implementation values, we will end up with 11 items max per row

@rezk2ll rezk2ll merged commit 9d950f6 into master Jul 11, 2025
4 checks passed
@rezk2ll rezk2ll deleted the grid-layout branch July 11, 2025 09:36
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