Skip to content

Commit fe3c7fa

Browse files
feat: enhance widget display with dynamic height and add GitHub username
1 parent f77b3f1 commit fe3c7fa

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/apis/apis.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class APIService {
165165
}
166166

167167
let streak = 0;
168-
for (let i = allDays.length - 1; i >= 0; i--) {
168+
for (let i = allDays.length - 2; i >= 0; i--) {
169169
if (allDays[i].count > 0) {
170170
streak++;
171171
} else {

src/widget/views/index.hbs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,40 @@
1616
.main_text {
1717
transform: translateX(38px);
1818
}
19+
20+
.path {
21+
filter: brightness(1.4);
22+
font-size: .8rem;
23+
}
24+
25+
.path_icon {
26+
font-size: .7rem;
27+
}
1928
</style>
2029
<rect width="800" height="{{ height_ }}" style="fill: {{background_color}};" />
2130
<rect width="673" height="40" x="127" style="fill: {{header_color}};" />
22-
<rect width="1" height="{{ height_main_line }}" x="40" y="65" fill="{{indent_color}}" />
31+
<rect width="1" height="{{ height_main_line }}" x="40" y="90" fill="{{indent_color}}" />
2332

24-
<text y="60" font-family="Consolas, monospace" class="indexes" fill="{{main_color}}">
33+
<text y="85" font-family="Consolas, monospace" class="indexes" fill="{{main_color}}">
2534
{{{indexes}}}
2635
</text>
36+
2737
<text y="25" class="filename" font-family="Segoe WPC, Segoe UI, sans-serif" fill="{{main_color}}">
2838
<tspan fill="{{icon_color}}" font-family="Consolas, monospace">{}</tspan> info.json
2939
<tspan font-family="Consolas, monospace" style="font-size: .8rem;">&#8197;&#x2715;</tspan>
3040
</text>
31-
<text y="60" font-family="Consolas, monospace" class="main_text" fill="{{main_color}}">
41+
42+
<text x="8" y="60" fill="{{line_index_color}}" font-family="Consolas, monospace" class="path">
43+
<tspan>github.com > {{name}} ></tspan>
44+
<tspan fill="{{icon_color}}" font-family="Consolas, monospace" class="path_icon">{}</tspan>
45+
<tspan>info.json</tspan>
46+
</text>
47+
48+
<text y="85" font-family="Consolas, monospace" class="main_text" fill="{{main_color}}">
3249
{{{json}}}
3350
</text>
3451

35-
<g style="transform: translate({{indent_x}}px, 45px);">
52+
<g style="transform: translate({{indent_x}}px, 68px);">
3653
{{{indents}}}
3754
</g>
3855
</svg>

src/widget/widget.controller.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ export class WidgetController {
3030
indents,
3131
config.indent * 7.5
3232
),
33-
height: 52 + lines_count * 19,
34-
height_: 60 + lines_count * 19,
33+
name: process.env.GITHUB_USERNAME,
34+
height: 80 + lines_count * 19,
35+
height_: 80 + lines_count * 19,
3536
height_main_line: (lines_count - 2) * 19,
3637
indent_x: 40 + config.indent * 7.5,
3738

3839
background_color: config.colors.background,
3940
header_color: config.colors.header,
4041
icon_color: config.colors.icon_color,
4142
indent_color: config.colors.indent_lines,
42-
main_color: config.colors.main_text
43+
main_color: config.colors.main_text,
44+
line_index_color: config.colors.line_index
4345
};
4446
}
4547

0 commit comments

Comments
 (0)