Skip to content

Commit eef9e62

Browse files
committed
new: add version information
1 parent 4583d62 commit eef9e62

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

web/ui/src/App.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './App.css';
2-
import { Row, Col, Layout, ConfigProvider, theme } from 'antd';
2+
import { Row, Col, Layout, ConfigProvider, Space, theme } from 'antd';
33
import { useEffect, useState, useCallback } from "react";
4-
import { Content } from 'antd/es/layout/layout';
4+
import { Content, Footer } from 'antd/es/layout/layout';
55

66
import {
77
createBrowserRouter,
@@ -26,6 +26,7 @@ const router = createBrowserRouter([
2626

2727
const App: React.FC = () => {
2828
const [darkMode, setDarkMode] = useState(false);
29+
const [version, setVersion] = useState("");
2930
const windowQuery = window.matchMedia("(prefers-color-scheme:dark)");
3031

3132
const darkModeChange = useCallback((event: MediaQueryListEvent) => {
@@ -44,6 +45,15 @@ const App: React.FC = () => {
4445
// eslint-disable-line react-hooks/exhaustive-deps
4546
}, [windowQuery.matches]);
4647

48+
useEffect(() => {
49+
fetch("/api")
50+
.then(r => {
51+
let v = r.headers.get("Ybfeed-Version")
52+
if (v !== null) {
53+
setVersion(v)
54+
}
55+
})
56+
})
4757
return (
4858
<ConfigProvider
4959
theme={{
@@ -61,6 +71,11 @@ const App: React.FC = () => {
6171
<Col xs={1} lg={6}/>
6272
</Row>
6373
</Content>
74+
<Footer>
75+
<Space style={{fontSize: '0.8em', opacity: '0.4', width: '100%', justifyContent: 'center'}}>
76+
ybFeed {version}
77+
</Space>
78+
</Footer>
6479
</Layout>
6580
</div>
6681
</ConfigProvider>

0 commit comments

Comments
 (0)