gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Pin Repositories (Fixes #10375)

Open Eekle opened this issue 2 years ago • 10 comments

#10375

This PR adds the ability for repository administrators to pin up to 3 repositories to the home page of the repository owner.

This applies to both users and orgs.

Pinned repositories are stored in the user setting pinned_repos.

image

image image image

Not included in this PR:

  • Any API access to pinning/unpinning
  • Configurable maximum pinned repos per org/user

Eekle avatar May 28 '22 19:05 Eekle

@delvh All the bits of logging here are debugging hangovers, they won't be present in the finished PR :)

Thank you for the notes! I'll go through it all today.

Eekle avatar May 29 '22 04:05 Eekle

Could you give some screenshots about the UI design? I think we need some discuss there.

lunny avatar May 29 '22 08:05 lunny

Could you give some screenshots about the UI design? I think we need some discuss there.

image

I tried cards above the search bar, but couldn't get it to look coherent.

Part of it is that the repository names can be very long, right? So I found it hard to think of a better presentation than in a list with the rest.

However I take @delvh 's point that these are a user thing and should appear separately to the searched repositories. So I will try again with some cards.

Eekle avatar May 29 '22 08:05 Eekle

I'd say if the name is too long for a card, we can simply overflow, i.e. really-long-repository-name could be shortened to really-lo..., depending on the width of the card. That should be easy to achieve with CSS.


EDIT: I just found out that GitHub handles long repository names as follows: image I don't know, do we want to keep that approach, or do we want to use overflow instead?

delvh avatar May 29 '22 09:05 delvh

image

Moved to a card approach. I know it's not elegant yet but just as a centre for discussion.

Eekle avatar May 29 '22 11:05 Eekle

image

Latest UI grab

Eekle avatar May 29 '22 19:05 Eekle

image

User implementation always uses single column - Fits better with the narrower styling on the user profile.

If you use three wide it looks fine on a full size screen - But when you go to a narrower screen (but bigger than mobile) it gets cramped. This layout doesn't have that issue.

Eekle avatar May 30 '22 12:05 Eekle

Feature complete. Unpin icon was made custom since octicons doesn't have one.

User profile:

image

Org home:

image

Eekle avatar Jun 02 '22 14:06 Eekle

Why only 3 repos and not 6 like GitHub?

JakobDev avatar Aug 22 '22 14:08 JakobDev

Why only 3 repos and not 6 like GitHub?

In the original issue, 3 was just the number used in the mockups so it's what I implemented.

As stated in the OP it's a known limitation of this PR. It wouldn't be hard to change to a different fixed number, like 6.

Eekle avatar Aug 22 '22 17:08 Eekle

What does 6 look like on a mobile ? If 6 causes too much clutter then 3 is a reasonable number

eeyrjmr avatar Sep 25 '22 11:09 eeyrjmr

What does 6 look like on a mobile ? If 6 causes too much clutter then 3 is a reasonable number

I've never tried anything other than 6. It would have to be prototyped

Eekle avatar Sep 25 '22 13:09 Eekle

you mean 3? 3 is better than none and equally there is never enough :) 3 seems fine to me as the use-case I was considering was pinning a STEERING repository for each organisation, leaving 2 more for any heavily used ones

eeyrjmr avatar Oct 01 '22 11:10 eeyrjmr

I'm curious since none of the test screenshots are anything close to a phone in portrait mode, but what happens with the pinned repos with a small page width? It would be cool if they then became vertically stacked or something else smart that doesn't involve just a giant horizontal scrollbar (and doesn't involve the pin cards becoming so tiny they can't be read anymore).

In overall this is really cool. Especially on instances with a lot of developers, this can help a lot with finding out what cool stuff the others made.

ell1e avatar Oct 15 '22 16:10 ell1e

I'm curious since none of the test screenshots are anything close to a phone in portrait mode, but what happens with the pinned repos with a small page width? It would be cool if they then became vertically stacked or something else smart that doesn't involve just a giant horizontal scrollbar (and doesn't involve the pin cards becoming so tiny they can't be read anymore).

In overall this is really cool. Especially on instances with a lot of developers, this can help a lot with finding out what cool stuff the others made.

I believe stacking vertically is exactly what they do. They use the Fomantic stackable class.

Eekle avatar Oct 15 '22 18:10 Eekle

Moved to v1.19 because one should pin his organization repositories

