move about and report pages into jsx and implement translation

This commit is contained in:
Emily Soth 2023-02-01 11:39:23 -08:00
parent 37f8e5a31a
commit 824d2729bd
6 changed files with 256 additions and 208 deletions

View File

@ -11,134 +11,8 @@
/>
</head>
<body>
<div id="header">
<img
src="/src/renderer/static/invest-logo.png"
width=191
height=167
/>
<div id='invest-version'>
<p>version:</p>
<span id='version-string'></span>
</div>
<p id='invest-copyright'>
Copyright 2022, The Natural Capital Project
</p>
</div>
<br/>
<div id="links">
<p>Documentation:
<a
href="http://releases.naturalcapitalproject.org/invest-userguide/latest/"
>
http://releases.naturalcapitalproject.org/invest-userguide/latest/
</a>
</p>
<p>Homepage:
<a
href="https://naturalcapitalproject.stanford.edu/"
>
https://naturalcapitalproject.stanford.edu/
</a>
</p>
<p>Project page:
<a
href="https://github.com/natcap/invest"
>
https://github.com/natcap/invest
</a>
</p>
<p>License:
<a
href="https://github.com/natcap/invest/blob/master/LICENSE.txt"
>
BSD 3-clause
</a>
</p>
</div>
<div id="licenses">
<h4>Open-Source Licenses:</h4>
<table>
<tr>
<td>PyInstaller</td>
<td>GPL</td>
<td>
<a
href='http://pyinstaller.org'
>
http://pyinstaller.org
</a>
</td>
</tr>
<tr>
<td>GDAL</td>
<td>MIT and others</td>
<td>
<a
href='http://gdal.org'
>
http://gdal.org
</a>
</td>
</tr>
<tr>
<td>numpy</td>
<td>BSD</td>
<td>
<a
href='http://numpy.org'
>
http://numpy.org
</a>
</td>
</tr>
<tr>
<td>pygeoprocessing</td>
<td>BSD</td>
<td>
<a
href='https://github.com/natcap/pygeoprocessing'
>
https://github.com/natcap/pygeoprocessing
</a>
</td>
</tr>
<tr>
<td>rtree</td>
<td>MIT</td>
<td>
<a
href='https://github.com/Toblerity/rtree'
>
https://github.com/Toblerity/rtree
</a>
</td>
</tr>
<tr>
<td>scipy</td>
<td>BSD</td>
<td>
<a
href='http://www.scipy.org/'
>
http://www.scipy.org/
</a>
</td>
</tr>
<tr>
<td>shapely</td>
<td>BSD</td>
<td>
<a
href='http://github.com/Toblerity/Shapely'
>
http://github.com/Toblerity/Shapely
</a>
</td>
</tr>
</table>
</div>
<div id="content" />
</body>
<script src="/src/renderer/menubar/about.js" type="module">
</script>
<script src="/src/renderer/menubar/about.jsx" type="module">
</script>
</html>

View File

@ -11,55 +11,8 @@
/>
</head>
<body>
<p id="header">
Please help us by reporting problems.
</p>
<p>
<b>If the problem is related to a specific InVEST model,</b>
please see the guidelines here for reporting problems:
<a
href="https://community.naturalcapitalproject.org/t/guidelines-for-posting-software-support-questions/24"
>
Guidelines for posting software support questions
</a>
</p>
<p>
<b>If the problem is related to this User Interface,</b>
rather than with a specific InVEST model,
<ol>
<li>Consider taking a screenshot of the problem.</li>
<li>
Find the log files using the button below.
There may be multiple files with a ".log" extension;
please include them all.
<button type="button">
Find My Logs
</button>
</li>
<li>
Create a post on our forum and upload these items, along with a
brief description of the problem.
<a
href="https://community.naturalcapitalproject.org/"
>
https://community.naturalcapitalproject.org
</a>
</li>
</ol>
</p>
<div id="footer">
<img
src="/src/renderer/static/invest-logo.png"
width=143
height=125
/>
<img
src="/src/renderer/static/NatCapLogo.jpg"
width=143
height=125
/>
</div>
<div id="content" />
</body>
<script src="/src/renderer/menubar/report.js" type="module">
<script src="/src/renderer/menubar/report.jsx" type="module" >
</script>
</html>

View File

@ -1,19 +0,0 @@
import { ipcMainChannels } from '../../main/ipcMainChannels';
import { handleClickExternalURL } from './handlers';
const { ipcRenderer } = window.Workbench.electron;
async function getInvestVersion() {
const investVersion = await ipcRenderer.invoke(ipcMainChannels.INVEST_VERSION);
return investVersion;
}
document.querySelectorAll('a').forEach(
(element) => {
element.addEventListener('click', handleClickExternalURL);
}
);
const node = document.getElementById('version-string');
const investVersion = await getInvestVersion();
const text = document.createTextNode(investVersion);
node.appendChild(text);

View File

