This is an automated email from the ASF dual-hosted git repository.

mintsweet pushed a commit to branch feat-env-config
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit f128b1501e46f31ba357c39a726e2aa8c06e2cb7
Author: mintsweet <[email protected]>
AuthorDate: Fri Jan 5 15:21:36 2024 +1300

    feat(config-ui): adjust env config
---
 config-ui/env.example                  |  4 +++-
 config-ui/src/main.tsx                 |  2 +-
 config-ui/src/routes/layout/layout.tsx | 38 +++++++++++++++++++++++-----------
 config-ui/src/vite-env.d.ts            |  4 +++-
 4 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/config-ui/env.example b/config-ui/env.example
index fe2cca924..442439eda 100644
--- a/config-ui/env.example
+++ b/config-ui/env.example
@@ -1,5 +1,7 @@
 # About Basic Information
-# DEVLAKE_PRIMARY_COLOR=
+# DEVLAKE_TITLE_CUSTOM=
+# DEVLAKE_COLOR_CUSTOM=
+# DEVLAKE_COPYRIGHT_HIDE=
 
 # All plugins are loaded by default, optional plugins can be loaded
 # eg. DEVLAKE_PLUGINS=github,gitlab
diff --git a/config-ui/src/main.tsx b/config-ui/src/main.tsx
index 91b266ef2..d3b35c690 100644
--- a/config-ui/src/main.tsx
+++ b/config-ui/src/main.tsx
@@ -31,7 +31,7 @@ ReactDOM.render(
   <ConfigProvider
     theme={{
       token: {
-        colorPrimary: import.meta.env.DEVLAKE_PRIMARY_COLOR ?? '#7497F7',
+        colorPrimary: import.meta.env.DEVLAKE_COLOR_CUSTOM ?? '#7497F7',
       },
     }}
   >
diff --git a/config-ui/src/routes/layout/layout.tsx 
b/config-ui/src/routes/layout/layout.tsx
index 60cf20f1b..0b91b2aba 100644
--- a/config-ui/src/routes/layout/layout.tsx
+++ b/config-ui/src/routes/layout/layout.tsx
@@ -62,6 +62,8 @@ export const Layout = () => {
 
   const tipsRef = useRef(null);
 
+  console.log(import.meta.env);
+
   useEffect(() => {
     dispatch(init(plugins));
   }, []);
@@ -127,7 +129,13 @@ export const Layout = () => {
           overflow: 'auto',
         }}
       >
-        <Logo style={{ padding: 24 }} />
+        {import.meta.env.DEVLAKE_TITLE_CUSTOM ? (
+          <h2 style={{ margin: '36px 0', textAlign: 'center', color: '#fff' }}>
+            {import.meta.env.DEVLAKE_TITLE_CUSTOM}
+          </h2>
+        ) : (
+          <Logo style={{ padding: 24 }} />
+        )}
         <Menu
           mode="inline"
           theme="dark"
@@ -152,20 +160,26 @@ export const Layout = () => {
             background: 'transparent',
           }}
         >
-          {headerItems.map((item, i) => (
-            <ExternalLink key={item.label} link={item.link} style={{ display: 
'flex', alignItems: 'center' }}>
-              {item.icon}
-              <span style={{ marginLeft: 4 }}>{item.label}</span>
-              {i !== headerItems.length - 1 && <Divider type="vertical" />}
-            </ExternalLink>
-          ))}
+          {headerItems
+            .filter((item) =>
+              import.meta.env.DEVLAKE_COPYRIGHT_HIDE ? !['GitHub', 
'Slack'].includes(item.label) : true,
+            )
+            .map((item, i, arr) => (
+              <ExternalLink key={item.label} link={item.link} style={{ 
display: 'flex', alignItems: 'center' }}>
+                {item.icon}
+                <span style={{ marginLeft: 4 }}>{item.label}</span>
+                {i !== arr.length - 1 && <Divider type="vertical" />}
+              </ExternalLink>
+            ))}
         </Header>
-        <Content style={{ margin: '0 auto', width: 1188 }}>
+        <Content style={{ margin: '16px auto', width: 1188 }}>
           <Outlet />
         </Content>
-        <Footer style={{ color: '#a1a1a1', textAlign: 'center' }}>
-          <span>Apache 2.0 License</span>
-        </Footer>
+        {!import.meta.env.DEVLAKE_COPYRIGHT_HIDE && (
+          <Footer>
+            <p style={{ textAlign: 'center' }}>Apache 2.0 License</p>
+          </Footer>
+        )}
         <CSSTransition in={!!tipsShow} unmountOnExit timeout={300} 
nodeRef={tipsRef} classNames="tips">
           <S.Tips ref={tipsRef}>
             <div className="content">
diff --git a/config-ui/src/vite-env.d.ts b/config-ui/src/vite-env.d.ts
index 44941988d..0327e9ffb 100644
--- a/config-ui/src/vite-env.d.ts
+++ b/config-ui/src/vite-env.d.ts
@@ -20,7 +20,9 @@
 /// <reference types="vite-plugin-svgr/client" />
 
 interface ImportMetaEnv {
-  readonly DEVLAKE_PRIMARY_COLOR: string;
+  readonly DEVLAKE_TITLE_CUSTOM: string;
+  readonly DEVLAKE_COLOR_CUSTOM: string;
+  readonly DEVLAKE_COPYRIGHT_HIDE: boolean;
   readonly DEVLAKE_PLUGINS: string;
 }
 

Reply via email to