feat: integrate mobile work chat and Gitea delivery
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { getUserInitials } from "./get-user-initials";
|
||||
|
||||
describe("getUserInitials", () => {
|
||||
it("uses the first two name parts", () => {
|
||||
expect(getUserInitials("Sai Karthik")).toBe("SK");
|
||||
});
|
||||
|
||||
it("uses a neutral fallback while auth loads", () => {
|
||||
expect(getUserInitials()).toBe("U");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
export const getUserInitials = (name?: string): string => {
|
||||
const parts = name?.trim().split(/\s+/u).filter(Boolean) ?? [];
|
||||
if (parts.length === 0) {
|
||||
return "U";
|
||||
}
|
||||
return parts
|
||||
.slice(0, 2)
|
||||
.map((part) => part[0]?.toUpperCase() ?? "")
|
||||
.join("");
|
||||
};
|
||||
Reference in New Issue
Block a user