Skip to content

Commit

Permalink
Display version; print version and documentation URL
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueWill committed Dec 25, 2018
1 parent 9f182cf commit 4d68084
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Currently deployment is manual, so the site may not reflect the latest changes.

* Improve styling/responsiveness
* Print options (A4 size, etc.)
* Display version
* Improve test coverage
* Rituals
* Techniques (clear if change Generation)
Expand Down
6 changes: 5 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { version } from '../constants/application';
import {
skillTraitNames,
skillTraitDisplayNameOverride,
Expand All @@ -24,7 +25,10 @@ import styles from './App.module.css';

const App = () => (
<div className="container-fluid">
<h1>Embracer</h1>
<h1>
Embracer
<span className={styles.version}> v{version}</span>
</h1>
<ExportDocumentContainer />
<SettingContainer />
<Section header="Character">
Expand Down
4 changes: 4 additions & 0 deletions src/components/App.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.attribution {
font-size: x-small;
}

.version {
font-size: small;
}
3 changes: 3 additions & 0 deletions src/constants/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// General application constants.
export const version = '0.9.0';
export const docUrl = 'https://github.com/TrueWill/embracer';
9 changes: 9 additions & 0 deletions src/utils/exportPdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { capitalizeFirstLetter } from './stringUtils';
import * as simple from '../selectors/simple';
import getGenerationDetails from '../selectors/getGenerationDetails';
import getXP from '../selectors/getXP';
import { version, docUrl } from '../constants/application';
import {
attributeTraitNames,
attributeMaxDots,
Expand All @@ -20,6 +21,7 @@ import {
// Units are mm
const sizeUSLetter = [279.4, 215.9];
const pageWidth = sizeUSLetter[1];
const pageHeight = sizeUSLetter[0];
const topMargin = 20;
const leftMargin = 15;
const columnWidth = 55;
Expand Down Expand Up @@ -433,6 +435,12 @@ const printStatus = doc => {
printColumnHeaderLine(doc, 'Status', column3XPosition);
};

const printFooter = doc => {
currentYPosition = pageHeight - topMargin + 10;

print(doc, `Created by Embracer v${version} ${docUrl}`, column1XPosition);
};

const exportPdf = state => {
const doc = new jsPDF({
unit: 'mm',
Expand Down Expand Up @@ -465,6 +473,7 @@ const exportPdf = state => {
printXP(doc, state);
printBeastTraits(doc);
printStatus(doc);
printFooter(doc);

// Downloads
doc.save('character.pdf');
Expand Down

0 comments on commit 4d68084

Please sign in to comment.