From a550b564023a174a4d74e55dec1f3249dc91082e Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Thu, 26 Jan 2023 16:35:27 +0300 Subject: [PATCH] Embed versions --- components/layout/topbar.js | 32 ++++++++++++++++++++++++++------ public/versions.json | 24 ------------------------ service/VersionService.js | 7 ------- 3 files changed, 26 insertions(+), 37 deletions(-) delete mode 100644 public/versions.json delete mode 100644 service/VersionService.js diff --git a/components/layout/topbar.js b/components/layout/topbar.js index 6615aa3b72..ae13d438c8 100644 --- a/components/layout/topbar.js +++ b/components/layout/topbar.js @@ -2,12 +2,36 @@ import getConfig from 'next/config'; import Link from 'next/link'; import { useEffect, useRef, useState } from 'react'; import { CSSTransition } from 'react-transition-group'; -import { VersionService } from '../../service/VersionService'; import { Badge } from '../lib/badge/Badge'; export default function Topbar(props) { const [activeMenuIndex, setActiveMenuIndex] = useState(null); - const [versions, setVersions] = useState([]); + const versions = [ + { + "version": "v9", + "url": "https://www.primereact.org" + }, + { + "version": "v8", + "url": "https://www.primefaces.org/primereact" + }, + { + "version": "v7", + "url": "https://www.primefaces.org/primereact-v7" + }, + { + "version": "v6", + "url": "https://www.primefaces.org/primereact-v6" + }, + { + "version": "v5", + "url": "https://www.primefaces.org/primereact-v5" + }, + { + "version": "v4", + "url": "https://www.primefaces.org/primereact-v4" + } + ]; const onMenuButtonClick = () => { props.onMenuButtonClick(); @@ -58,10 +82,6 @@ export default function Topbar(props) { }; }, [activeMenuIndex]); // eslint-disable-line react-hooks/exhaustive-deps - useEffect(() => { - VersionService.getVersions().then((data) => setVersions(data)); - }, []); // eslint-disable-line react-hooks/exhaustive-deps - const containerElement = useRef(null); const scrollListener = useRef(); diff --git a/public/versions.json b/public/versions.json deleted file mode 100644 index 28dd8f2c0b..0000000000 --- a/public/versions.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "versions": [ - { - "version": "v8", - "url": "https://www.primefaces.org/primereact" - }, - { - "version": "v7", - "url": "https://www.primefaces.org/primereact-v7" - }, - { - "version": "v6", - "url": "https://www.primefaces.org/primereact-v6" - }, - { - "version": "v5", - "url": "https://www.primefaces.org/primereact-v5" - }, - { - "version": "v4", - "url": "https://www.primefaces.org/primereact-v4" - } - ] -} diff --git a/service/VersionService.js b/service/VersionService.js deleted file mode 100644 index 5119eda892..0000000000 --- a/service/VersionService.js +++ /dev/null @@ -1,7 +0,0 @@ -export const VersionService = { - getVersions() { - return fetch('https://www.primefaces.org/primereact/versions.json') - .then((res) => res.json()) - .then((d) => d.versions); - } -};