Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
FROM node:24-alpine AS build-frontend

ARG NG_CONFIGURATION=production
ARG VERSION

WORKDIR /app/frontend

Expand All @@ -12,6 +13,7 @@ RUN npm ci

# build
COPY ./frontend .
ENV VERSION=$VERSION
RUN npm run build


Expand Down
3 changes: 3 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
}
],
"scripts": [],
"define": {
"APP_VERSION": "'DEV'"
},
"browser": "src/main.ts",
"stylePreprocessorOptions": {
"includePaths": ["."]
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Bošán",
"private": true,
"scripts": {
"build": "ng build --configuration production",
"build": "ng build --configuration production --define APP_VERSION=\"'${VERSION:-DEV}'\"",
"dev": "ng serve",
"dev:test-server": "ng serve --configuration=test-server",
"generate:sdk": "openapi-sdk -i http://127.0.0.1:3000/api/openapi-json -o src/sdk"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p class="version">
<a (click)="openChangelog()" class="clickable">Verze {{ version() }}</a>
<a (click)="openChangelog()" class="clickable">Verze {{ version }}</a>
</p>

@if (updateAvailable()) {
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/shared/components/version/version.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, signal } from "@angular/core";
import { takeUntilDestroyed, toSignal } from "@angular/core/rxjs-interop";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { SwUpdate } from "@angular/service-worker";
import { IonSpinner } from "@ionic/angular/standalone";
import { filter, map } from "rxjs";
import { ApiService } from "src/app/core/services/api.service";
import { filter } from "rxjs";
import { ModalService } from "src/app/core/services/modal.service";
import { ChangelogModalComponent } from "src/app/shared/components/changelog-modal/changelog-modal.component";
import { Config } from "src/config";
import { Logger } from "src/logger";

@Component({
Expand All @@ -17,14 +17,14 @@ import { Logger } from "src/logger";
export class VersionComponent {
private readonly logger = new Logger("VersionComponent");

version = toSignal(this.api.info.pipe(map((info) => info.version.replace(/^v(?=\d)/, ""))));
version = this.config.version.replace(/^v(?=\d)/, "");
updateAvailable = signal(false);
updating = signal(false);

private updateCheck?: Promise<boolean>;

constructor(
private readonly api: ApiService,
private readonly config: Config,
private readonly swUpdate: SwUpdate,
private readonly modal: ModalService,
) {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export class Config {
production = true;

version = APP_VERSION;

apiRoot = "/";

jwtDomains = ["bosan.cz"];
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ declare var module: NodeModule;
interface NodeModule {
id: string;
}

declare const APP_VERSION: string;
Loading