Skip to content

Improve Ada printing behaviour #1449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion src/app/components/content/IsaacCodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const IsaacCodeSnippet = ({doc}: IsaacCodeProps) => {
</div>
{doc.url && <Row>
<Col className="text-center mb-2">
<a href={doc.url} onClick={logViewOnGitHub} target="_blank" rel="noopener noreferrer">View on GitHub</a>
<a className="no-print" href={doc.url} onClick={logViewOnGitHub} target="_blank" rel="noopener noreferrer">View on GitHub</a>
<a className="only-print mb-2" href={doc.url} target="_blank" rel="noopener noreferrer">{doc.url}</a>
</Col>
</Row>}
</>;
Expand Down
15 changes: 9 additions & 6 deletions src/app/components/elements/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function callOrString(stringOrTabFunction: StringOrTabFunction | undefined, tabT
}

// e.g.: Tab 1 | Tab 2 | Tab 3
const TabNavbar = ({singleLine, children, tabTitleClass, activeTab, changeTab}: TabsProps & {activeTab: number; changeTab: (i: number) => void}) => {
return <Nav tabs className={classNames("flex-wrap", {"guaranteed-single-line": singleLine})}>
const TabNavbar = ({singleLine, children, tabTitleClass, activeTab, changeTab, className}: TabsProps & {activeTab: number; changeTab: (i: number) => void;}) => {
return <Nav tabs className={classNames(className, "flex-wrap", {"guaranteed-single-line": singleLine})}>
{Object.keys(children).map((tabTitle, mapIndex) => {
const tabIndex = mapIndex + 1;
const linkClasses = callOrString(tabTitleClass, tabTitle, tabIndex);
Expand Down Expand Up @@ -135,7 +135,7 @@ export const Tabs = (props: TabsProps) => {
{expandButton}
<div className={classNames(className, innerClasses, "position-relative")}>
{style === "tabs"
? <TabNavbar activeTab={activeTab} changeTab={changeTab} {...props}>{children}</TabNavbar>
? <TabNavbar {...props} className="no-print" activeTab={activeTab} changeTab={changeTab}>{children}</TabNavbar>
: style === "buttons"
? <ButtonNavbar activeTab={activeTab} changeTab={changeTab} {...props}>{children}</ButtonNavbar>
: <DropdownNavbar activeTab={activeTab} changeTab={changeTab} {...props}>{children}</DropdownNavbar>
Expand All @@ -144,9 +144,12 @@ export const Tabs = (props: TabsProps) => {
<TabContent activeTab={activeTab} className={tabContentClass}>
{Object.entries(children).map(([tabTitle, tabBody], mapIndex) => {
const tabIndex = mapIndex + 1;
return <TabPane key={tabTitle} tabId={tabIndex}>
{tabBody as ReactNode}
</TabPane>;
return <>
{style === "tabs" && <TabNavbar {...props} className="d-none d-print-flex" activeTab={tabIndex} changeTab={changeTab}>{children}</TabNavbar>}
<TabPane key={tabTitle} tabId={tabIndex}>
{tabBody as ReactNode}
</TabPane>
</>;
})}
</TabContent>
</ExpandableParentContext.Provider>
Expand Down
2 changes: 1 addition & 1 deletion src/scss/cs/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

.print-icon {
position: relative;
z-index: 1;
z-index: 2;
&:not(.outline) {
@include ada-icon-button-base(48px, 48px, false);
}
Expand Down
1 change: 1 addition & 0 deletions src/scss/cs/questions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
z-index: 2;
background: $cs-cultured;
.question-actions-link {
margin-top: 2px; // Just to vertically center the links nicely
color: $secondary;
Expand Down
7 changes: 5 additions & 2 deletions src/test/pages/AssignmentProgress.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ describe("AssignmentProgress", () => {
// Clicking on the group title should suffice to open the accordion
await userEvent.click(groupTitle);
// Get the two tabs, making sure that they show the correct numbers of assignments in each one
const assignmentsTab = await screen.findByRole("button", {name: `Assignments (${mockAssignments.length})`});
const testsTab = await screen.findByRole("button", {name: `Tests (${mockTestAssignments.length})`});
// (and check that the user-visible "no-print" version of the tab is used)
const assignmentsTabs = await screen.findAllByRole("button", {name: `Assignments (${mockAssignments.length})`});
const assignmentsTab = assignmentsTabs.filter(tab => tab.classList.contains("no-print"))[0];
const testsTabs = await screen.findAllByRole("button", {name: `Tests (${mockTestAssignments.length})`});
const testsTab = testsTabs.filter(tab => tab.classList.contains("no-print"))[0];
await userEvent.click(assignmentsTab);
for (const assignmentTitle of mockAssignments.map(a => a.gameboard?.title)) {
await screen.findByText(assignmentTitle, {exact: false});
Expand Down
Loading