@ -0,0 +1,170 @@
import React from 'react';
import ReactDom from 'react-dom';
import i18n from '../../shared/i18n';
import { Translation } from 'react-i18next';
import { handleClickExternalURL } from './handlers';
import { getSettingsValue } from '../components/SettingsModal/SettingsStorage';
import { ipcMainChannels } from '../../main/ipcMainChannels';
const { ipcRenderer } = window.Workbench.electron;
async function getInvestVersion() {
const investVersion = await ipcRenderer.invoke(ipcMainChannels.INVEST_VERSION);
return investVersion;
}
await getSettingsValue('language')
.then((ll) => i18n.changeLanguage(ll))
.then(() => getInvestVersion())
.then((investVersion) => {
ReactDom.render(
<Translation>
{(t, { i18n }) => (
<React.Fragment>
<div id="header">
<img
src="/src/renderer/static/invest-logo.png"
width="191"
height="167"
/>
<div id='invest-version'>
<p>{t('version:')}</p>
<span id='version-string'></span>
</div>
<p id='invest-copyright'>
{t('Copyright 2022, The Natural Capital Project')}
</p>
</div>
<br/>
<div id="links">
<p>{t('Documentation: ')}
<a
href="http://releases.naturalcapitalproject.org/invest-userguide/latest/"
>
http://releases.naturalcapitalproject.org/invest-userguide/latest/
</a>
</p>
<p>{t('Homepage: ')}
<a
href="https://naturalcapitalproject.stanford.edu/"
>
https://naturalcapitalproject.stanford.edu/
</a>
</p>
<p>{t('Project page: ')}
<a
href="https://github.com/natcap/invest"
>
https://github.com/natcap/invest
</a>
</p>
<p>{t('License: ')}
<a
href="https://github.com/natcap/invest/blob/master/LICENSE.txt"
>
BSD 3-clause
</a>
</p>
</div>
<div id="licenses">
<h4>{t('Open-Source Licenses:')}</h4>
<table>
<tbody>
<tr>
<td>PyInstaller</td>
<td>GPL</td>
<td>
<a
href='http://pyinstaller.org'
>
http://pyinstaller.org
</a>
</td>
</tr>
<tr>
<td>GDAL</td>
<td>{t('MIT and others')}</td>
<td>
<a
href='http://gdal.org'
>
http://gdal.org
</a>
</td>
</tr>
<tr>
<td>numpy</td>
<td>BSD</td>
<td>
<a
href='http://numpy.org'
>
http://numpy.org
</a>
</td>
</tr>
<tr>
<td>pygeoprocessing</td>
<td>BSD</td>
<td>
<a
href='https://github.com/natcap/pygeoprocessing'
>
https://github.com/natcap/pygeoprocessing
</a>
</td>
</tr>
<tr>
<td>rtree</td>
<td>MIT</td>
<td>
<a
href='https://github.com/Toblerity/rtree'
>
https://github.com/Toblerity/rtree
</a>
</td>
</tr>
<tr>
<td>scipy</td>
<td>BSD</td>
<td>
<a
href='http://www.scipy.org/'
>
http://www.scipy.org/
</a>
</td>
</tr>
<tr>
<td>shapely</td>
<td>BSD</td>
<td>
<a
href='http://github.com/Toblerity/Shapely'
>
http://github.com/Toblerity/Shapely
</a>
</td>
</tr>
</tbody>
</table>
</div>
</React.Fragment>
)}
</Translation>,
document.getElementById('content')
);
document.querySelectorAll('a').forEach(
(element) => {
element.addEventListener('click', handleClickExternalURL);
}
);
const node = document.getElementById('version-string');
const text = document.createTextNode(investVersion);
node.appendChild(text);
}
);

View File

@ -1,11 +0,0 @@
import {
handleClickExternalURL,
handleClickFindLogfiles
} from './handlers';
document.querySelector('button').addEventListener('click', handleClickFindLogfiles);
document.querySelectorAll('a').forEach(
(element) => {
element.addEventListener('click', handleClickExternalURL);
}
);

View File

@ -0,0 +1,81 @@
import React from 'react';
import ReactDom from 'react-dom';
import i18n from '../../shared/i18n';
import { Translation } from 'react-i18next';
import {
handleClickExternalURL,
handleClickFindLogfiles
} from './handlers';
import { getSettingsValue } from '../components/SettingsModal/SettingsStorage';
await getSettingsValue('language')
.then((ll) => i18n.changeLanguage(ll))
.then(() => {
ReactDom.render(
<Translation>
{(t, { i18n }) => (
<React.Fragment>
<p id="header">
{t('Please help us by reporting problems.')}
</p>
<p>
<b>{t('If the problem is related to a specific InVEST model, ')}</b>
{t('please see the guidelines here for reporting problems: ')}
<a
href="https://community.naturalcapitalproject.org/t/guidelines-for-posting-software-support-questions/24"
>
{t('Guidelines for posting software support questions')}
</a>
</p>
<p>
<b>{t('If the problem is related to this User Interface, ')}</b>
{t('rather than with a specific InVEST model,')}
<ol>
<li>{t('Consider taking a screenshot of the problem.')}</li>
<li>
{t('Find the log files using the button below. ' +
'There may be multiple files with a ".log" extension; ' +
'please include them all.')}
<button type="button">
{t('Find My Logs')}
</button>
</li>
<li>
{t('Create a post on our forum and upload these items, along ' +
'with a brief description of the problem.')}
<a
href="https://community.naturalcapitalproject.org/"
>
https://community.naturalcapitalproject.org
</a>
</li>
</ol>
</p>
<div id="footer">
<img
src="/src/renderer/static/invest-logo.png"
width="143"
height="125"
/>
<img
src="/src/renderer/static/NatCapLogo.jpg"
width="143"
height="125"
/>
</div>
</React.Fragment>
)}
</Translation>,
document.getElementById('content')
);
document.querySelector('button').addEventListener('click', handleClickFindLogfiles);
document.querySelectorAll('a').forEach(
(element) => {
element.addEventListener('click', handleClickExternalURL);
}
);
}
);