({ className, redirect }: Props)
| 17 | * |
| 18 | */ |
| 19 | export function BytebaseLogo({ className, redirect }: Props) { |
| 20 | const { t } = useTranslation(); |
| 21 | const workspace = useWorkspace(); |
| 22 | const { record } = useRecentVisit(); |
| 23 | const navigate = useNavigate(); |
| 24 | const customLogo = workspace?.logo ?? ""; |
| 25 | |
| 26 | const content = ( |
| 27 | <span className="h-full w-full select-none flex flex-row justify-center items-center"> |
| 28 | {customLogo ? ( |
| 29 | <img |
| 30 | src={customLogo} |
| 31 | alt={t("settings.general.workspace.logo")} |
| 32 | className="h-full object-contain" |
| 33 | /> |
| 34 | ) : ( |
| 35 | <img |
| 36 | src={logoFull} |
| 37 | alt="Bytebase" |
| 38 | className="h-8 md:h-10 w-auto object-contain" |
| 39 | /> |
| 40 | )} |
| 41 | </span> |
| 42 | ); |
| 43 | |
| 44 | return ( |
| 45 | <div |
| 46 | className={cn( |
| 47 | "shrink-0 max-w-44 flex items-center overflow-hidden", |
| 48 | className |
| 49 | )} |
| 50 | > |
| 51 | {redirect ? ( |
| 52 | <RouterLink |
| 53 | to={{ name: redirect }} |
| 54 | className="h-full w-full cursor-pointer" |
| 55 | onClick={() => { |
| 56 | const route = navigate.resolve({ name: redirect }); |
| 57 | record(route.fullPath); |
| 58 | }} |
| 59 | > |
| 60 | {content} |
| 61 | </RouterLink> |
| 62 | ) : ( |
| 63 | content |
| 64 | )} |
| 65 | </div> |
| 66 | ); |
| 67 | } |
nothing calls this directly
no test coverage detected