chore: Remove 'DEPLOYMENT' env option
Add 'Installation' section
This commit is contained in:
@@ -9,6 +9,7 @@ import Flex from 'shared/components/Flex';
|
||||
|
||||
type Props = {
|
||||
to?: string | Object,
|
||||
href?: string | Object,
|
||||
onClick?: (SyntheticEvent<>) => void,
|
||||
children?: React.Node,
|
||||
icon?: React.Node,
|
||||
@@ -63,6 +64,7 @@ class SidebarLink extends React.Component<Props> {
|
||||
menuOpen,
|
||||
hideDisclosure,
|
||||
exact,
|
||||
href,
|
||||
} = this.props;
|
||||
const showDisclosure = !!children && !hideDisclosure;
|
||||
const activeStyle = {
|
||||
@@ -80,7 +82,8 @@ class SidebarLink extends React.Component<Props> {
|
||||
onClick={onClick}
|
||||
exact={exact !== false}
|
||||
to={to}
|
||||
as={to ? undefined : 'div'}
|
||||
as={to ? undefined : href ? 'a' : 'div'}
|
||||
href={href}
|
||||
>
|
||||
{icon && <IconWrapper>{icon}</IconWrapper>}
|
||||
<Label onClick={this.handleExpand}>
|
||||
|
||||
53
app/components/Sidebar/components/Version.js
Normal file
53
app/components/Sidebar/components/Version.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Badge from 'components/Badge';
|
||||
import SidebarLink from './SidebarLink';
|
||||
import { version } from '../../../../package.json';
|
||||
|
||||
export default function Version() {
|
||||
// $FlowFixMe
|
||||
const [releasesBehind, setReleasesBehind] = React.useState(0);
|
||||
|
||||
// $FlowFixMe
|
||||
React.useEffect(() => {
|
||||
async function loadReleases() {
|
||||
let out = 0;
|
||||
const res = await fetch(
|
||||
'https://api.github.com/repos/outline/outline/releases'
|
||||
);
|
||||
const releases = await res.json();
|
||||
for (const release of releases) {
|
||||
if (release.tag_name === `v${version}`) {
|
||||
return setReleasesBehind(out);
|
||||
} else {
|
||||
out++;
|
||||
}
|
||||
}
|
||||
}
|
||||
loadReleases();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<SidebarLink
|
||||
href="https://github.com/outline/outline/releases"
|
||||
label={
|
||||
<React.Fragment>
|
||||
v{version}
|
||||
<br />
|
||||
<LilBadge>
|
||||
{releasesBehind === 0
|
||||
? 'Up to date'
|
||||
: `${releasesBehind} version${
|
||||
releasesBehind === 1 ? '' : 's'
|
||||
} behind`}
|
||||
</LilBadge>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const LilBadge = styled(Badge)`
|
||||
margin-left: 0;
|
||||
`;
|
||||
Reference in New Issue
Block a user