-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add material icons for file list #26236
Conversation
dd2287f
to
59352fb
Compare
59352fb
to
c502126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add 4 icons last time to complete the set. I had them in web_src/svg/
. You might want them too.
In my implementation, it looked like
Before
After
The files:
material-file.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="svg material-file" width="16" height="16" aria-hidden="true"><path fill="#90a4ae" d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m5 2H6v16h12v-9h-7V4z"/></svg>
material-folder-root.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="svg material-folder-root" width="16" height="16" aria-hidden="true"><path fill="#90a4ae" d="M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg>
material-folder-symlink.svg
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" fill="#42a5f5" opacity=".745"/><path d="M16.972 10.757v2.641h-6.561v5.281h6.561v2.641l6.562-5.281-6.562-5.282z" opacity=".81" fill="#c5e5fd"/></svg>
material-folder.svg
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" fill="#42a5f5"/></svg>
What I haven't quite understood yet: What's the difference to #24147? |
I think here you can untar, change files, tar again. |
I think I prefer octicons for unrecognized folders and files and a option could be added that enables the file type icons. I personally would prefer for folders to not receive any custom icons. |
Could we have a configuration to allow users to switch back to |
Will it be the default look of icon in 1.21 |
The differences:
|
Sound code, but does this work with different styles? It is possible to select a style in Gitea. Does the Icons look good on every style? |
The quick is answer is: it might not work that well. Because there are some "light" icons in the icon set, but they are not used yet. But I think it's not in this PR's scope. Due to how Gitea's backend/frontend work, it needs a lot of more time to fix it. |
If I understand correctly, only "material-folder(-generic).svg" and "material-folder-symlink.svg" are used, now they are there.
There were also a lot of backend code handling SVG contents, which were fragile. Now I have rewritten them (and add tests). And I also added a temporary option
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works.
@silverwind do you want to block? |
So, to summarize the discussion on this page:
As I see it, 3. is the only one whose disadvantage is limited to this PR instead of the future maintainability of Gitea or the downloadability of the Gitea repo. |
How do you customize with option 3? |
I still don't like the introduction of LFS for this, it means the gitea repo can no longer be hosted on a default installation of gitea which has LFS disabled. 294kB is certainly not a size where I would even consider LFS, that starts in the realms of 100MB+ for me. Not going to block if everyone else agrees to LFS, but I don't. |
Isn't that even the easiest one to customize? |
Gotcha, so it'll go on |
I prefer LFS than bloating the codebase with hundreds (maybe thousands in the future) vendoring files. |
Maybe we could enable LFS default now. Because it will not require any extra installation or configuration for users. |
I think you need git LFS installed. LFS is not included in git by default. |
Don't need. Only git client need git-LFS. Gitea's LFS logic is written by Golang and it's internal. |
Isn't that the whole point of that argument? |
For developers, they already need to install git/nodejs/golang/python, I don't think installing git-lfs is difficult for them. |
I don't understand why we should want these icons in our codebase and inherit the burden of keeping them updated if we could rely on external icon packs. Edit: Gitlab for example manages them in a separate repo and still they just download an external source when building with CI. |
I also don't think we need to store it in the codebase. Why not just download the icons when building? |
Or download the icons when using. But it's more difficult. We need to define an icon package or repository specification. |
I do think keeping build artifacts in the repo is beneficial so gitea can be built without internet access (minus go and npm dependencies which of course require it), we do that for numerous dependencies like Fomantic, the SVGs, etc. |
We should add https://www.npmjs.com/package/material-icon-theme as a npm dependency, and build from By offloading the download to the npm client, we get this compatibilty for free, in addtion to having the dependency version-locked. |
I think npm is the best option, even though we lose customizability. I don't think that many users will really want install a different icon theme..... |
Do we need a survey, or is there a consensus on how to move forward? |
If there's no need for customizability we could have landed this months ago |
We don't loose customizability just by changing the way the material icons are fetched. We just need to formalize a spec format for a icon pack, e.g. that it should contain a JSON mapping of file name or path to icons and the icons in a subdirectory as SVGs that reference the mapping values. By the way, I find |
I have no motivation for making more changes because I do not like these colorful icons. I wrote this PR just because I promised. While I do not think #24147 is good enough, eg: the packing was wrong (the material-icons.json shouldn't be assumed to be a local file or read by And, mixing the external assets into Gitea's SVG assets doesn't look good to me. Feel free to replace this PR, I would have no objection if the new solution is maintainable and satisfies:
Or, let the TOC team decide. |
Thanks @wxiaoguang, it was worth a shot |
A new PR: -> Add material icons for file list #33837 |
Close #11149
Co-authored-by: Yarden Shoham git@yardenshoham.com