fix: dismiss teacher welcome on consultation entry
This commit is contained in:
@@ -234,6 +234,13 @@ export function useTeacherCompanion(options: Options) {
|
||||
};
|
||||
}, [account, options.projectId, scope, storageKey, noteTopic]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!options.teacherOpen || !options.projectId) return;
|
||||
// Entering consultation consumes the greeting, but leaves real invitations unread.
|
||||
writeLocal(storageKey + ':welcome-dismissed', true);
|
||||
setState((current) => current.welcomeDismissed ? current : { ...current, welcomeDismissed: true });
|
||||
}, [options.teacherOpen, options.projectId, storageKey]);
|
||||
|
||||
const topic = stateScope.current === scope ? state.topic : null;
|
||||
const topicId = topic?.id;
|
||||
const topicProjectId = topic?.projectId;
|
||||
@@ -262,7 +269,7 @@ export function useTeacherCompanion(options: Options) {
|
||||
const selectedAgentId = visibleState.selectedAgent?.teacher_id ?? selectedDefinition?.config_id;
|
||||
const selectedAgent = visibleState.selectedAgent === null ? undefined
|
||||
: visibleState.agents.find((item) => item.teacher_id === selectedAgentId) ?? visibleState.selectedAgent;
|
||||
const welcome = topic?.role !== 'friend' && !visibleState.loading && visibleState.enabled && !visibleState.welcomeDismissed
|
||||
const welcome = topic?.role !== 'friend' && !options.teacherOpen && !visibleState.loading && visibleState.enabled && !visibleState.welcomeDismissed
|
||||
? selectedDefinition?.welcome_message.trim() || null : null;
|
||||
return {
|
||||
...visibleState,
|
||||
|
||||
Reference in New Issue
Block a user