fix: make the whole file/tree row clickable, not just the name
commit
f87acbcfix: make the whole file/tree row clickable, not just the name
The repo overview and Files tab both rendered a folder/file icon next to a filename link, so clicking the icon or the row padding around the name did nothing. Both now wrap the icon and name in one anchor, with a row-wide hover highlight to make the larger click target visible.
Assisted-by: Claude:claude-sonnet-5
Reviews
No reviews of this commit yet — record a verdict below.
Start a review
crates/git-ents-server/src/web/pages.rs
@@ -85,8 +85,10 @@
@for entry in &tree {
@let name = entry.filename.to_str_lossy();
div.card-row.is-dir[entry.mode.is_tree()] {
- @if entry.mode.is_tree() { (icon_folder()) } @else { (icon_file()) }
- a href=(entry_href(rel, "", entry)) { (name.as_ref()) }
+ a.row-link href=(entry_href(rel, "", entry)) {
+ @if entry.mode.is_tree() { (icon_folder()) } @else { (icon_file()) }
+ (name.as_ref())
+ }
}
}
}
@@ -521,8 +523,10 @@
@for entry in &entries {
@let name = entry.filename.to_str_lossy();
div.card-row.is-dir[entry.mode.is_tree()] {
- @if entry.mode.is_tree() { (icon_folder()) } @else { (icon_file()) }
- a href=(entry_href(rel, &dir, entry)) { (name.as_ref()) }
+ a.row-link href=(entry_href(rel, &dir, entry)) {
+ @if entry.mode.is_tree() { (icon_folder()) } @else { (icon_file()) }
+ (name.as_ref())
+ }
}
}
}
crates/git-ents-server/src/web/style.css
@@ -185,6 +185,8 @@
.card-row a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 25%, transparent); flex: 1; min-width: 0; word-break: break-all; }
.card-row a:hover { color: var(--color-accent); }
+.card-row a.row-link { display: flex; align-items: center; gap: .65rem; }
+.card-row:has(.row-link):hover { background: var(--color-code-bg); }
.commit-subject a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 25%, transparent); }
.commit-subject a:hover { color: var(--color-accent); }