lunny avatar Oct 24 '22 03:10 lunny

I may not have the time to implement this new version any time soon. If someone else is interested I'm happy to hand it over.

So to be clear the spec here is:

  • Users and orgs should be able to have up to 3 repositories pinned on their profiles
  • For organisations, this must be repositories within that organisation
  • For users, it can be any public repository (no restrictions?)

It is not super clear to me what the UI for this will be. For example if I'm on a repository owned by an org for which I'm the administrator, I need the option to pin it to my profile or the org's profile. I don't know how best to do that.

Eekle avatar Oct 24 '22 16:10 Eekle

For users, it can be any public repository (no restrictions?)

For what it's worth, I think GitHub restricts it to having either some sort of repo ownership or past contributions.

I'm really just a random user (who happens to like pins), but I personally think no restriction may actually be cooler. It changes pins from only "look at my work" to "hey, look at this cool thing", and that feels more social and dynamic to me. But I wonder what others think?

ell1e avatar Oct 24 '22 17:10 ell1e

Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive.

I'm also fine with both approaches, as long as we can agree on one and keep it at that.

delvh avatar Oct 25 '22 08:10 delvh

Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive.

I'm also fine with both approaches, as long as we can agree on one and keep it at that.

I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive?

Plus it's simpler to implement!

Eekle avatar Oct 26 '22 17:10 Eekle

Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive. I'm also fine with both approaches, as long as we can agree on one and keep it at that.

I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive?

Plus it's simpler to implement!

While that is true think about an organisation that wants to bring focus to a key repository. Users pinning for their convenience is important but an organisation pinning for visibility is equally important

eg https://github.com/go-gitea

eeyrjmr avatar Oct 26 '22 23:10 eeyrjmr

Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive. I'm also fine with both approaches, as long as we can agree on one and keep it at that.

I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive? Plus it's simpler to implement!

While that is true think about an organisation that wants to bring focus to a key repository. Users pinning for their convenience is important but an organisation pinning for visibility is equally important

eg https://github.com/go-gitea

I don't understand why users being able to free pin would impact orgs?

Orgs will be able to pin their own repos to their profiles for sure.

Eekle avatar Oct 27 '22 05:10 Eekle

I am equally confused. The only thing I can somewhat guess would be that you need a dropdown when pinning to decide where to pin it to, with the options being you, or the orgs you have admin rights in. If you don't have admin rights in any org, we should probably shortcut to directly pinning to your own page.

delvh avatar Oct 27 '22 08:10 delvh

I am equally confused. The only thing I can somewhat guess would be that you need a dropdown when pinning to decide where to pin it to, with the options being you, or the orgs you have admin rights in. If you don't have admin rights in any org, we should probably shortcut to directly pinning to your own page.

Hold on a mo.

It seems like you're suggesting that orgs should also be able to pin any repository to their profiles - not just ones tha they own?

I thought we were suggesting users could pin anything, but orgs could only pin their own repos.

Eekle avatar Oct 27 '22 08:10 Eekle

but orgs could only pin their own repos.

Would that be important to limit though? Maybe it should also be unrestricted.

ell1e avatar Oct 27 '22 08:10 ell1e

but orgs could only pin their own repos.

Would that be important to limit though? Maybe it should also be unrestricted.

Yeah that's a fair question. I suppose I'm worried about the UI explosion.

If the dropdown is just:

  • Pin to my profile
  • Pin to [orgname]

Then that's pretty digestable. If it's...

  • Pin to my profile
  • Pin to [org1]
  • Pin to [org2]
  • Pin to [org3]
  • ...

It's a lot more irritating, especially given that 99% of the time you're going to want to pin the repo just to its owning org.

Eekle avatar Oct 27 '22 08:10 Eekle

Please move the discussion to #10375, I think that's more appropriate as we have a lot to discuss as it seems.

delvh avatar Oct 27 '22 08:10 delvh

Now that https://github.com/go-gitea/gitea/pull/24406 is in, I assume at least the HTML templates and CSS from it could be re-used here.

silverwind avatar May 30 '23 21:05 silverwind

Are you still doing this PR?

hiifong avatar Jul 21 '23 10:07 hiifong

Closing as stale and the author having said that this feature needs a completely new implementation (https://github.com/go-gitea/gitea/issues/10375#issuecomment-1293271930)

denyskon avatar Sep 10 '23 10:09 denyskon