Telegram: factory alert switch and night mode
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
738b39584d
commit
9913a202ec
7 files changed
+169
-7
No files matched your search
@@ -12,6 +12,12 @@ interface Status {
|
||||
pair_code: string;
|
||||
running: boolean;
|
||||
error?: string | null;
|
||||
factory_alerts: boolean;
|
||||
quiet: boolean;
|
||||
quiet_from: string;
|
||||
quiet_to: string;
|
||||
quiet_now: boolean;
|
||||
server_time: string;
|
||||
}
|
||||
|
||||
/** Connect a personal Telegram bot as a chat interface. */
|
||||
@@ -33,6 +39,14 @@ export function Telegram() {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
const savePrefs = async (patch: Partial<Pick<Status, "factory_alerts" | "quiet" | "quiet_from" | "quiet_to">>) => {
|
||||
try {
|
||||
await put("/account/telegram/prefs", patch);
|
||||
reload();
|
||||
} catch (e) {
|
||||
toast(e);
|
||||
}
|
||||
};
|
||||
const disconnect = async () => {
|
||||
if (!(await confirmDialog({ message: t("telegram.disconnectConfirm"), danger: true, confirmLabel: t("telegram.disconnect") }))) return;
|
||||
await del("/account/telegram").catch((e) => toast(e));
|
||||
@@ -97,6 +111,22 @@ export function Telegram() {
|
||||
)}
|
||||
{data.error && <div className="notice err" style={{ marginTop: 10 }}>{data.error}</div>}
|
||||
{data.paired && <div className="hint" style={{ marginTop: 10 }}>{t("telegram.commands")}</div>}
|
||||
<h4 style={{ margin: "16px 0 6px" }}>{t("telegram.notify")}</h4>
|
||||
<label className="row" style={{ gap: 8, alignItems: "center" }}>
|
||||
<input type="checkbox" checked={data.factory_alerts} onChange={(e) => void savePrefs({ factory_alerts: e.target.checked })} />
|
||||
<span>{t("telegram.factoryAlerts")}</span>
|
||||
</label>
|
||||
<label className="row" style={{ gap: 8, alignItems: "center", marginTop: 6 }}>
|
||||
<input type="checkbox" checked={data.quiet} onChange={(e) => void savePrefs({ quiet: e.target.checked })} />
|
||||
<span>{t("telegram.quiet")}</span>
|
||||
</label>
|
||||
<div className="row" style={{ gap: 8, alignItems: "center", marginTop: 6, marginLeft: 24, flexWrap: "wrap", opacity: data.quiet ? 1 : 0.5 }}>
|
||||
<input type="time" value={data.quiet_from} disabled={!data.quiet} onChange={(e) => e.target.value && void savePrefs({ quiet_from: e.target.value })} />
|
||||
<span>–</span>
|
||||
<input type="time" value={data.quiet_to} disabled={!data.quiet} onChange={(e) => e.target.value && void savePrefs({ quiet_to: e.target.value })} />
|
||||
<span className="hint">{t("telegram.serverTime", { time: data.server_time })}{data.quiet_now ? ` · ${t("telegram.quietNow")}` : ""}</span>
|
||||
</div>
|
||||
<div className="hint" style={{ marginTop: 6 }}>{t("telegram.quietHint")}</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -539,6 +539,12 @@ export const de: Messages = {
|
||||
"telegram.intro": "CodeCraft über Telegram mit deinem eigenen Bot nutzen: Nachrichten gehen an deine aktuelle Sitzung, Befehle wechseln Sitzungen, Modi und Modelle, Freigaben und Rückfragen kommen mit Knöpfen. Nur dein Telegram-Konto kann den Bot nutzen.",
|
||||
"telegram.step1": "In Telegram @BotFather öffnen, /newbot senden und den Schritten folgen.",
|
||||
"telegram.step2": "Das Token von BotFather hier einfügen.",
|
||||
"telegram.notify": "Benachrichtigungen",
|
||||
"telegram.factoryAlerts": "Factory: Nachricht, wenn ein Issue eine Frage hat oder fehlschlägt",
|
||||
"telegram.quiet": "Nachtmodus: keine ungefragten Nachrichten",
|
||||
"telegram.serverTime": "Serverzeit {time}",
|
||||
"telegram.quietNow": "gerade ruhig",
|
||||
"telegram.quietHint": "Im Nachtmodus wird nichts von sich aus gesendet: keine Factory-Meldungen, keine Freigaben oder Fragen aus anderen Chats. Der Chat, in dem du gerade per Telegram schreibst, antwortet weiter. Zurückgehaltene Nachrichten werden nicht nachgeholt – sie bleiben in der Weboberfläche sichtbar.",
|
||||
"telegram.connect": "Verbinden",
|
||||
"telegram.checking": "Prüfe…",
|
||||
"telegram.running": "läuft",
|
||||
|
||||
@@ -538,6 +538,12 @@ export const en = {
|
||||
"telegram.intro": "Use CodeCraft from Telegram with your own bot: messages go to your current session, commands switch sessions, modes and models, approvals and questions come with buttons. Only your Telegram account can use the bot.",
|
||||
"telegram.step1": "In Telegram, open @BotFather, send /newbot and follow the steps.",
|
||||
"telegram.step2": "Paste the token BotFather gives you here.",
|
||||
"telegram.notify": "Notifications",
|
||||
"telegram.factoryAlerts": "Factory: message when an issue gets a question or fails",
|
||||
"telegram.quiet": "Night mode: no unsolicited messages",
|
||||
"telegram.serverTime": "Server time {time}",
|
||||
"telegram.quietNow": "quiet right now",
|
||||
"telegram.quietHint": "During the night mode nothing is sent on your own initiative: no factory alerts, no approvals or questions from other chats. The chat you are talking to in Telegram keeps answering. Messages that are held back are not sent later – they stay visible in the web interface.",
|
||||
"telegram.connect": "Connect",
|
||||
"telegram.checking": "Checking…",
|
||||
"telegram.running": "running",
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
"202611-00063": {
|
||||
en: ["Factory: Telegram message when an issue gets a question or fails"],
|
||||
de: ["Factory: Telegram-Nachricht, wenn ein Issue eine Frage hat oder fehlschlägt"],
|
||||
unreleased: {
|
||||
en: ["Factory: Telegram message when an issue gets a question or fails (can be switched off)", "Telegram: night mode (22:00–06:00, adjustable) without unsolicited messages"],
|
||||
de: ["Factory: Telegram-Nachricht, wenn ein Issue eine Frage hat oder fehlschlägt (abschaltbar)", "Telegram: Nachtmodus (22:00–06:00, einstellbar) ohne ungefragte Nachrichten"],
|
||||
},
|
||||
"202611-00062": {
|
||||
en: ["Factory: the parallel limit per project is now respected exactly", "Factory: remove issues from the board; issues deleted on the forge disappear by themselves"],
|
||||
|
||||
Reference in new issue
Block a user