Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

repo: Show last commit information in file list#58328

Merged
fkling merged 7 commits into
mainfrom
fkling/57827-file-commit
Nov 17, 2023
Merged

repo: Show last commit information in file list#58328
fkling merged 7 commits into
mainfrom
fkling/57827-file-commit

Conversation

@fkling

@fkling fkling commented Nov 15, 2023

Copy link
Copy Markdown
Contributor

Closes #57827

This commit changes the files panel to show the last commit message and date that changed the respective file.

The commits panel is removed to avoid confusion and unnecessarily duplicating information. I originally planned to add the history toggle button to the "actions" bar for tree pages, so that users can still get the same information via the history panel.
However the whole panel logic is currently part of the blob page and making that work fro the tree page that would require some refactoring. This is better be done in a separate PR, but maybe we also find out that we don't need this functionality.

The history data is loaded separately because it's generally slower to load than just the file list. While the commit data is loading the file panel will appear as a table with a single column. Once the data is available the other column headers and data appear. Without a loading state this felt better than having empty columns.

The GraphQL query for fetching the history data specifies repo and commit IDs to cache this data client side.

2023-11-15_10-17

Test plan

  • Open repository root page
  • Open tree page

This commit changes the files panel to show the last commit message and
date that changed the respective file.
The commits panel is removed to avoid confusion and unnecessarily
duplicating information.
@fkling fkling requested review from a team and taiyab November 15, 2023 09:27
@fkling fkling self-assigned this Nov 15, 2023
@cla-bot cla-bot Bot added the cla-signed label Nov 15, 2023
@sourcegraph-bot

sourcegraph-bot commented Nov 15, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@taiyab taiyab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Once the toolbar issue gets resolved, this works before we come back to redesign this whole thing.

Great work @fkling!

className={classNames(
'test-page-file-decorable',
styles.treeEntry,
entry.isDirectory && 'font-weight-bold',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fkling Let's switch this to font-weight-medium (for the folder/directory label).

@fkling fkling Nov 15, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you expect there to still be a visual difference between folder and file text? I'm using a font that only providers "normal" and "bold", so folder and file entries look very similar now, but maybe I'm not the target audience 😆 :

2023-11-15_10-57

GH seems to solve this by using a more visually distinctive folder icon. We could try switching to the filled folder icon?

Or maybe it's just something I have to get used to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The folder one definitely needs to be bolder, but medium and not bold.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@taiyab This is what I see when I set it to medium. As I said, the font I use doesn't support different weights. I think that's more common on Linux.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fkling Ah, OK. If it can't render medium, then fallback to bold is fine.

In a future iteration, we'll make the directory icon more differentiated so you can scan that list easier.

@fkling fkling force-pushed the fkling/57827-file-commit branch from b0c9e6d to 4be01bd Compare November 15, 2023 10:54
Comment on lines -308 to -311
{
// In case of single child expansion, we need to get the name relative to
// the start of the directory (to include subdirectories)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oops, I missed a spot. Thanks!

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great! So much more useful.

</div>
</td>
<td className={classNames(styles.commitDate, 'text-muted')}>
<Timestamp noAbout={true} date={getCommitDate(fileHistoryByPath[entry.path])} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we maybe set noAgo={true}? The ago on every line takes up some valuable horizontal space for no useful information since a commit should never be in the future. We could maybe rename the colume "last commit age" or something if "last commit date" doesn't make sense anymore.

CleanShot 2023-11-15 at 10 05 41@2x
CleanShot 2023-11-15 at 10 06 40@2x

cc @taiyab

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, sounds good.

<>
<td className={styles.commitMessage}>
<span title={fileHistoryByPath[entry.path].subject} data-testid="git-commit-message-with-links">
<CommitMessageWithLinks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably unrelated to this PR, but can we make this scale better to large screens? Now that the horizontal space is useful to display the commit message, it would be nice if the width of the component wasn't so limited.

CleanShot 2023-11-15 at 10 09 31@2x

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Depends on the max container size we're using for that internal bit, which I think is 1200px right now (we should test going up to 1280px).

At minimum though, we can center it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can do that in a separate PR.

@fkling fkling force-pushed the fkling/57827-file-commit branch from 9c9af45 to c1102e7 Compare November 16, 2023 13:20
@fkling fkling force-pushed the fkling/57827-file-commit branch from a4c5154 to 1011915 Compare November 17, 2023 08:22
@fkling fkling merged commit 90992a1 into main Nov 17, 2023
@fkling fkling deleted the fkling/57827-file-commit branch November 17, 2023 12:20
vovakulikov pushed a commit that referenced this pull request Dec 12, 2023
This commit changes the files panel to show the last commit message and
date that changed the respective file.
The commits panel is removed to avoid confusion and unnecessarily
duplicating information.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tree view: more useful recent activity

4 participants