From 349cd86c67276c275d555173721c490e0ff47fcf Mon Sep 17 00:00:00 2001 From: AlexSciFier <66871322+AlexSciFier@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:17:08 +0300 Subject: [PATCH 1/3] change versioning method --- frontend/.env | 1 + frontend/package-lock.json | 4 ++-- frontend/package.json | 2 +- frontend/src/components/PrivateWrapper.jsx | 26 +++++++++++++++------- frontend/src/helpers/constants.js | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 frontend/.env diff --git a/frontend/.env b/frontend/.env new file mode 100644 index 0000000..1bfdf63 --- /dev/null +++ b/frontend/.env @@ -0,0 +1 @@ +REACT_APP_VERSION=$npm_package_version \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e184a76..4959d18 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "neonlink-frontend", - "version": "1.2.0", + "version": "1.4.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "neonlink-frontend", - "version": "1.2.0", + "version": "1.4.9", "dependencies": { "@dnd-kit/core": "^6.0.8", "@dnd-kit/modifiers": "^6.0.1", diff --git a/frontend/package.json b/frontend/package.json index 1d230a8..57962b9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "neonlink-frontend", - "version": "1.2.0", + "version": "1.4.9", "private": true, "dependencies": { "@dnd-kit/core": "^6.0.8", diff --git a/frontend/src/components/PrivateWrapper.jsx b/frontend/src/components/PrivateWrapper.jsx index 6f37e5c..0b8510a 100644 --- a/frontend/src/components/PrivateWrapper.jsx +++ b/frontend/src/components/PrivateWrapper.jsx @@ -1,8 +1,14 @@ import React, { useEffect } from "react"; import { Route, Routes, useLocation, useNavigate } from "react-router"; import NavBar from "./NavBar"; -import { useUserCurrentStore, userCurrentKeys } from "../stores/userCurrentStore"; -import { appSettingsKeys, useAppSettingsStore } from "../stores/appSettingsStore"; +import { + useUserCurrentStore, + userCurrentKeys, +} from "../stores/userCurrentStore"; +import { + appSettingsKeys, + useAppSettingsStore, +} from "../stores/appSettingsStore"; const Dashboard = React.lazy(() => import("../pages/dashboard")); const NotFound = React.lazy(() => import("../pages/notFound")); @@ -20,17 +26,21 @@ const routes = [ ]; export default function PrivateWrapper() { - const [ authenticationEnabled, ] = useAppSettingsStore(appSettingsKeys.AuthenticationEnabled); - const [ forceRegistration, ] = useAppSettingsStore(appSettingsKeys.ForceRegistration); - const [ authenticated, ] = useUserCurrentStore(userCurrentKeys.Authenticated); - const { pathname,search } = useLocation(); + const [authenticationEnabled] = useAppSettingsStore( + appSettingsKeys.AuthenticationEnabled + ); + const [forceRegistration] = useAppSettingsStore( + appSettingsKeys.ForceRegistration + ); + const [authenticated] = useUserCurrentStore(userCurrentKeys.Authenticated); + const { pathname, search, hash } = useLocation(); const navigate = useNavigate(); useEffect(() => { if (forceRegistration) navigate("/register"); else if (authenticationEnabled && !authenticated) navigate("/login"); - else navigate(pathname+search); - // eslint-disable-next-line react-hooks/exhaustive-deps + else navigate(pathname + hash + search); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [authenticated, authenticationEnabled, forceRegistration]); return ( diff --git a/frontend/src/helpers/constants.js b/frontend/src/helpers/constants.js index 09035c6..318533c 100644 --- a/frontend/src/helpers/constants.js +++ b/frontend/src/helpers/constants.js @@ -1,5 +1,5 @@ export const APP_NAME = "NeonLink"; -export const VERSION = "1.4.8"; +export const VERSION = process.env.REACT_APP_VERSION; export const DEF_MAX_ITEMS = 20; export const DEF_COLUMNS = 3; export const CARD_HEADER_STYLE = [ From 253bb379624852f53151e4d615f35bfc6e65b123 Mon Sep 17 00:00:00 2001 From: AlexSciFier <66871322+AlexSciFier@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:18:25 +0300 Subject: [PATCH 2/3] fix: consistent settings tabs --- frontend/src/pages/settings/tabHeader.jsx | 5 +++-- frontend/src/pages/settings/tabView.jsx | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/settings/tabHeader.jsx b/frontend/src/pages/settings/tabHeader.jsx index 4e33acb..fbc0834 100644 --- a/frontend/src/pages/settings/tabHeader.jsx +++ b/frontend/src/pages/settings/tabHeader.jsx @@ -2,13 +2,14 @@ import React from "react"; export default function TabHeader({ title, isActive, onClick }) { return ( -
  • {title} -
  • + ); } diff --git a/frontend/src/pages/settings/tabView.jsx b/frontend/src/pages/settings/tabView.jsx index afb1552..890dd9e 100644 --- a/frontend/src/pages/settings/tabView.jsx +++ b/frontend/src/pages/settings/tabView.jsx @@ -1,11 +1,13 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import TabHeader from "./tabHeader"; import AboutTab from "./tabs/aboutTab"; import GroupTab from "./tabs/groupTab/groupTab"; import MainTab from "./tabs/mainTab/mainTab"; import InterfaceTab from "./tabs/interfaceTab/interfaceTab"; +import { useLocation } from "react-router"; export default function TabView() { + const location = useLocation(); const tabs = [ { header: "Main", @@ -27,6 +29,14 @@ export default function TabView() { const [curentTab, setCurentTab] = useState(0); + useEffect(() => { + if (location.hash) { + let found = tabs.filter((tab) => tab.header === location.hash.slice(1)); + let foundIdx = tabs.indexOf(found[0]); + setCurentTab(foundIdx); + } + }, []); + return (