Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/src/aichat/views/ChatEventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface ChatEventsListProps {
isTeacherView?: boolean;
buildAssetUrl?: (asset: ChatAsset) => string;
isAiTutorVersion?: boolean;
hasCollapsedInstructionsDrawer?: boolean;
hasInstructionsDrawer?: boolean;
}

/**
Expand All @@ -31,7 +31,7 @@ const ChatEventsList: React.FunctionComponent<ChatEventsListProps> = ({
isTeacherView,
buildAssetUrl,
isAiTutorVersion,
hasCollapsedInstructionsDrawer,
hasInstructionsDrawer,
}) => {
const {chatDisabled, chatDisabledMessage} = useAiChatDisabled();
const [isInChatNavigationMode, setIsInChatNavigationMode] = useState(false);
Expand Down Expand Up @@ -186,8 +186,8 @@ const ChatEventsList: React.FunctionComponent<ChatEventsListProps> = ({
<ChatDisabled message={chatDisabledMessage} />
) : (
<>
{hasCollapsedInstructionsDrawer && (
<div className={moduleStyles.collapsedInstructionsDrawerInset} />
{hasInstructionsDrawer && (
<div className={moduleStyles.instructionsDrawerInset} />
)}
{events.map((event, index) => {
const isLastMessage = index === events.length - 1;
Expand Down
6 changes: 3 additions & 3 deletions apps/src/aichat/views/ChatWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface ChatWorkspaceProps {
// Optional callback to log level activity
logLevelActivity?: () => void;

hasCollapsedInstructionsDrawer?: boolean;
hasInstructionsDrawer?: boolean;
}

/**
Expand All @@ -80,7 +80,7 @@ const ChatWorkspace: React.FunctionComponent<ChatWorkspaceProps> = ({
hideModelChangeMessage = false,
responseCallback,
logLevelActivity,
hasCollapsedInstructionsDrawer,
hasInstructionsDrawer,
}) => {
const {chatDisabled} = useAiChatDisabled();
if (multimodalEnabled && (!levelName || !channelId)) {
Expand Down Expand Up @@ -325,7 +325,7 @@ const ChatWorkspace: React.FunctionComponent<ChatWorkspaceProps> = ({
isTeacherView={isTeacherView}
buildAssetUrl={buildAssetUrlValue}
isAiTutorVersion={isAiTutorVersion}
hasCollapsedInstructionsDrawer={hasCollapsedInstructionsDrawer}
hasInstructionsDrawer={hasInstructionsDrawer}
/>
)}
<div className={moduleStyles.footer}>
Expand Down
5 changes: 3 additions & 2 deletions apps/src/aichat/views/chatWorkspace.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ $tabs-default-spacing: 4px;
padding: 0.625rem;
}

.collapsedInstructionsDrawerInset {
height: 50px;
.instructionsDrawerInset {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inset for both collapsed and expanded instructions drawer state.

flex-shrink: 0;
height: 18px;
}

.floatingScrollToBottomButtonContainer {
Expand Down
6 changes: 3 additions & 3 deletions apps/src/lab2/views/components/AiTutorChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface AiTutorChatProps {
aiTutorChatButtonData?: ChatButtonData[];
aiTutorSystemPromptName?: string;
aiTutorResponseSchemaSettings?: ResponseSchemaSettings;
hasCollapsedInstructionsDrawer?: boolean;
hasInstructionsDrawer?: boolean;
}

// A free chat with lab-supplied context added to each question.
Expand All @@ -42,7 +42,7 @@ const AiTutorChat: React.FunctionComponent<AiTutorChatProps> = ({
aiTutorChatButtonData,
aiTutorSystemPromptName,
aiTutorResponseSchemaSettings,
hasCollapsedInstructionsDrawer,
hasInstructionsDrawer,
}) => {
const {modelParameters, loading} = useAiTutorModelParameters({
aiTutorSystemPromptName,
Expand Down Expand Up @@ -96,7 +96,7 @@ const AiTutorChat: React.FunctionComponent<AiTutorChatProps> = ({
channelId={channelId}
hideModelChangeMessage={true}
responseCallback={aiTutorResponseSchemaSettings?.responseCallback}
hasCollapsedInstructionsDrawer={hasCollapsedInstructionsDrawer}
hasInstructionsDrawer={hasInstructionsDrawer}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,17 @@ const AiTutorChatWithInstructionDrawer: React.FunctionComponent<

return (
<div ref={containerRef} className={styles.container}>
<div
className={styles.instructionsDrawer}
style={{height: instructionsHeight}}
>
<div className={styles.instructionsScrollArea}>
<div ref={instructionsContentRef}>{instructionsContent}</div>
{!isCollapsed && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This div even with height 0 was impacting spacing when collapsed.

<div
id="instructions-drawer"
className={styles.instructionsDrawer}
style={{height: instructionsHeight}}
>
<div className={styles.instructionsScrollArea}>
<div ref={instructionsContentRef}>{instructionsContent}</div>
</div>
</div>
</div>
)}
<div
className={styles.toggleButtonContainer}
style={{top: instructionsHeight}}
Expand Down Expand Up @@ -174,7 +177,7 @@ const AiTutorChatWithInstructionDrawer: React.FunctionComponent<
aiTutorChatButtonData={aiTutorChatButtonData}
aiTutorSystemPromptName={aiTutorSystemPromptName}
aiTutorResponseSchemaSettings={aiTutorResponseSchemaSettings}
hasCollapsedInstructionsDrawer={isCollapsed}
hasInstructionsDrawer={true}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,14 @@ const ResourcePanel: React.FC<ResourcePanelProps> = ({
}, [currentTab, availableTabs]);

useEffect(() => {
// Reset current tab to instructions when switching levels or viewAsUserId.
setCurrentTab(Tabs.Instructions);
}, [levelId, viewAsUserId]);
// Reset current tab to instructions when switching levels or viewAsUserId unless there is an AI tutor tab with instructions drawer.
// If there is, then we set initial tab to the AI Tutor tab.
if (hasInstructionsDrawer && aiTutorVisible) {
setCurrentTab(Tabs.AiTutor);
} else {
setCurrentTab(Tabs.Instructions);
}
}, [levelId, viewAsUserId, hasInstructionsDrawer, aiTutorVisible]);

// Move focus to panel content when AI Tutor or Version History tab is selected via keyboard.
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Scenario: Continue button and progress status shows up correctly
And I wait until current URL contains "http://studio.code.org/courses/allthethingscourse/units/1/lessons/50/levels/2"
# Check that progress has been updated for the previous level
Then I verify progress in the header of the current page is "perfect" for level 1
And I wait until element "#resource-panel-tab-validation" is visible
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UI test has been flaky in general so adding a wait step here.

And I press "resource-panel-tab-validation"
And I wait to see "#uitest-validate-button"
And I wait until "#uitest-validate-button" is not disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Feature: Web Lab 2 Preview
# general loading of the editor/instructions into two separate tests.
Scenario: Web Lab 2 Instructions and Editor load
Given I create a student named "Penelope"
When I am on "http://studio.code.org/courses/allthethingscourse/units/1/lessons/51/levels/11"
And I wait until element "#instructions-panel" is visible
Then element with ID "instructions-panel" contains text "This is the level for a basic Web Lab 2 UI Test. Please do not change the start code for this level without changing the UI test!"
When I am on "http://studio.code.org/courses/allthethingscourse/units/1/lessons/51/levels/11?noIntrojs=true"
And I wait until element "#instructions-drawer" is visible
Then element with ID "instructions-drawer" contains text "This is the level for a basic Web Lab 2 UI Test. Please do not change the start code for this level without changing the UI test!"
And element with ID "uitest-files-list" contains text "index.html"
And I wait until element ".codemirror-container" contains text "Hello world!"