修改了nanobot,往Hermes agent的风格走,进度1/3
This commit is contained in:
@ -338,7 +338,7 @@ function renderPlainText(content: string): React.ReactNode[] {
|
||||
|
||||
export default function OutlookPage() {
|
||||
const { locale } = useAppI18n();
|
||||
const t = (zh: string, en: string) => pickAppText(locale, zh, en);
|
||||
const t = useCallback((zh: string, en: string) => pickAppText(locale, zh, en), [locale]);
|
||||
const [status, setStatus] = useState<OutlookStatus | null>(null);
|
||||
const [form, setForm] = useState<OutlookFormState>(EMPTY_FORM);
|
||||
const [formDirty, setFormDirty] = useState(false);
|
||||
@ -368,14 +368,19 @@ export default function OutlookPage() {
|
||||
sent: false,
|
||||
});
|
||||
const [calendarLoading, setCalendarLoading] = useState(false);
|
||||
const formDirtyRef = React.useRef(formDirty);
|
||||
|
||||
useEffect(() => {
|
||||
formDirtyRef.current = formDirty;
|
||||
}, [formDirty]);
|
||||
|
||||
const applyStatus = useCallback((nextStatus: OutlookStatus, forceFormSync = false) => {
|
||||
setStatus(nextStatus);
|
||||
if (forceFormSync || !formDirty) {
|
||||
if (forceFormSync || !formDirtyRef.current) {
|
||||
setForm(toFormState(nextStatus));
|
||||
setFormDirty(false);
|
||||
}
|
||||
}, [formDirty]);
|
||||
}, []);
|
||||
|
||||
const loadOverview = useCallback(async (preserveExisting = false) => {
|
||||
setOverviewLoading(true);
|
||||
@ -456,9 +461,7 @@ export default function OutlookPage() {
|
||||
if (!background) {
|
||||
setStatusLoading(false);
|
||||
}
|
||||
if (nextStatus.configured) {
|
||||
await loadOverview(options?.preserveOverview ?? background);
|
||||
} else {
|
||||
if (!nextStatus.configured) {
|
||||
setOverview(null);
|
||||
setOverviewLoading(false);
|
||||
}
|
||||
@ -668,7 +671,9 @@ export default function OutlookPage() {
|
||||
|
||||
const refreshOverview = async () => {
|
||||
await loadStatus(true, { preserveOverview: true });
|
||||
if (activeView === 'inbox') {
|
||||
if (activeView === 'settings' && isConfigured) {
|
||||
await loadOverview(true);
|
||||
} else if (activeView === 'inbox') {
|
||||
await loadMailboxPage('inbox', inboxPage?.page.skip ?? 0);
|
||||
} else if (activeView === 'sent') {
|
||||
await loadMailboxPage('sent', sentPage?.page.skip ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user