Skip to content

Commit 62d61fd

Browse files
committed
different sizes, different displays optimised, large size color tweaks
1 parent 0efab0b commit 62d61fd

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/gitfetch/display.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def _display_compact(self, username: str, user_data: Dict[str, Any],
6868
stats: Dict[str, Any]) -> None:
6969
"""Display graph and minimal info side-by-side."""
7070
contrib_graph = stats.get('contribution_graph', [])
71+
recent_weeks = self._get_recent_weeks(contrib_graph)
7172
graph_width = max(40, (self.terminal_width - 10) // 2)
7273
graph_lines = self._get_contribution_graph_lines(
7374
contrib_graph,
@@ -77,15 +78,22 @@ def _display_compact(self, username: str, user_data: Dict[str, Any],
7778
)
7879

7980
info_lines = self._format_user_info_compact(user_data, stats)
81+
achievements = self._build_achievements(recent_weeks)
82+
83+
# Combine sections
84+
right_side = list(info_lines)
85+
if achievements:
86+
right_side.append("")
87+
right_side.extend(achievements)
8088

8189
# Display side-by-side
82-
max_lines = max(len(graph_lines), len(info_lines))
90+
max_lines = max(len(graph_lines), len(right_side))
8391
for i in range(max_lines):
8492
graph_part = (graph_lines[i] if i < len(graph_lines) else "")
8593
graph_len = self._display_width(graph_part)
8694
padding = " " * max(0, graph_width - graph_len)
8795

88-
info_part = (info_lines[i] if i < len(info_lines) else "")
96+
info_part = (right_side[i] if i < len(right_side) else "")
8997
print(f"{graph_part}{padding} {info_part}")
9098

9199
def _display_full(self, username: str, user_data: Dict[str, Any],
@@ -213,16 +221,12 @@ def _format_user_info_compact(self, user_data: Dict[str, Any],
213221
stats.get('contribution_graph', [])
214222
)
215223

216-
headline = f"{name} - {total_contributions:,} contributions this year"
217-
lines.append(self._colorize(headline, "accent"))
218-
219-
bio = user_data.get('bio')
220-
if bio:
221-
trimmed = bio.strip().replace('\n', ' ')[:60]
222-
lines.append(self._colorize(trimmed, 'muted'))
223-
224-
lines.append(f"Repos: {stats.get('total_repos', 0)}")
225-
lines.append(f"Stars: {stats.get('total_stars', 0)}")
224+
# Format user line with same coloring as full display
225+
contrib_str = self._colorize(f"{total_contributions:,}", 'orange')
226+
name_str = self._colorize(name, 'header')
227+
phrase_str = self._colorize('contributions this year', 'header')
228+
user_line = f"{name_str} - {contrib_str} {phrase_str}"
229+
lines.append(user_line)
226230

227231
return lines
228232

@@ -421,15 +425,15 @@ def _format_dashboard_section(self, title: str,
421425
lines.append(self._format_dashboard_item(item))
422426

423427
if idx < len(groups) - 1:
424-
lines.append("")
428+
pass # Remove empty line between groups
425429

426430
return lines
427431

428432
def _dashboard_label(self, text: str, width: int = 20) -> str:
429433
label = f"{text}:"
430434
padded = f"{label:<{width}}"
431435
if self.enable_color:
432-
return self._colorize(padded, 'bold')
436+
return self._colorize(padded, 'header')
433437
return padded
434438

435439
def _format_dashboard_item(self, item: Dict[str, Any],

0 commit comments

Comments
 (0)