Skip to content
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

Output correct version control icon for detected Git URL #246

Open
dan2k3k4 opened this issue Apr 23, 2024 · 1 comment
Open

Output correct version control icon for detected Git URL #246

dan2k3k4 opened this issue Apr 23, 2024 · 1 comment
Assignees

Comments

@dan2k3k4
Copy link
Contributor

This is just a suggestion and doesn't need to be taken seriously 😅.

We can detect the type of version control system and output a better icon e.g. for GitHub, BitBucket, GitLab, with fallback to default icon as GitLab.

In src/components/ProjectDetailsSidebar/StyledProjectSidebar.tsx - we output .source class for gitBranchLink

      {gitBranchLink ? (
        <div className="field-wrapper source">

We could adapt this to output a class based on the detected Git URL, e.g.

const isGitHub = () => {
  const patternGitHub = '(?:git|https?|git@)(?:\\:\\/\\/)?github.com[/|:][A-Za-z0-9-]+?\\/[\\w\\.-]+?\\.git(?:\\/?|\\#[\\w\\.\\-_]+)?$';
  return new RegExp(patternGitHub).test(gitBranchLink);
}

In src/components/Environment/StyledEnvironment.tsx and a few other files, we basically hardcode the icon to always output the git-lab.svg

      &.source {
        &::before {
          background-image: url('/static/images/git-lab.svg');

So we would need more classes for e.g. &.source-github and ensure github.svg exists as a file in static/images folder, e.g.

      &.source-github {
        &::before {
          background-image: url('/static/images/githug.svg');
@DaveDarsa
Copy link
Contributor

This is pretty good!

@DaveDarsa DaveDarsa self-assigned this May 14, 2024
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

No branches or pull requests

2 participants