Skip to content

Commit ef8f92d

Browse files
Add about page with project info (#44)
References ========== - https://koenvangilst.nl/snippets/git-hash - https://nodejs.dev/learn/the-package-json-guide
1 parent 554005b commit ef8f92d

File tree

7 files changed

+217
-136
lines changed

7 files changed

+217
-136
lines changed

components/Admin/AboutApp/index.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Descriptions, Row, Badge, Space } from 'antd';
2+
3+
const AboutApp = () => (
4+
<Row justify="center">
5+
<Descriptions bordered>
6+
<Descriptions.Item label="Name" span={3}>
7+
{process.env.APP_NAME}
8+
</Descriptions.Item>
9+
<Descriptions.Item label="Description" span={3}>
10+
{process.env.APP_DESCRIPTION}
11+
</Descriptions.Item>
12+
<Descriptions.Item label="Version" span={3}>
13+
v{process.env.APP_VERSION}
14+
</Descriptions.Item>
15+
<Descriptions.Item label="Homepage" span={2}>
16+
<a href={process.env.HOMEPAGE}>{process.env.HOMEPAGE}</a>
17+
</Descriptions.Item>
18+
<Descriptions.Item label="Status" span={1}>
19+
<Badge status="processing" text="Running" />
20+
</Descriptions.Item>
21+
<Descriptions.Item label="Repository URL" span={3}>
22+
<a href={process.env.REPOSITORY_URL}>{process.env.REPOSITORY_URL}</a>
23+
</Descriptions.Item>
24+
<Descriptions.Item label="Bug Tracker" span={3}>
25+
<a href={process.env.BUG_TRACKER}>{process.env.BUG_TRACKER}</a>
26+
</Descriptions.Item>
27+
<Descriptions.Item label="Hash" span={3}>
28+
<a href={`${process.env.REPOSITORY_URL}/tree/${process.env.COMMIT_HASH}`}>
29+
{process.env.COMMIT_HASH.substring(0, 8)}
30+
</a>
31+
</Descriptions.Item>
32+
<Descriptions.Item label="License" span={3}>
33+
{process.env.APP_LICENSE}
34+
</Descriptions.Item>
35+
</Descriptions>
36+
</Row>
37+
);
38+
39+
export default AboutApp;

components/Admin/Navbar/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { useEffect, useState } from 'react';
22
import LinkTo from '~/components/LinkTo';
33
import { Avatar, Col, Menu, Row, Space, Typography } from 'antd';
4-
import { LinkOutlined, FormOutlined, TagsOutlined, UserOutlined } from '@ant-design/icons';
4+
import {
5+
InfoCircleOutlined,
6+
LinkOutlined,
7+
FormOutlined,
8+
TagsOutlined,
9+
UserOutlined
10+
} from '@ant-design/icons';
511

612
import API from '~/lib/api';
713

@@ -19,6 +25,10 @@ export const navbar = {
1925
redirects: {
2026
icon: <LinkOutlined />,
2127
title: 'Redirects'
28+
},
29+
about: {
30+
icon: <InfoCircleOutlined />,
31+
title: 'About'
2232
}
2333
};
2434

next.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const pkg = require('./package.json');
2+
3+
// starts a command line process to get the git hash
4+
const commitHash = require('child_process').execSync('git rev-parse HEAD').toString().trim();
5+
6+
module.exports = {
7+
env: {
8+
APP_NAME: pkg.name,
9+
APP_DESCRIPTION: pkg.description,
10+
APP_VERSION: pkg.version,
11+
APP_LICENSE: pkg.license,
12+
HOMEPAGE: pkg.homepage,
13+
BUG_TRACKER: pkg.bugs,
14+
REPOSITORY_URL: pkg.repository.url,
15+
COMMIT_HASH: commitHash
16+
}
17+
};

0 commit comments

Comments
 (0)