From d6db6362322d0eb16ae9c54df85cf522a4dcd3a2 Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Fri, 8 Mar 2024 17:14:05 +0100 Subject: [PATCH] autover --- .../landing-hero-github-stars.tsx | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/documentation/src/refine-theme/landing-hero-github-stars.tsx b/documentation/src/refine-theme/landing-hero-github-stars.tsx index e152fece..bc40b98d 100644 --- a/documentation/src/refine-theme/landing-hero-github-stars.tsx +++ b/documentation/src/refine-theme/landing-hero-github-stars.tsx @@ -1,12 +1,34 @@ -import React from "react"; -import clsx from "clsx"; -import { OrangeStarIcon } from "./icons/orange-star"; +import React, { useState, useEffect } from 'react'; +import clsx from 'clsx'; +import { OrangeStarIcon } from './icons/orange-star'; export const LandingHeroGithubStars = () => { + const [version, setVersion] = useState('0.1'); // Default version + + useEffect(() => { + // Function to fetch version information + const fetchVersion = async () => { + try { + const response = await fetch('https://update.openpanel.co/'); + const data = await response.text(); + setVersion(data.trim()); // Update the version state + } catch (error) { + console.error('Failed to fetch version:', error); + } + }; + + fetchVersion(); + }, []); // after initial render + + // Function to format version for URL + const formatVersionForURL = (version) => { + const parts = version.split('.'); + return `${parts[0]}.${parts[1]}/#${parts[1]}${parts[2]}`; + }; return ( { )} > - OpenPanel{" "}v0.1.5 - {" "} + OpenPanel {version} + {" "} is out