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
14 changes: 9 additions & 5 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ on:
- main
- 'feature/**'
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: main

jobs:
deploy:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.ref_name }}

BRANCH_NAME: ${{ github.event.inputs.branch || github.head_ref || github.ref_name }}
steps:
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.7.0
Expand All @@ -26,8 +30,8 @@ jobs:

- name: Deploy ${{ env.BRANCH_NAME }} to test server
run: |
echo "➡️ Starting remote deployment of branch '${BRANCH_NAME}'"
echo "➡️ Starting remote deployment of branch $BRANCH_NAME"
ssh -o StrictHostKeyChecking=no \
${{ secrets.TEST_SERVER_USER }}@${{ secrets.TEST_SERVER_HOST }} \
"bash ~/deploy_recapp_to_test.sh \"${BRANCH_NAME}\""
echo "✅ Remote deployment of branch '${BRANCH_NAME}' succeeded"
"export BRANCH_NAME='${BRANCH_NAME}'; bash ~/deploy_recapp_to_test.sh '${BRANCH_NAME}'"
echo "✅ Remote deployment of branch $BRANCH_NAME succeeded"
25 changes: 24 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# recapp 1.6.2
## [Release] Merge main into production – 2025-06-11

We have deployed a new version to production! This release merges the latest changes from the `main` branch, bringing new features, improvements, and bug fixes.

### Highlights

- **Deployment & Workflow**
- New workflow for deploying to the test server: `.github/workflows/deploy-test.yml`
- Old deployment check workflow removed: `.github/workflows/deploy-check.yml`
- Major refactor of `deployment.sh` for easier log management and improved robustness

- **Backend**
- Backend Dockerfile now uses `node:20-slim` (was `node:20-alpine`)
- Added `wkhtmltopdf` and related font support to backend Docker image
- Backend version bumped to 1.0.1

- **Frontend**
- Improved token refresh and handling in `TokenActor.ts` for more reliable authentication
- Modernized app root handling and user experience (`Root.tsx`): better error handling and loading screen
- Only enable question stats in quiz tab if details are available
- Frontend version bumped to 1.6.3

---

For a complete list of changes, see the [commit history between `main` and `production`](https://github.com/ecomod-code/recapp/pull/93).
14 changes: 13 additions & 1 deletion packages/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
FROM node:20-alpine
FROM node:20-slim

# Install wkhtmltopdf + minimal deps, then clean up apt caches
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
wkhtmltopdf \
fontconfig \
fonts-dejavu-core \
ca-certificates \
libx11-6 \
libxrender1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
"start": "ts-node ./src/index.ts",
"test": "npm test"
},
"version": "1.0.0"
"version": "1.0.1"
}
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@recapp/frontend",
"private": true,
"version": "1.6.2",
"version": "1.6.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
145 changes: 94 additions & 51 deletions packages/frontend/src/components/navigation/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,105 @@
// src/components/navigation/Root.tsx

import React, { useEffect, useState } from "react";
import { Outlet, useNavigate } from "react-router-dom";
import { useEffect, useState } from "react";
import { i18n } from "@lingui/core";
import { Trans } from "@lingui/react";
import { Layout } from "../../layout/Layout";
import { SystemContext } from "ts-actors-react";

import { Button, Modal } from "react-bootstrap";
import { Button, Modal, Spinner } from "react-bootstrap";
import { cookie } from "../../utils";
import { system } from "../../system";
import { ActorSystem } from "ts-actors";
import { Try, fromError, fromValue } from "tsmonads";

export const Root = () => {
const [init, setInit] = useState<Try<ActorSystem>>(fromError(new Error()));
const [rpcError, setRpcError] = useState<string>("");

const navigate = useNavigate();
const onRpcError = () => {
setRpcError("");
document.location.href = `${import.meta.env.VITE_BACKEND_URI}/auth/logout`;
};

useEffect(() => {
const run = async () => {
try {
const s: ActorSystem = await system;
setInit(fromValue(s));
} catch (e) {
setInit(fromError(e as Error));
}
};
run();
}, []);

if (rpcError !== "") {
return (
<Modal show={true}>
<Modal.Title className="ps-2 bg-warning">{i18n._(rpcError + "-title")}</Modal.Title>
<Modal.Body>
<Trans id={rpcError} />
</Modal.Body>
<Modal.Footer className="p-0">
<Button onClick={onRpcError}>Neu anmelden</Button>
</Modal.Footer>
</Modal>
);
}
if (!init) {
return null;
}
if (!cookie("bearer")) {
navigate("/", { replace: true });
}
return (
<SystemContext.Provider value={init}>
<Layout>
<Outlet />
</Layout>
</SystemContext.Provider>
);
export const Root: React.FC = () => {
// 1) Keep the monadic Try<ActorSystem> so it matches your context type
const [init, setInit] = useState<Try<ActorSystem>>(fromError(new Error()));
const [rpcError, setRpcError] = useState<string>("");
const navigate = useNavigate();

const onRpcError = () => {
setRpcError("");
document.location.href = `${import.meta.env.VITE_BACKEND_URI}/auth/logout`;
};

// 2) Bootstrap the actor system just once
useEffect(() => {
system
.then(s => setInit(fromValue(s)))
.catch(err => setInit(fromError(err)));
}, []);

// 3) After a successful init, check for the bearer cookie and redirect if missing
useEffect(() => {
init.match(
// onSuccess
() => {
if (!cookie("bearer")) {
navigate("/", { replace: true });
}
},
// onFailure
() => {
/* do nothing on failure; modal handle below */
}
);
}, [init, navigate]);

// 4) If we hit an RPC error, show the modal
if (rpcError) {
return (
<Modal show onHide={() => setRpcError("")}>
<Modal.Header closeButton>
<Modal.Title>
<Trans id="communication.error" message="Communication Error" />
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Trans
id="communication.problem"
message="There was a problem communicating with the backend."
/>
<br />
<Trans
id="communication.retry"
message="Please try again or contact support."
/>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={onRpcError}>
<Trans id="communication.logout" message="Log Out" />
</Button>
</Modal.Footer>
</Modal>
);
}

// 5) While initializing, show a centered spinner
const ready = init.match(() => true, () => false);
if (!ready) {
return (
<div style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "100vh"
}}>
<Spinner animation="border" role="status">
<span className="visually-hidden">
<Trans id="loading" message="Loading..." />
</span>
</Spinner>
</div>
);
}

// 6) Everything’s good: render your app
return (
<SystemContext.Provider value={init}>
<Layout>
<Outlet />
</Layout>
</SystemContext.Provider>
);
};
4 changes: 2 additions & 2 deletions packages/frontend/src/components/quiz-tabs/QuizStatsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ export const QuizStatsTab: React.FC<{ quizData: CurrentQuizState }> = ({ quizDat
textUnderlineOffset: "3px",
// color: $primary
}}
onClick={() =>
tryActor.forEach(actor =>
// Only activate question stats if there are details available
onClick={() => noDetails ? null : tryActor.forEach(actor =>
actor.send(
actor,
CurrentQuizMessages.ActivateQuestionStats(
Expand Down