[UI] Docs links (#12342)
* Simplify navigation links * simplify version.py * Simplify docs links * Consolidate
This commit is contained in:
parent
c9d98cb545
commit
aec215ca2f
|
|
@ -133,27 +133,14 @@ def isInvenTreeDevelopmentVersion() -> bool:
|
|||
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:
|
||||
"""Return URL for InvenTree documentation site."""
|
||||
tag = inventreeDocsVersion()
|
||||
return f'https://docs.inventree.org/en/{tag}'
|
||||
return 'https://docs.inventree.org'
|
||||
|
||||
|
||||
def inventreeAppUrl() -> str:
|
||||
"""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:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
|||
import { apiUrl } from '@lib/functions/Api';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { api } from '../../App';
|
||||
import { docLinks } from '../../defaults/links';
|
||||
import { generateUrl } from '../../functions/urls';
|
||||
import { useServerApiState } from '../../states/ServerApiState';
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ const AboutContent = ({
|
|||
{
|
||||
ref: 'server',
|
||||
title: <Trans>InvenTree Version</Trans>,
|
||||
link: 'https://github.com/inventree/InvenTree/releases',
|
||||
link: docLinks.releases,
|
||||
copy: true
|
||||
},
|
||||
{
|
||||
|
|
@ -177,7 +178,12 @@ const AboutContent = ({
|
|||
{ ref: 'app', title: <Trans>Mobile App</Trans> },
|
||||
{ ref: 'bug', title: <Trans>Submit Bug Report</Trans> }
|
||||
],
|
||||
data.links,
|
||||
{
|
||||
doc: docLinks.docs,
|
||||
code: docLinks.github,
|
||||
app: docLinks.app,
|
||||
bug: docLinks.bug
|
||||
},
|
||||
true
|
||||
)}
|
||||
</Table.Tbody>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|||
import { StylishText } from '@lib/components/StylishText';
|
||||
import { ModelType } from '@lib/enums/ModelType';
|
||||
import { UserRoles } from '@lib/enums/Roles';
|
||||
import { AboutLinks, DocumentationLinks } from '../../defaults/links';
|
||||
import { AboutLinks } from '../../defaults/links';
|
||||
import useInstanceName from '../../hooks/UseInstanceName';
|
||||
import * as classes from '../../main.css';
|
||||
import { useGlobalSettingsState } from '../../states/SettingsStates';
|
||||
|
|
@ -158,11 +158,6 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
|
|||
];
|
||||
}, [user]);
|
||||
|
||||
const menuItemsDocumentation: MenuLinkItem[] = useMemo(
|
||||
() => DocumentationLinks(),
|
||||
[]
|
||||
);
|
||||
|
||||
const menuItemsAbout: MenuLinkItem[] = useMemo(
|
||||
() => AboutLinks(globalSettings, user),
|
||||
[]
|
||||
|
|
@ -203,12 +198,6 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
|
|||
)}
|
||||
</Container>
|
||||
<div ref={ref}>
|
||||
<Space h='md' />
|
||||
<MenuLinks
|
||||
title={t`Documentation`}
|
||||
links={menuItemsDocumentation}
|
||||
beforeClick={closeFunc}
|
||||
/>
|
||||
<Space h='md' />
|
||||
<MenuLinks
|
||||
title={t`About`}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
} from '@tabler/icons-react';
|
||||
|
||||
import { ApiEndpoints } from '@lib/index';
|
||||
import { docLinks } from '../../defaults/links';
|
||||
import {
|
||||
projectCodeFields,
|
||||
useCustomStateFields
|
||||
|
|
@ -86,11 +87,7 @@ export const QuickAction = () => {
|
|||
description: t`Report a bug or request a feature on GitHub`,
|
||||
icon: <IconBrandGithub />,
|
||||
buttonText: t`Open Issue`,
|
||||
action: () =>
|
||||
window.open(
|
||||
'https://github.com/inventree/inventree/issues/new',
|
||||
'_blank'
|
||||
)
|
||||
action: () => window.open(`${docLinks.bug}/new`, '_blank')
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
|
|
|
|||
|
|
@ -81,19 +81,22 @@ export function getNavTabs(user: UserStateProps): NavTab[] {
|
|||
}
|
||||
|
||||
export const docLinks = {
|
||||
docs: 'https://docs.inventree.org/',
|
||||
app: 'https://docs.inventree.org/en/latest/app/',
|
||||
getting_started: 'https://docs.inventree.org/en/latest/start/',
|
||||
api: 'https://docs.inventree.org/en/latest/api/',
|
||||
developer: 'https://docs.inventree.org/en/latest/develop/contributing/',
|
||||
faq: 'https://docs.inventree.org/en/latest/faq/',
|
||||
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/'
|
||||
};
|
||||
|
||||
export function DocumentationLinks(): MenuLinkItem[] {
|
||||
return [
|
||||
{
|
||||
id: 'gettin-started',
|
||||
id: 'getting-started',
|
||||
title: t`Getting Started`,
|
||||
link: docLinks.getting_started,
|
||||
external: true,
|
||||
|
|
@ -174,6 +177,13 @@ export function AboutLinks(
|
|||
user: UserStateProps
|
||||
): MenuLinkItem[] {
|
||||
const base_items: MenuLinkItem[] = [
|
||||
{
|
||||
id: 'documentation',
|
||||
title: t`Documentation`,
|
||||
description: t`InvenTree documentation`,
|
||||
link: docLinks.docs,
|
||||
external: true
|
||||
},
|
||||
{
|
||||
id: 'instance',
|
||||
title: t`System Information`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue