diff --git a/Dockerfile b/Dockerfile index da30611..a099382 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,16 @@ RUN npm ci RUN node -e "require('@rolldown/binding-linux-x64-gnu')" \ || (rm -rf node_modules package-lock.json && npm install) COPY web/ ./ +# The UI carries a small Ko-fi donation button (see web/src/App.tsx). +# `--build-arg DONATE_URL=` (empty) drops it, any other value points it +# elsewhere; left alone, the project default is used. The "keep" sentinel +# exists because an unset build arg and an empty one are indistinguishable +# inside RUN - without it, "not passed" would silently mean "remove". +ARG DONATE_URL=keep # tsc -b currently fails on pre-existing type errors unrelated to this build; # vite build alone is enough to produce the production bundle. -RUN npx vite build +RUN if [ "$DONATE_URL" = "keep" ]; then npx vite build; \ + else VITE_DONATE_URL="$DONATE_URL" npx vite build; fi # --- Gateway ---------------------------------------------------------------- FROM node:22-bookworm-slim AS gateway-builder diff --git a/README.md b/README.md index 2a350fd..f9c0ae7 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,8 @@ Prefer to skip the build entirely? A prebuilt image is published on [Docker Hub] docker run -d -p 8080:8080 --name webspeak3 moepchi/webspeak3:latest ``` +The UI shows a small **Ko-fi donation button** in the bottom right corner. Building it yourself and would rather not carry someone else's donation link? `docker compose build --build-arg DONATE_URL=` removes it (any other value points it somewhere else). Outside Docker the same thing is a build-time variable: `VITE_DONATE_URL= npm run build` in `web/`. +
🛠️ Manual installation (without Docker) diff --git a/web/src/App.css b/web/src/App.css index 3c69822..eac1ec1 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -3739,6 +3739,47 @@ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); } +/* Spenden-Pille. Bewusst nicht in den Theme-Farben: sie soll auffallen, ohne + gross zu sein - Ko-fi-Rot, feste Hoehe, Text nur als Beiwerk zum Symbol. */ +.ts-donate-fab { + position: fixed; + right: 1.25rem; + bottom: 5.5rem; + z-index: 500; + display: inline-flex; + align-items: center; + gap: 0.4rem; + height: 2.25rem; + padding: 0 0.85rem; + border-radius: 999px; + border: 1px solid rgba(255, 255, 255, 0.18); + background: #ff5e5b; + color: #fff; + font-size: 12px; + font-weight: 600; + letter-spacing: 0.01em; + text-decoration: none; + white-space: nowrap; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); + transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease; +} + +/* Ueber dem Feedback-Button (3rem hoch, bottom: 5.5rem) statt darauf. */ +.ts-donate-fab-stacked { + bottom: 9.25rem; +} + +.ts-donate-fab:hover { + background: #ff4b47; + transform: scale(1.06); + box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); +} + +.ts-donate-fab-icon { + font-size: 14px; + line-height: 1; +} + .ts-feedback-bubble { position: relative; max-width: 13rem; diff --git a/web/src/App.tsx b/web/src/App.tsx index c808954..6aa6033 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -96,6 +96,13 @@ const FEEDBACK_URL = import.meta.env.DEV ? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "").replace(/^ws(s?):\/\//, "http$1://")}/api/feedback` : `${window.location.protocol}//${window.location.host}/api/feedback`; +// Ko-fi page of the project (.github/FUNDING.yml). Unlike the feedback button +// below this is not limited to the maintainer's own instance: it ships in +// every build, the Docker image included. Self-hosters who would rather not +// carry someone else's donation link can build with VITE_DONATE_URL= (empty) +// to drop the button, or point it somewhere else. +const DONATE_URL = import.meta.env.VITE_DONATE_URL ?? "https://ko-fi.com/moepchi"; + // This file's frontend is deployed as multiple Cloudflare Pages projects // from the same repo/build (see mem:deployment) - only the maintainer's own // production instance talks to a gateway they actually operate and read @@ -2111,6 +2118,27 @@ function FeedbackFab({ onOpen }: { onOpen: () => void }) { ); } +/** + * Small donation pill, pinned above the feedback button (or in its place where + * that one is not shown - see `stacked`). + */ +function DonateFab({ stacked }: { stacked: boolean }) { + const t = useT(); + if (!DONATE_URL) return null; + return ( + + + {t("donate.label")} + + ); +} + type FeedbackCategory = "bug" | "idea" | "other"; function FeedbackDialog({ onClose }: { onClose: () => void }) { @@ -9328,6 +9356,11 @@ function AppInner() { setFeedbackOpen(true)} /> )} + {/* Sits above the feedback button where that exists, and takes its spot + where it does not - the offset follows the instance, not the dialog, + so opening feedback does not make the pill jump. */} + + {feedbackOpen && setFeedbackOpen(false)} />} {favoritesDialogMode && ( diff --git a/web/src/i18n.tsx b/web/src/i18n.tsx index bcd326a..2b4a7bd 100644 --- a/web/src/i18n.tsx +++ b/web/src/i18n.tsx @@ -48,6 +48,9 @@ const translations: Record> = { "menu.extras.feedback": "Feedback geben", "feedback.fab.nudge": "Was denkst du über WebSpeak3? Feedback ist willkommen!", + "donate.label": "Spenden", + "donate.title": "WebSpeak3 auf Ko-fi unterstützen", + "pwa.updateAvailable": "Neue Version verfügbar", "pwa.reload": "Neu laden", @@ -686,6 +689,9 @@ const translations: Record> = { "menu.extras.feedback": "Send Feedback", "feedback.fab.nudge": "What do you think of WebSpeak3? Feedback welcome!", + "donate.label": "Donate", + "donate.title": "Support WebSpeak3 on Ko-fi", + "pwa.updateAvailable": "New version available", "pwa.reload": "Reload",