Skip to content

Commit 367452d

Browse files
Coderabbit
1 parent 79993a4 commit 367452d

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/ui/src/components/filter-bar/filter-bar-date-picker.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export const FilterBarDatePicker = memo(function FilterBarDatePicker({
155155
value={fromDate}
156156
onChange={(e) => handleFromChange(e.target.value)}
157157
className="fb-date-input"
158-
aria-label="From date"
159158
/>
160159
</div>
161160
<div className="fb-date-field">

src/ui/src/components/filter-bar/hooks/use-suggestions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ function generateSuggestions<T>(
115115
// Date-range fields show a picker in the dropdown — surface presets and custom inputs
116116
// as value suggestions so keyboard navigation (Tab/↑↓/Enter) works like other fields.
117117
if (isDateRangeField(parsedInput.field)) {
118-
const query = parsedInput.query.toLowerCase();
118+
const lowerQuery = parsedInput.query.toLowerCase();
119119
for (const preset of DATE_RANGE_PRESETS) {
120-
if (!query || preset.label.toLowerCase().includes(query)) {
120+
if (!lowerQuery || preset.label.toLowerCase().includes(lowerQuery)) {
121121
items.push({
122122
type: "value",
123123
field: parsedInput.field,
@@ -127,7 +127,7 @@ function generateSuggestions<T>(
127127
}
128128
}
129129
// Custom range inputs are always shown (only when not filtering presets)
130-
if (!query) {
130+
if (!lowerQuery) {
131131
items.push({ type: "value", field: parsedInput.field, value: DATE_CUSTOM_FROM, label: "From date" });
132132
items.push({ type: "value", field: parsedInput.field, value: DATE_CUSTOM_TO, label: "To date" });
133133
items.push({ type: "value", field: parsedInput.field, value: DATE_CUSTOM_APPLY, label: "Apply" });

src/ui/src/lib/auth/server.production.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ export async function getServerUser(): Promise<User | null> {
6262
};
6363
}
6464

65-
function deriveDisplayName(username: string): string {
65+
export function deriveDisplayName(username: string): string {
6666
const namePart = username.includes("@") ? username.split("@")[0] : username;
6767
if (!namePart) return "User";
6868
const parts = namePart.split(/[._-]+/).filter(Boolean);
6969
if (parts.length <= 1) return namePart;
7070
return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
7171
}
7272

73-
function getInitials(name: string): string {
73+
export function getInitials(name: string): string {
7474
return name
7575
.split(/[\s@]+/)
7676
.slice(0, 2)

src/ui/src/lib/auth/server.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import {
3434
getServerUserRoles as prodGetServerUserRoles,
3535
getServerUsername as prodGetServerUsername,
3636
getServerUser as prodGetServerUser,
37+
deriveDisplayName,
38+
getInitials,
3739
} from "@/lib/auth/server.production";
3840
import { hasAdminRole } from "@/lib/auth/roles";
3941
import type { User } from "@/lib/auth/user-context";
@@ -64,13 +66,14 @@ export async function getServerUser(): Promise<User | null> {
6466

6567
const email = process.env.DEV_USER_EMAIL ?? username;
6668
const roles = await getServerUserRoles();
69+
const name = deriveDisplayName(username);
6770

6871
return {
6972
id: username,
70-
name: username,
73+
name,
7174
email,
7275
username,
7376
isAdmin: hasAdminRole(roles),
74-
initials: username.slice(0, 2).toUpperCase(),
77+
initials: getInitials(name),
7578
};
7679
}

0 commit comments

Comments
 (0)