1- local domain = require (" codeme.domain " )
1+ local util = require (" codeme.util " )
22local renderer = require (" codeme.ui.renderer" )
33
44local M = {}
@@ -23,26 +23,26 @@ function M.render(stats)
2323 { " Period" , " Time" , " Lines" , " Files" },
2424 {
2525 " Today" ,
26- domain .format_duration (today .total_time or 0 ),
27- domain .format_number (today .total_lines or 0 ),
26+ util .format_duration (today .total_time or 0 ),
27+ util .format_number (today .total_lines or 0 ),
2828 tostring (today .total_files or 0 ),
2929 },
3030 {
3131 " This Week" ,
32- domain .format_duration (this_week .total_time or 0 ),
33- domain .format_number (this_week .total_lines or 0 ),
32+ util .format_duration (this_week .total_time or 0 ),
33+ util .format_number (this_week .total_lines or 0 ),
3434 tostring (this_week .total_files or 0 ),
3535 },
3636 {
3737 " This Month" ,
38- domain .format_duration (this_month .total_time or 0 ),
39- domain .format_number (this_month .total_lines or 0 ),
38+ util .format_duration (this_month .total_time or 0 ),
39+ util .format_number (this_month .total_lines or 0 ),
4040 tostring (this_month .total_files or 0 ),
4141 },
4242 {
4343 " All Time" ,
44- domain .format_duration (all_time .total_time or 0 ),
45- domain .format_number (all_time .total_lines or 0 ),
44+ util .format_duration (all_time .total_time or 0 ),
45+ util .format_number (all_time .total_lines or 0 ),
4646 tostring (all_time .total_files or 0 ),
4747 },
4848 }
@@ -132,9 +132,9 @@ function M.render(stats)
132132 table.insert (record_list , {
133133 icon = " 🏆" ,
134134 title = " Best Day" ,
135- value = domain .format_duration (most_productive_day .time ),
136- detail = most_productive_day .date and domain .format_date (most_productive_day .date ) or " " ,
137- extra = most_productive_day .lines and domain .format_number (most_productive_day .lines ) .. " lines" or " " ,
135+ value = util .format_duration (most_productive_day .time ),
136+ detail = most_productive_day .date and util .format_date (most_productive_day .date ) or " " ,
137+ extra = most_productive_day .lines and util .format_number (most_productive_day .lines ) .. " lines" or " " ,
138138 })
139139 end
140140
@@ -148,8 +148,8 @@ function M.render(stats)
148148 table.insert (record_list , {
149149 icon = " ⏱️" ,
150150 title = " Longest Session" ,
151- value = domain .format_duration (longest_session .duration ),
152- detail = longest_session .date and domain .format_date (longest_session .date ) or " " ,
151+ value = util .format_duration (longest_session .duration ),
152+ detail = longest_session .date and util .format_date (longest_session .date ) or " " ,
153153 extra = time_range ,
154154 })
155155 end
@@ -159,15 +159,15 @@ function M.render(stats)
159159 table.insert (record_list , {
160160 icon = " 📝" ,
161161 title = " Most Lines" ,
162- value = domain .format_number (highest_daily_output .lines ) .. " lines" ,
163- detail = highest_daily_output .date and domain .format_date (highest_daily_output .date ) or " " ,
162+ value = util .format_number (highest_daily_output .lines ) .. " lines" ,
163+ detail = highest_daily_output .date and util .format_date (highest_daily_output .date ) or " " ,
164164 extra = highest_daily_output .session_count and highest_daily_output .session_count .. " sessions" or " " ,
165165 })
166166 end
167167
168168 local best_streak = records .best_streak or {}
169169 if best_streak .day_count and best_streak .day_count > 0 then
170- local streak_icon , _ = domain .get_streak_display (best_streak .day_count )
170+ local streak_icon , _ = util .get_streak_display (best_streak .day_count )
171171 local date_range = " "
172172 if best_streak .start_date and best_streak .end_date then
173173 date_range = best_streak .start_date :sub (6 , 10 ) .. " - " .. best_streak .end_date :sub (6 , 10 )
@@ -178,7 +178,7 @@ function M.render(stats)
178178 title = " Best Streak" ,
179179 value = best_streak .day_count .. " days " .. streak_icon ,
180180 detail = date_range ,
181- extra = best_streak .total_time and domain .format_duration (best_streak .total_time ) .. " total" or " " ,
181+ extra = best_streak .total_time and util .format_duration (best_streak .total_time ) .. " total" or " " ,
182182 })
183183 end
184184
@@ -230,7 +230,7 @@ function M.render(stats)
230230 end
231231
232232 if most_languages_day and most_languages_day .date and most_languages_day .date ~= " " then
233- local languages_count = domain .safe_length (most_languages_day .languages )
233+ local languages_count = util .safe_length (most_languages_day .languages )
234234 if languages_count > 0 then
235235 table.insert (lines , {
236236 { " 🌍 " , " normal" },
@@ -307,7 +307,7 @@ function M.render(stats)
307307 if gap > 0 and today_time > 0 then
308308 table.insert (challenges , {
309309 icon = " 🎯" ,
310- text = domain .format_duration (gap ) .. " more to beat your best day" ,
310+ text = util .format_duration (gap ) .. " more to beat your best day" ,
311311 color = gap < 3600 and " exgreen" or " exyellow" ,
312312 })
313313 end
@@ -333,7 +333,7 @@ function M.render(stats)
333333 if longest_session .duration then
334334 table.insert (challenges , {
335335 icon = " ⏰" ,
336- text = " Can you beat " .. domain .format_duration (longest_session .duration ) .. " in one session?" ,
336+ text = " Can you beat " .. util .format_duration (longest_session .duration ) .. " in one session?" ,
337337 color = " exyellow" ,
338338 })
339339 end
0 commit comments