feat: show app version and build date in WelcomeModal

master
Katja Lutz 2 years ago
parent 0e22772b25
commit 58ff9f2f58

@ -1,5 +1,6 @@
{ {
"name": "rappli", "name": "rappli",
"version": "0.0.1",
"bin": "./bin/rappli.js", "bin": "./bin/rappli.js",
"scripts": { "scripts": {
"dev": "solid-start dev", "dev": "solid-start dev",

@ -15,7 +15,7 @@ import { LocalStoreContext } from "~/stores";
import createAccordion from "./Accordion"; import createAccordion from "./Accordion";
import typer from "typer-js"; import typer from "typer-js";
import "typer-js/dist/typer.min.css"; import "typer-js/dist/typer.min.css";
import { shuffle } from "~/util"; import { getDisplayDate, shuffle } from "~/util";
const WelcomeModal: Component = (props) => { const WelcomeModal: Component = (props) => {
const [localState, setLocalState, localStateMounted] = const [localState, setLocalState, localStateMounted] =
@ -317,6 +317,10 @@ const WelcomeModal: Component = (props) => {
<LaunchIcon /> <LaunchIcon />
Loslegen Loslegen
</button> </button>
<div class="absolute -bottom-12 -right-12 text-xs text-black opacity-60 flex gap-3">
<span>Version: {__APP_VERSION__}</span>
<span>{getDisplayDate(new Date(__BUILD_TIME__))}</span>
</div>
</div> </div>
</Modal> </Modal>
); );

2
src/index.d.ts vendored

@ -0,0 +1,2 @@
declare const __APP_VERSION__: string;
declare const __BUILD_TIME__: number;

@ -17,9 +17,9 @@ export const roundToStep = (value: number, step = 1.0) => {
return inv.mul(value).round().div(inv).toNumber(); return inv.mul(value).round().div(inv).toNumber();
}; };
export const getDisplayDateFromUnix = function (unix: number) { export const getDisplayDate = function (date: Date) {
return intlFormat( return intlFormat(
fromUnixTime(unix), date,
{ {
day: "2-digit", day: "2-digit",
month: "2-digit", month: "2-digit",
@ -31,6 +31,10 @@ export const getDisplayDateFromUnix = function (unix: number) {
); );
}; };
export const getDisplayDateFromUnix = function (unix: number) {
return getDisplayDate(fromUnixTime(unix));
};
export const resetInput = export const resetInput =
(defaultValue: any, eventName = "input") => (defaultValue: any, eventName = "input") =>
(evt: FocusEvent) => { (evt: FocusEvent) => {

@ -20,6 +20,10 @@ const cleanSvg = (svgString: string) => {
}; };
export default defineConfig({ export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
__BUILD_TIME__: JSON.stringify(new Date().getTime()),
},
plugins: [ plugins: [
Icons({ Icons({
compiler: "solid", compiler: "solid",

Loading…
Cancel
Save