2022-04-26 08:48:17 +00:00
|
|
|
import { useSession } from "next-auth/react";
|
|
|
|
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-11-25 12:36:33 +00:00
|
|
|
import { TopBanner } from "@calcom/ui";
|
2022-04-26 08:48:17 +00:00
|
|
|
|
2022-05-17 20:43:27 +00:00
|
|
|
function ImpersonatingBanner() {
|
2022-04-26 08:48:17 +00:00
|
|
|
const { t } = useLocale();
|
|
|
|
const { data } = useSession();
|
|
|
|
|
|
|
|
if (!data?.user.impersonatedByUID) return null;
|
|
|
|
|
|
|
|
return (
|
2022-11-25 12:36:33 +00:00
|
|
|
<>
|
|
|
|
<TopBanner
|
|
|
|
text={t("impersonating_user_warning", { user: data.user.username })}
|
|
|
|
variant="warning"
|
|
|
|
actions={
|
|
|
|
<a className="border-b border-b-black" href="/auth/logout">
|
2022-12-15 13:45:54 +00:00
|
|
|
{t("impersonating_stop_instructions")}
|
2022-11-25 12:36:33 +00:00
|
|
|
</a>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</>
|
2022-04-26 08:48:17 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ImpersonatingBanner;
|