1
0
Fork 0

Change from "Build" to "Version"

Also make version string copy-able
This commit is contained in:
Lim Chee Aun 2023-10-23 08:43:27 +08:00
parent 8d694ecf1b
commit 72842c663a
2 changed files with 40 additions and 15 deletions

View file

@ -140,3 +140,10 @@
color: var(--link-color);
vertical-align: middle;
}
#settings-container .version-string {
padding: 4px;
font-family: var(--monospace-font);
font-size: 85%;
text-align: center;
}

View file

@ -18,6 +18,7 @@ import {
removeSubscription,
updateSubscription,
} from '../utils/push-notifications';
import showToast from '../utils/show-toast';
import states from '../utils/states';
import store from '../utils/store';
@ -508,21 +509,38 @@ function Settings({ onClose }) {
</p>
{__BUILD_TIME__ && (
<p>
<span class="insignificant">Last build:</span>{' '}
<RelativeTime datetime={new Date(__BUILD_TIME__)} />{' '}
{__COMMIT_HASH__ && (
<>
(
<a
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
target="_blank"
rel="noopener noreferrer"
>
<code>{__COMMIT_HASH__}</code>
</a>
)
</>
)}
Version:{' '}
<input
type="text"
class="version-string"
readOnly
size="18" // Manually calculated here
value={`${__BUILD_TIME__.slice(0, 10).replace(/-/g, '.')}${
__COMMIT_HASH__ ? `.${__COMMIT_HASH__}` : ''
}`}
onClick={(e) => {
e.target.select();
// Copy to clipboard
try {
navigator.clipboard.writeText(e.target.value);
showToast('Version string copied');
} catch (e) {
console.warn(e);
showToast('Unable to copy version string');
}
}}
/>{' '}
<span class="ib insignificant">
(
<a
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
target="_blank"
rel="noopener noreferrer"
>
<RelativeTime datetime={new Date(__BUILD_TIME__)} />
</a>
)
</span>
</p>
)}
</section>