Add new features and update configurations for improved functionality
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
String formatRelativeTime(DateTime timestamp) {
|
||||
final difference = DateTime.now().toUtc().difference(timestamp.toUtc());
|
||||
|
||||
if (difference.inMinutes < 1) {
|
||||
return "Just now";
|
||||
}
|
||||
if (difference.inHours < 1) {
|
||||
return "${difference.inMinutes}m";
|
||||
}
|
||||
if (difference.inDays < 1) {
|
||||
return "${difference.inHours}h";
|
||||
}
|
||||
if (difference.inDays < 7) {
|
||||
return "${difference.inDays}d";
|
||||
}
|
||||
|
||||
final weeks = difference.inDays ~/ 7;
|
||||
return "${weeks}w";
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import "package:path/path.dart" as p;
|
||||
|
||||
String shortenPath(String fullPath, String? projectRoot) {
|
||||
if (projectRoot == null || projectRoot.isEmpty) return fullPath;
|
||||
|
||||
final root = p.normalize(projectRoot);
|
||||
final norm = p.normalize(fullPath);
|
||||
|
||||
if (norm.startsWith(root)) {
|
||||
final rel = norm.substring(root.length);
|
||||
// trim leading separator
|
||||
return rel.startsWith(p.separator) ? rel.substring(1) : rel;
|
||||
}
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
Reference in New Issue
Block a user