feat: i18n control, Gitea auto-update CI, license-gated updater, fixes

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-05-11 22:20:14 +08:00
parent 36776f4c5d
commit f462e65581
23 changed files with 2049 additions and 440 deletions
+12 -2
View File
@@ -58,8 +58,18 @@ function randomId(prefix: string): string {
return `${prefix}_${Math.random().toString(16).slice(2)}_${Date.now().toString(16)}`;
}
export function useProjectState(licenseActive: boolean): readonly [State, Actions] {
export type ProjectNoticeCode = 'campaign_audio_empty';
export type ProjectStateOpts = {
onNotice?: (code: ProjectNoticeCode) => void;
};
export function useProjectState(licenseActive: boolean, opts?: ProjectStateOpts): readonly [State, Actions] {
const api = getDndApi();
const onNoticeRef = useRef(opts?.onNotice);
useEffect(() => {
onNoticeRef.current = opts?.onNotice;
}, [opts?.onNotice]);
const [state, setState] = useState<State>({
projects: [],
project: null,
@@ -180,7 +190,7 @@ export function useProjectState(licenseActive: boolean): readonly [State, Action
const res = await api.invoke(ipcChannels.project.importCampaignAudio, {});
if (res.canceled) return;
if (res.imported.length === 0) {
window.alert('Аудио не добавлено. Проверьте формат файла.');
onNoticeRef.current?.('campaign_audio_empty');
}
setState((s) => ({ ...s, project: res.project }));
await refreshProjects();