mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-11 06:44:13 +00:00
♻️ show idp name in user selector
This commit is contained in:
@@ -8,7 +8,11 @@ import { useDebounce } from "use-debounce";
|
|||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { MultiSelectTagInput } from "./multi-select/multi-select-tag-input";
|
import { MultiSelectTagInput } from "./multi-select/multi-select-tag-input";
|
||||||
|
|
||||||
export type SelectedUser = { id: string; text: string };
|
export type SelectedUser = {
|
||||||
|
id: string;
|
||||||
|
text: string;
|
||||||
|
ipdName?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
export type UsersSelectorProps = {
|
export type UsersSelectorProps = {
|
||||||
orgId: string;
|
orgId: string;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ type UserDisplayNameInput =
|
|||||||
email?: string | null;
|
email?: string | null;
|
||||||
name?: string | null;
|
name?: string | null;
|
||||||
username?: string | null;
|
username?: string | null;
|
||||||
|
idpName?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,16 +22,25 @@ export function getUserDisplayName(input: UserDisplayNameInput): string {
|
|||||||
let email: string | null | undefined;
|
let email: string | null | undefined;
|
||||||
let name: string | null | undefined;
|
let name: string | null | undefined;
|
||||||
let username: string | null | undefined;
|
let username: string | null | undefined;
|
||||||
|
let idpName: string | null | undefined;
|
||||||
|
|
||||||
if ("user" in input) {
|
if ("user" in input) {
|
||||||
email = input.user.email;
|
email = input.user.email;
|
||||||
name = input.user.name;
|
name = input.user.name;
|
||||||
username = input.user.username;
|
username = input.user.username;
|
||||||
|
idpName = input.user.idpName;
|
||||||
} else {
|
} else {
|
||||||
email = input.email;
|
email = input.email;
|
||||||
name = input.name;
|
name = input.name;
|
||||||
username = input.username;
|
username = input.username;
|
||||||
|
idpName = input.idpName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return email || name || username || "";
|
let nameShown = email || name || username || "";
|
||||||
|
|
||||||
|
if (idpName) {
|
||||||
|
nameShown = `${nameShown} (${idpName})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nameShown;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user