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