feat: i18n control, Gitea auto-update CI, license-gated updater, fixes
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user