refactor(timesheet): rename filter date range labels

This commit is contained in:
2026-04-25 19:08:16 +03:30
parent d53a8a67d7
commit 8b16344aef
4 changed files with 41 additions and 26 deletions

View File

@@ -259,20 +259,18 @@ export default function TimesheetFilterBar({
type="button"
onClick={() => setIsExpanded((current) => !current)}
aria-label={isExpanded ? (labels?.hideFilters || "Hide filters") : (labels?.showFilters || "Filters")}
className={`relative inline-flex h-9 w-9 items-center justify-center rounded-md border text-sm transition-colors sm:w-auto sm:gap-2 sm:px-3 ${
className={`relative inline-flex h-9 w-9 items-center justify-center rounded-md border text-sm transition-colors ${
isExpanded || hasActiveFilters
? "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/15 dark:text-sky-300"
: "border-slate-200 bg-white text-slate-600 hover:border-slate-300 hover:text-slate-900 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-slate-600 dark:hover:text-white"
}`}
>
<SlidersHorizontal className="h-4 w-4" />
<span className="hidden sm:inline">{isExpanded ? (labels?.hideFilters || "Hide filters") : (labels?.showFilters || "Filters")}</span>
{hasActiveFilters && (
<span className="absolute -right-1 -top-1 z-10 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-sky-600 px-1 text-[10px] font-semibold leading-none text-white dark:bg-sky-500 sm:static sm:z-auto sm:h-auto sm:min-w-5 sm:px-1.5 sm:text-[11px] sm:leading-normal">
<span className="absolute -right-1 -top-1 z-10 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-sky-600 px-1 text-[10px] font-semibold leading-none text-white dark:bg-sky-500">
{activeChips.length}
</span>
)}
<ChevronDown className={`hidden h-4 w-4 transition-transform sm:inline ${isExpanded ? "rotate-180" : ""}`} />
</button>
<button
@@ -314,7 +312,7 @@ export default function TimesheetFilterBar({
/>
</MiniFilterBlock>
<MiniFilterBlock icon={<CalendarRange className="h-3.5 w-3.5" />} label={labels?.customTo || "To"}>
<MiniFilterBlock icon={<CalendarRange className="h-3.5 w-3.5" />} label={labels?.customTo || "To date"}>
<JalaliDatePicker
value={draftFilters.startedBefore}
onChange={(value) => setDraftFilters((current) => ({ ...current, startedBefore: value }))}

View File

@@ -378,8 +378,8 @@ export const en = {
billable: "Billable",
noTagsHint: "Create tags first from the Tags page.",
clearFilters: "Clear filters",
customFromLabel: "From",
customToLabel: "To",
customFromLabel: "From date",
customToLabel: "To date",
allClientsLabel: "All clients",
allProjectsLabel: "All projects",
allTagsLabel: "All tags",

View File

@@ -375,8 +375,8 @@ export const fa = {
billable: "قابل صورتحساب",
noTagsHint: "ابتدا از صفحه تگ‌ها، تگ ایجاد کنید.",
clearFilters: "پاک کردن فیلترها",
customFromLabel: "از",
customToLabel: "تا",
customFromLabel: "از تاریخ",
customToLabel: "تا تاریخ",
allClientsLabel: "همه مشتری‌ها",
allProjectsLabel: "همه پروژه‌ها",
allTagsLabel: "همه تگ‌ها",

View File

@@ -2253,21 +2253,38 @@ export default function Timesheet() {
<div className="flex shrink-0 items-center gap-2">
{runningEntry ? (
<>
<Button variant="destructive" onClick={() => void handleStop(runningEntry)} className="h-10 rounded-md px-4 text-xs font-semibold uppercase">
{t.timesheet?.stopTimer || "Stop"}
<Button
variant="destructive"
size="icon"
onClick={() => void handleStop(runningEntry)}
className="h-10 w-10 rounded-md"
title={t.timesheet?.stopTimer || "Stop"}
aria-label={t.timesheet?.stopTimer || "Stop"}
>
<Square className="h-4 w-4 fill-current" />
</Button>
<Button
variant="secondary"
size="icon"
onClick={openDiscardTimerModal}
disabled={isDiscardingTimer}
className="h-10 rounded-md px-4 text-xs font-semibold uppercase"
className="h-10 w-10 rounded-md"
title={(t.actions as { discard?: string } | undefined)?.discard || "Discard"}
aria-label={(t.actions as { discard?: string } | undefined)?.discard || "Discard"}
>
{isDiscardingTimer ? "..." : ((t.actions as { discard?: string } | undefined)?.discard || "Discard")}
{isDiscardingTimer ? "..." : <Trash2 className="h-4 w-4" />}
</Button>
</>
) : (
<Button onClick={() => void handleStartTimer()} disabled={isStartingTimer} className="h-10 rounded-md px-4 text-xs font-semibold uppercase">
{isStartingTimer ? "..." : (t.timesheet?.startTimer || "Start")}
<Button
onClick={() => void handleStartTimer()}
disabled={isStartingTimer}
size="icon"
className="h-10 w-10 rounded-md"
title={t.timesheet?.startTimer || "Start"}
aria-label={t.timesheet?.startTimer || "Start"}
>
{isStartingTimer ? "..." : <Play className="h-4 w-4 fill-current" />}
</Button>
)}
</div>