[UI] Docs links (#12342) (#12346)

* Simplify navigation links

* simplify version.py

* Simplify docs links

* Consolidate

(cherry picked from commit aec215ca2f)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2026-07-10 06:37:02 +10:00
committed by GitHub
co-authored by Oliver
parent 04304c8182
commit eecc5fa186
5 changed files with 24 additions and 35 deletions
+2 -15
View File
@@ -133,27 +133,14 @@ def isInvenTreeDevelopmentVersion() -> bool:
return inventreeVersion().endswith('dev') return inventreeVersion().endswith('dev')
def inventreeDocsVersion() -> str:
"""Return the version string matching the latest documentation.
Development -> "latest"
Release -> "major.minor.sub" e.g. "0.5.2"
"""
if isInvenTreeDevelopmentVersion():
return 'latest'
return INVENTREE_SW_VERSION
def inventreeDocUrl() -> str: def inventreeDocUrl() -> str:
"""Return URL for InvenTree documentation site.""" """Return URL for InvenTree documentation site."""
tag = inventreeDocsVersion() return 'https://docs.inventree.org'
return f'https://docs.inventree.org/en/{tag}'
def inventreeAppUrl() -> str: def inventreeAppUrl() -> str:
"""Return URL for InvenTree app site.""" """Return URL for InvenTree app site."""
return 'https://docs.inventree.org/en/stable/app/' return 'https://docs.inventree.org/en/latest/app/'
def inventreeGithubUrl() -> str: def inventreeGithubUrl() -> str:
@@ -19,6 +19,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
import { apiUrl } from '@lib/functions/Api'; import { apiUrl } from '@lib/functions/Api';
import { useShallow } from 'zustand/react/shallow'; import { useShallow } from 'zustand/react/shallow';
import { api } from '../../App'; import { api } from '../../App';
import { docLinks } from '../../defaults/links';
import { generateUrl } from '../../functions/urls'; import { generateUrl } from '../../functions/urls';
import { useServerApiState } from '../../states/ServerApiState'; import { useServerApiState } from '../../states/ServerApiState';
@@ -111,7 +112,7 @@ const AboutContent = ({
{ {
ref: 'server', ref: 'server',
title: <Trans>InvenTree Version</Trans>, title: <Trans>InvenTree Version</Trans>,
link: 'https://github.com/inventree/InvenTree/releases', link: docLinks.releases,
copy: true copy: true
}, },
{ {
@@ -177,7 +178,12 @@ const AboutContent = ({
{ ref: 'app', title: <Trans>Mobile App</Trans> }, { ref: 'app', title: <Trans>Mobile App</Trans> },
{ ref: 'bug', title: <Trans>Submit Bug Report</Trans> } { ref: 'bug', title: <Trans>Submit Bug Report</Trans> }
], ],
data.links, {
doc: docLinks.docs,
code: docLinks.github,
app: docLinks.app,
bug: docLinks.bug
},
true true
)} )}
</Table.Tbody> </Table.Tbody>
@@ -6,7 +6,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { StylishText } from '@lib/components/StylishText'; import { StylishText } from '@lib/components/StylishText';
import { ModelType } from '@lib/enums/ModelType'; import { ModelType } from '@lib/enums/ModelType';
import { UserRoles } from '@lib/enums/Roles'; import { UserRoles } from '@lib/enums/Roles';
import { AboutLinks, DocumentationLinks } from '../../defaults/links'; import { AboutLinks } from '../../defaults/links';
import useInstanceName from '../../hooks/UseInstanceName'; import useInstanceName from '../../hooks/UseInstanceName';
import * as classes from '../../main.css'; import * as classes from '../../main.css';
import { useGlobalSettingsState } from '../../states/SettingsStates'; import { useGlobalSettingsState } from '../../states/SettingsStates';
@@ -158,11 +158,6 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
]; ];
}, [user]); }, [user]);
const menuItemsDocumentation: MenuLinkItem[] = useMemo(
() => DocumentationLinks(),
[]
);
const menuItemsAbout: MenuLinkItem[] = useMemo( const menuItemsAbout: MenuLinkItem[] = useMemo(
() => AboutLinks(globalSettings, user), () => AboutLinks(globalSettings, user),
[] []
@@ -203,12 +198,6 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
)} )}
</Container> </Container>
<div ref={ref}> <div ref={ref}>
<Space h='md' />
<MenuLinks
title={t`Documentation`}
links={menuItemsDocumentation}
beforeClick={closeFunc}
/>
<Space h='md' /> <Space h='md' />
<MenuLinks <MenuLinks
title={t`About`} title={t`About`}
@@ -10,6 +10,7 @@ import {
} from '@tabler/icons-react'; } from '@tabler/icons-react';
import { ApiEndpoints } from '@lib/index'; import { ApiEndpoints } from '@lib/index';
import { docLinks } from '../../defaults/links';
import { import {
projectCodeFields, projectCodeFields,
useCustomStateFields useCustomStateFields
@@ -86,11 +87,7 @@ export const QuickAction = () => {
description: t`Report a bug or request a feature on GitHub`, description: t`Report a bug or request a feature on GitHub`,
icon: <IconBrandGithub />, icon: <IconBrandGithub />,
buttonText: t`Open Issue`, buttonText: t`Open Issue`,
action: () => action: () => window.open(`${docLinks.bug}/new`, '_blank')
window.open(
'https://github.com/inventree/inventree/issues/new',
'_blank'
)
}, },
{ {
id: '1', id: '1',
+11 -1
View File
@@ -81,19 +81,22 @@ export function getNavTabs(user: UserStateProps): NavTab[] {
} }
export const docLinks = { export const docLinks = {
docs: 'https://docs.inventree.org/',
app: 'https://docs.inventree.org/en/latest/app/', app: 'https://docs.inventree.org/en/latest/app/',
getting_started: 'https://docs.inventree.org/en/latest/start/', getting_started: 'https://docs.inventree.org/en/latest/start/',
api: 'https://docs.inventree.org/en/latest/api/', api: 'https://docs.inventree.org/en/latest/api/',
developer: 'https://docs.inventree.org/en/latest/develop/contributing/', developer: 'https://docs.inventree.org/en/latest/develop/contributing/',
faq: 'https://docs.inventree.org/en/latest/faq/', faq: 'https://docs.inventree.org/en/latest/faq/',
github: 'https://github.com/inventree/inventree', github: 'https://github.com/inventree/inventree',
bug: 'https://github.com/inventree/inventree/issues',
releases: 'https://github.com/inventree/inventree/releases',
errorcodes: 'https://docs.inventree.org/en/latest/sref/error-codes/' errorcodes: 'https://docs.inventree.org/en/latest/sref/error-codes/'
}; };
export function DocumentationLinks(): MenuLinkItem[] { export function DocumentationLinks(): MenuLinkItem[] {
return [ return [
{ {
id: 'gettin-started', id: 'getting-started',
title: t`Getting Started`, title: t`Getting Started`,
link: docLinks.getting_started, link: docLinks.getting_started,
external: true, external: true,
@@ -174,6 +177,13 @@ export function AboutLinks(
user: UserStateProps user: UserStateProps
): MenuLinkItem[] { ): MenuLinkItem[] {
const base_items: MenuLinkItem[] = [ const base_items: MenuLinkItem[] = [
{
id: 'documentation',
title: t`Documentation`,
description: t`InvenTree documentation`,
link: docLinks.docs,
external: true
},
{ {
id: 'instance', id: 'instance',
title: t`System Information`, title: t`System Information`,