mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-04 05:20:01 +00:00

* App as functional component * Add Main component WIP * Add Maker and Book page to new main.tsx * Add old UserGen and BottomBar to new main.tsx * Small fixes * Try out to revert depth chart * Small fixes (more)
26 lines
902 B
TypeScript
26 lines
902 B
TypeScript
import packageJson from '../../package.json';
|
|
|
|
// Gets SemVer from backend /api/info and compares to local imported frontend version "localVer". Uses major,minor,patch.
|
|
// If minor of backend > minor of frontend, updateAvailable = true.
|
|
export const checkVer: (
|
|
major: number | null,
|
|
minor: number | null,
|
|
patch: number | null,
|
|
) => object = (major, minor, patch) => {
|
|
if (major === null || minor === null || patch === null) {
|
|
return { updateAvailable: null };
|
|
}
|
|
const semver = packageJson.version.split('.');
|
|
const updateAvailable: boolean = major > Number(semver[0]) || minor > Number(semver[1]);
|
|
const patchAvailable: boolean = !updateAvailable && patch > Number(semver[2]);
|
|
|
|
return {
|
|
updateAvailable,
|
|
patchAvailable,
|
|
coordinatorVersion: `v${major}.${minor}.${patch}`,
|
|
clientVersion: `v${semver[0]}.${semver[1]}.${semver[2]}`,
|
|
};
|
|
};
|
|
|
|
export default checkVer;
|