material-extensions / material-icons-browser-extension

Browser Addon that enhances file browsers of version controls with material icons.
MIT License
524 stars 39 forks source link

Gitea & GitLab support #2

Closed MoKhajavi75 closed 2 years ago

MoKhajavi75 commented 3 years ago

Hey

Thanks for your great extension.

Do you have any plans to support Gitea and GitLab?

Claudiohbsantos commented 3 years ago

I currently don't have any plans to support other platforms, mostly because I don't have any ongoing projects on either platforms right now. But I'd be happy to take PR's that extend the DOM selectors to match the appropriate elements in Gitea/GitLab.

jamiehaywood commented 3 years ago

I'd like to raise a PR for azure devops if you would accept that also?

Claudiohbsantos commented 3 years ago

@jamiehaywood Yeah, that sounds great to me. Just FYI: I'll be out of town next week so I might take a bit to see it if it arrives then, but I should be able to look at it asap after that

jamiehaywood commented 2 years ago

hi @Claudiohbsantos - finally got round to taking a look at adding multi-site support - have you got any ideas around how you would like to approach this from a technical standpoint?

Claudiohbsantos commented 2 years ago

@jamiehaywood Sorry, completely lost track of this over this last month. If you're still interested in taking this on I think the best approach would be to store the css selector for each supported website as a value in a dictionary and use the appropriate selector for the website that matches the current URL.

The core of that change would probably be around here

If a single selector doesn't cut it for azure/other websites we can get fancier with the selector matching, but the general concept stands:

Check which website we're on => Choose css selector matching icons to be replaced => replace icons

Claudiohbsantos commented 2 years ago

With #31 now landed adding support for gitea is a breeze. I just added some basic support for gitea repositories that should go out with the next version. I still need to investigate the special submodule/symlink cases but I can add that as a follow up.

Like @csandman mentioned, gitlab already displays icons from the same upstream repository so I don't think there's value in supporting it now. I'll mark this issue closed, please feel free to open an new issue for new features/bug reports on gitea

csandman commented 2 years ago

@Claudiohbsantos I actually ended up trying to make a provider config for GitLab just to see how it looked and I think there might actually be some value to adding it.

Here is what it looks like without the extension:

image

And here is what it looks like with:

image

As you can probably tell, the main difference is the folders, which I think is honestly enough to justify including it anyway. But on top of that, I think some of the file icons are better as well. Some files, like the README.md or tsconfig.json at the bottom, have more specific icons with this pack than they do in the original site's icon pack. If you'd consider it, I could submit a PR with this config so you can try it out.


I still need to investigate the special submodule/symlink cases but I can add that as a follow up.

As a side note, if you want to investigate the submodule/symlink icons, you could try pushing a copy of the repo pictured above to Gitea. It's just a sample I've been using for that purpose, as I added a symlink and submodule to it for that purpose.

Here's a link: https://gitlab.com/csandman/test

I know its a clone of a competing icon extension haha, I've submitted PRs to a couple of these because I think they're fun to work with.

Claudiohbsantos commented 2 years ago

@csandman that's a good point, thanks for digging into it further. Yeah, the lack of folder icons seems like a big difference. I'd definitely consider a PR with that provider. No rush though, I just started toying with an options page for users to easily enable/disable the extension on websites and I think gitlab support would pair well with that since I bet there'll be people who prefer the default gitlab icon pack.

And thanks for the repo, I'll check that on Gitea when I get a sec. hahah That's perfect, sounds like you can bring the best solutions different projects figured out to each other. An icon extension match-maker?

csandman commented 2 years ago

And thanks for the repo, I'll check that on Gitea when I get a sec. hahah That's perfect, sounds like you can bring the best solutions different projects figured out to each other. An icon extension match-maker?

Haha something like that, I was helping with the github-file-icons project by implementing something similar to how you update your local assets. They were using a JS wrapper for their icon pack from NPM that was about two years outdated 😅. My original goal was to make an extension that offered a variety of icon packs on every git provider, but I realized I would never get around to fully implementing it so I figured the work I had done already would be better utilized if I submitted it to some existing projects.

I have to say though, from all the ones I've looked at, this one definitely seems to have the best architecture for running the icon replacement, as well as automation for updating the icon pack. If I were to have gone through with my all encompassing extension, this would definitely have been the model I'd have built it off of!


I'd definitely consider a PR with that provider.

Great, once the ESLint branch is merged I'll get a PR set up! On a side note, I also tried implementing a provider config for https://gitee.com/ that seems to work great as well. If you're going to have some, might as well have them all!

Claudiohbsantos commented 2 years ago

Thanks, I'm really glad to hear the code project looks good to people who are jumping into it. This codebase was born during a 24 hour hackaton so it was a gigantic hacky mess to start with lol. I'm happy you decided to jump into these other projects. The generalization into providers you added made it a breeze to add replacement to other pages that I honestly wouldn't have bothered investigating otherwise.

And I'm all for more providers. The more the merrier now! It is a bummer that the extension is called "Material Icons for Github" though. Lesson learned: Don't tie the name of your project too closely with the limitations that exist at inception...

Claudiohbsantos commented 2 years ago

Closing this issue since discussion has moved to the PR (and I love the feeling of closing an Issue). Any follow-ups should be directed to the PR until that's merged, or in a new issue if there are problems with the implementation