pierrejeambrun commented on code in PR #62169:
URL: https://github.com/apache/airflow/pull/62169#discussion_r2829071167
##########
airflow-core/src/airflow/ui/src/components/BrandLogo.tsx:
##########
@@ -0,0 +1,40 @@
+import { Box, Image, type BoxProps } from "@chakra-ui/react";
+import { useState, useEffect } from "react";
+
+import { useConfigServiceGetConfig } from "openapi/queries";
+import { AirflowPin } from "src/assets/AirflowPin";
+
+export const BrandLogo = (props: BoxProps) => {
+ const { data } = useConfigServiceGetConfig();
+ const [isValid, setIsValid] = useState(false);
+
+ const rawLogo = data
+ ? data.sections
+ .find((section) => section.name === "api")
+ ?.options.find((option) => option.key === "custom_logo")?.value
+ : undefined;
+
+ const logo = typeof rawLogo === "string" ? rawLogo : Array.isArray(rawLogo)
? rawLogo[0] : undefined;
+
+ useEffect(() => {
+ if (typeof logo !== "string" || logo.trim() === "") {
+ setIsValid(false);
+ return;
+ }
+
+ const img = new window.Image();
Review Comment:
no, window is globalThis in vite
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]