From b3f521ca2055b91d7adddf96563cca6bf92e3d59 Mon Sep 17 00:00:00 2001
From: rolandlor <33499567+rolandlor@users.noreply.github.com>
Date: Wed, 10 Jan 2024 10:57:55 +0100
Subject: [PATCH] fix: correct the bee version detection (#645)
* feat: Github repository link to ethersphere/bee-dashboard
* fix: correct the Bee version detection
---
src/components/SideBar.tsx | 12 ++++++++++++
src/constants.ts | 1 +
src/providers/Bee.tsx | 9 +++++++--
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx
index dac6332..d0140b7 100644
--- a/src/components/SideBar.tsx
+++ b/src/components/SideBar.tsx
@@ -4,6 +4,7 @@ import { ReactElement, useContext } from 'react'
import { Link } from 'react-router-dom'
import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
import DocsIcon from 'remixicon-react/BookOpenLineIcon'
+import GithubIcon from 'remixicon-react/GithubFillIcon'
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
import HomeIcon from 'remixicon-react/Home3LineIcon'
import SettingsIcon from 'remixicon-react/Settings2LineIcon'
@@ -17,6 +18,7 @@ import SideBarItem from './SideBarItem'
import SideBarStatus from './SideBarStatus'
import { BeeModes } from '@ethersphere/bee-js'
import { BEE_DOCS_HOST } from '../constants'
+import { GITHUB_BEE_DASHBOARD_URL } from '../constants'
const drawerWidth = 300
@@ -126,6 +128,16 @@ export default function SideBar(): ReactElement {
/>
+
+
+
+ }
+ iconEnd={}
+ label={Github repository}
+ />
+
+
diff --git a/src/constants.ts b/src/constants.ts
index 9a69931..6359e8a 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -6,6 +6,7 @@ export const BLOCKCHAIN_EXPLORER_URL = 'https://blockscout.com/xdai/mainnet'
export const BEE_DOCS_HOST = 'https://docs.ethswarm.org/docs/'
export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7'
export const GITHUB_REPO_URL = 'https://api.github.com/repos/ethersphere/bee'
+export const GITHUB_BEE_DASHBOARD_URL = 'https://github.com/ethersphere/bee-dashboard.git'
export const BEE_DESKTOP_LATEST_RELEASE_PAGE = 'https://github.com/ethersphere/bee-desktop/releases/latest'
export const BEE_DESKTOP_LATEST_RELEASE_PAGE_API =
'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest'
diff --git a/src/providers/Bee.tsx b/src/providers/Bee.tsx
index 63586e0..3279e9c 100644
--- a/src/providers/Bee.tsx
+++ b/src/providers/Bee.tsx
@@ -134,14 +134,17 @@ function getStatus(
error: Error | null,
isDesktop: boolean,
startedAt: number,
+ latestPublishedVersion: string | undefined,
+ latestUserVersion: string | undefined,
): Status {
const status: Status = { ...initialValues.status }
// Version check
status.version.isEnabled = !isDesktop
status.version.checkState =
- debugApiHealth &&
- semver.satisfies(debugApiHealth.version, PackageJson.engines.bee, {
+ latestPublishedVersion &&
+ latestUserVersion &&
+ semver.satisfies(latestPublishedVersion, latestUserVersion, {
includePrerelease: true,
})
? CheckState.OK
@@ -435,6 +438,8 @@ export function Provider({ children, isDesktop }: Props): ReactElement {
error,
Boolean(isDesktop),
startedAt,
+ latestPublishedVersion,
+ latestUserVersion,
)
useEffect(() => {