071faa482c
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
18 lines
533 B
TypeScript
18 lines
533 B
TypeScript
import type { AuthUser } from '../../../packages/shared/src/contracts/auth';
|
|
|
|
export function resolveActivePublicUserCode(user: AuthUser | null | undefined) {
|
|
if (user?.publicUserCode?.trim()) {
|
|
return user.publicUserCode.trim();
|
|
}
|
|
|
|
const raw =
|
|
user?.id.replace(/[^a-zA-Z0-9]/gu, '').toUpperCase() || '00000000';
|
|
return `SY-${raw.slice(-8).padStart(8, '0')}`;
|
|
}
|
|
|
|
export function resolveActiveUserAvatarLabel(
|
|
user: AuthUser | null | undefined,
|
|
) {
|
|
return (user?.displayName || '叙').slice(0, 1).toUpperCase();
|
|
}
|