2022-03-16 06:26:15 +00:00
|
|
|
import { useLanguageProfiles } from "@/apis/hooks";
|
|
|
|
import { FunctionComponent, useMemo } from "react";
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
index: number | null;
|
|
|
|
empty?: string;
|
|
|
|
}
|
|
|
|
|
2022-05-31 15:49:04 +00:00
|
|
|
const LanguageProfileName: FunctionComponent<Props> = ({
|
2022-03-16 06:26:15 +00:00
|
|
|
index,
|
|
|
|
empty = "Unknown Profile",
|
|
|
|
}) => {
|
|
|
|
const { data } = useLanguageProfiles();
|
|
|
|
|
|
|
|
const name = useMemo(
|
|
|
|
() => data?.find((v) => v.profileId === index)?.name ?? empty,
|
|
|
|
[data, empty, index]
|
|
|
|
);
|
|
|
|
|
2022-05-31 15:49:04 +00:00
|
|
|
return <>{name}</>;
|
2022-03-16 06:26:15 +00:00
|
|
|
};
|
|
|
|
|
2022-05-31 15:49:04 +00:00
|
|
|
export default LanguageProfileName;
|