mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-01 16:37:39 +01:00
add backend info to settings sidebar
This commit is contained in:
parent
a9abe14810
commit
1176908129
1 changed files with 22 additions and 0 deletions
|
@ -1,9 +1,12 @@
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import Sticky from "react-stickynode";
|
import Sticky from "react-stickynode";
|
||||||
|
import { useAsync } from "react-use";
|
||||||
|
|
||||||
|
import { getBackendMeta } from "@/backend/accounts/meta";
|
||||||
import { Icons } from "@/components/Icon";
|
import { Icons } from "@/components/Icon";
|
||||||
import { SidebarLink, SidebarSection } from "@/components/layout/Sidebar";
|
import { SidebarLink, SidebarSection } from "@/components/layout/Sidebar";
|
||||||
import { Divider } from "@/components/utils/Divider";
|
import { Divider } from "@/components/utils/Divider";
|
||||||
|
import { useBackendUrl } from "@/hooks/auth/useBackendUrl";
|
||||||
import { useIsMobile } from "@/hooks/useIsMobile";
|
import { useIsMobile } from "@/hooks/useIsMobile";
|
||||||
import { conf } from "@/setup/config";
|
import { conf } from "@/setup/config";
|
||||||
|
|
||||||
|
@ -22,6 +25,13 @@ export function SidebarPart() {
|
||||||
{ text: "Connections", id: "settings-connection", icon: Icons.LINK },
|
{ text: "Connections", id: "settings-connection", icon: Icons.LINK },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const backendUrl = useBackendUrl();
|
||||||
|
|
||||||
|
const backendMeta = useAsync(async () => {
|
||||||
|
return getBackendMeta(backendUrl);
|
||||||
|
}, [backendUrl]);
|
||||||
|
|
||||||
|
// TODO loading/error state for backend
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function recheck() {
|
function recheck() {
|
||||||
const windowHeight =
|
const windowHeight =
|
||||||
|
@ -94,6 +104,18 @@ export function SidebarPart() {
|
||||||
<span>Domain</span>
|
<span>Domain</span>
|
||||||
<span className="text-right">{hostname}</span>
|
<span className="text-right">{hostname}</span>
|
||||||
</div>
|
</div>
|
||||||
|
{backendMeta.value ? (
|
||||||
|
<>
|
||||||
|
<div className="flex justify-between items-center space-x-3">
|
||||||
|
<span>Backend Version</span>
|
||||||
|
<span>{backendMeta.value.version}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between items-center space-x-3">
|
||||||
|
<span>Backend URL</span>
|
||||||
|
<span className="text-right">{backendUrl}</span>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</SidebarSection>
|
</SidebarSection>
|
||||||
</Sticky>
|
</Sticky>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue