mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-12 19:06:06 +02:00
* refactor(views): replace static timeAgo with shared useTimeAgo hook
The previous timeAgo helper in packages/core/utils.ts hardcoded English
output ("2d ago"), producing "更新于 2d ago" mixed-language strings in
zh locale. Replaced with a localized useTimeAgo() hook in
packages/views/i18n, backed by common.time.{just_now,minutes_ago,
hours_ago,days_ago} translation keys. Migrated all 10 view-side
call sites and removed the static function.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(issues): redesign board card layout
Properties were piling onto the bottom row (assignee + priority badge
+ start date + due date) until it overflowed. Restructured into four
semantic rows:
- Top: priority icon (left, icon-only — color already conveys urgency)
+ identifier; agent activity indicator (right)
- Title
- Chip row: project + labels
- Meta row: assignee (left, avatar + name when only property present;
bare avatar otherwise) + start/due dates + child progress
Long agent/team names truncate cleanly (min-w-0 + max-w-[160px]) and
dates/progress are shrink-0 so they never compress. When the meta row
contains only an assignee, the right side fills with "Updated 2d ago"
to avoid a half-empty row.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
740 B
TypeScript
18 lines
740 B
TypeScript
import { useT } from "./use-t";
|
|
|
|
// Localized relative-time formatter. Returns a function so call-site usage
|
|
// stays terse: `const timeAgo = useTimeAgo(); ...timeAgo(dateStr)`.
|
|
export function useTimeAgo() {
|
|
const { t } = useT("common");
|
|
return (dateStr: string): string => {
|
|
const diff = Date.now() - new Date(dateStr).getTime();
|
|
const minutes = Math.floor(diff / 60000);
|
|
if (minutes < 1) return t(($) => $.time.just_now);
|
|
if (minutes < 60) return t(($) => $.time.minutes_ago, { count: minutes });
|
|
const hours = Math.floor(minutes / 60);
|
|
if (hours < 24) return t(($) => $.time.hours_ago, { count: hours });
|
|
const days = Math.floor(hours / 24);
|
|
return t(($) => $.time.days_ago, { count: days });
|
|
};
|
|
}
|