Stats history with year filter, folding and XLSX/CSV export; snippets, read-only links, commit suggestions, weekly review, offline copies, server speech-to-text, planning model, job reports; fal.ai health fix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c08c6c7436
commit
388ca96419
31 files changed
+1518
-82
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { get, put } from "../api";
|
||||
import { del, get, post, put } from "../api";
|
||||
import { useT } from "../i18n";
|
||||
import { useStore } from "../store";
|
||||
import { toast } from "../dialogs";
|
||||
import { fmtDate } from "../i18n";
|
||||
|
||||
interface DirUser {
|
||||
id: string;
|
||||
@@ -9,6 +11,54 @@ interface DirUser {
|
||||
display_name: string;
|
||||
}
|
||||
|
||||
interface Link {
|
||||
token: string;
|
||||
url: string;
|
||||
expires_at: number;
|
||||
}
|
||||
|
||||
/** Read-only links for people without an account. */
|
||||
function Links({ sessionId }: { sessionId: string }) {
|
||||
const t = useT();
|
||||
const [links, setLinks] = useState<Link[]>([]);
|
||||
const [days, setDays] = useState(7);
|
||||
const load = () => get<Link[]>(`/sessions/${sessionId}/links`).then(setLinks).catch(() => undefined);
|
||||
useEffect(() => void load(), [sessionId]);
|
||||
const create = async () => {
|
||||
try {
|
||||
const l = await post<Link>(`/sessions/${sessionId}/links`, { days });
|
||||
await navigator.clipboard?.writeText(l.url).then(() => toast(t("link.copied"), "success"), () => undefined);
|
||||
void load();
|
||||
} catch (e: any) {
|
||||
toast(e.message);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="share-links">
|
||||
<h4>{t("link.title")}</h4>
|
||||
<div className="hint">{t("link.hint")}</div>
|
||||
{links.map((l) => (
|
||||
<div key={l.token} className="row share-link">
|
||||
<input readOnly value={l.url} onFocus={(e) => e.currentTarget.select()} aria-label={t("link.title")} />
|
||||
<span className="hint">{t("link.until", { date: fmtDate(l.expires_at, false) })}</span>
|
||||
<button onClick={() => navigator.clipboard?.writeText(l.url).then(() => toast(t("link.copied"), "success"))}>{t("link.copy")}</button>
|
||||
<button onClick={() => del(`/sessions/${sessionId}/links/${l.token}`).then(load).catch((e) => toast(e.message))}>{t("link.revoke")}</button>
|
||||
</div>
|
||||
))}
|
||||
<div className="row" style={{ marginTop: 6 }}>
|
||||
<select value={days} onChange={(e) => setDays(Number(e.target.value))} aria-label={t("link.validity")}>
|
||||
{[1, 7, 30, 90].map((d) => (
|
||||
<option key={d} value={d}>
|
||||
{t("link.days", { n: d })}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button onClick={create}>{t("link.create")}</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Choose users a session is shared with (read-only for them). */
|
||||
export function ShareDialog({ sessionId, onClose }: { sessionId: string; onClose: () => void }) {
|
||||
const t = useT();
|
||||
@@ -59,6 +109,7 @@ export function ShareDialog({ sessionId, onClose }: { sessionId: string; onClose
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<Links sessionId={sessionId} />
|
||||
{error && <div className="notice err">{error}</div>}
|
||||
<div className="row" style={{ marginTop: 12, justifyContent: "flex-end" }}>
|
||||
<button onClick={onClose}>{t("common.cancel")}</button>
|
||||
|
||||
Reference in new issue
Block a user