Skip to content
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

General: Adapt exercise footer for small screens and general footer for environments #8359

Merged
merged 15 commits into from
Apr 11, 2024

Conversation

rabeatwork
Copy link
Contributor

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

Especially for small screens, it's important to have a compressed footer and not to waste any space.

Description

The footer in the exercises was partially very high. The footer height has been reduced overall, and for small screens, the buttons are turned into icon buttons. Also, the general Artemis footer was set to 4rem by default. That's fine for development but too high for production. This has been adjusted as well.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Exercise (e.g. Programming)
  1. Log in to Artemis
  2. Navigate to Course Management
  3. Add/Edit a Exercise (e.g. Programming)
  4. Verify that the footer is reduced in height
  5. Resize the Viewport
  6. Verify that the buttons switch to icon buttons

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Screenshots

image image image

@rabeatwork rabeatwork requested a review from a team as a code owner April 9, 2024 11:13
Copy link

coderabbitai bot commented Apr 9, 2024

Walkthrough

The update entails an extensive revamp to enrich the user interface, accessibility, and overall user experience of the web application. These enhancements cover various components, including CSS adjustments for responsive layouts, HTML template updates for conditional rendering and dynamic class assignments, and TypeScript modifications for improved functionality and code clarity. The primary aim is to streamline user interactions and establish a more intuitive and efficient application environment.

Changes

Files Summary
.../quiz/participate/quiz-participation.component.scss Adjusted quiz content and footer styling.
.../form-footer.component.html, .../form-footer.component.scss, .../form-footer.component.ts Enhanced form footer UI logic, styling, and functionality.
.../form-status-bar.component.html, .../form-status-bar.component.scss Modified vertical gap and style properties in the form status bar.
.../course-overview.component.scss Replaced height values with CSS variables for flexible styling in course overview.
.../button.component.html, .../button.component.ts Improved button component with new properties and conditional rendering logic.
.../footer/footer.component.html, .../footer/footer.component.scss, .../footer/footer.component.ts Updated footer functionality, variable naming, and environment-based classes.
.../main/main.component.html, .../main/main.component.ts Added conditional classes based on environment and implemented OnDestroy interface.
.../sidebar/sidebar.component.scss Updated sidebar styling to use CSS variables for responsive footer heights.
.../global.scss, .../themes/_default-variables.scss Adjusted global and theme-specific styling for responsiveness and environment-specific layouts.
.../i18n/de/exercise.json, .../i18n/de/lecture.json, .../i18n/en/exercise.json, .../i18n/en/lecture.json Enhanced exercise and lecture notifications in German and English localizations.
.../spec/component/forms/form-footer.component.spec.ts, .../spec/component/footer/footer.component.spec.ts Added tests for form footer and footer components.

Possibly related issues

  • Programming exercises: Add Athena Feedback Suggestions #7094: The changes in this PR focus on UI/UX enhancements and codebase refinements, indirectly impacting components like form footers and buttons, which could improve the user experience. However, the specific objectives related to Athena feedback suggestions for programming exercises are not directly addressed in this PR.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d0a250d and 0c98850.
Files selected for processing (4)
  • src/main/webapp/app/exercises/quiz/participate/quiz-participation.component.scss (1 hunks)
  • src/main/webapp/app/forms/form-footer/form-footer.component.html (2 hunks)
  • src/main/webapp/app/forms/form-status-bar/form-status-bar.component.html (1 hunks)
  • src/main/webapp/app/shared/components/button.component.html (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • src/main/webapp/app/exercises/quiz/participate/quiz-participation.component.scss
  • src/main/webapp/app/forms/form-footer/form-footer.component.html
  • src/main/webapp/app/forms/form-status-bar/form-status-bar.component.html
  • src/main/webapp/app/shared/components/button.component.html

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Apr 9, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

height: calc(100vh - $footer-height-dev - $header-height);
height: calc(100vh - var(--sidebar-footer-height-dev) - $header-height);
}
@media (max-width: 768px) {
Copy link

Choose a reason for hiding this comment

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

Expected empty line before at-rule
According to CSS best practices, it's recommended to have an empty line before at-rule declarations for better readability. Adding an empty line before the @media rule at line 223 will align with these practices and improve the code's readability.

+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
@media (max-width: 768px) {
@media (max-width: 768px) {

height: calc(100vh - $footer-height-dev);
height: calc(100vh - var(--sidebar-footer-height-dev));
}
@media (max-width: 768px) {
Copy link

Choose a reason for hiding this comment

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

Expected empty line before at-rule
For consistency and readability, it's recommended to add an empty line before the @media rule at line 32. This adjustment aligns with CSS best practices and improves the code's readability.

+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
@media (max-width: 768px) {
@media (max-width: 768px) {

@github-actions github-actions bot added the tests label Apr 9, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@@ -11,7 +12,7 @@ describe('ExerciseUpdateNotificationComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [MockModule(FormsModule)],
declarations: [ExerciseUpdateNotificationComponent],
declarations: [ExerciseUpdateNotificationComponent, MockPipe(ArtemisTranslatePipe)],
Copy link

Choose a reason for hiding this comment

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

Ensure high test coverage by adding more test cases.

Would you like suggestions for additional test cases to cover other functionalities of the ExerciseUpdateNotificationComponent?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Comment on lines +39 to +47
describe('Git Information', () => {
it('should display git information if not in production or on a test server', () => {
component.isProduction = false;
component.isTestServer = true;
fixture.detectChanges();

const gitInfoElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper');
expect(gitInfoElement).not.toBeNull();
});
Copy link

Choose a reason for hiding this comment

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

Add tests for git information display logic.

The test for git information display based on environment flags is good. However, consider adding more edge cases, such as when both isProduction and isTestServer are true, to ensure comprehensive coverage. Would you like assistance in implementing these tests?

Comment on lines +59 to +81
describe('Git Information Detailed Testing', () => {
beforeEach(() => {
component.gitBranch = 'main';
component.gitCommitId = 'abc123';
component.gitTimestamp = '2023-04-01T12:00:00Z';
component.gitCommitUser = 'user123';
component.isProduction = false;
component.isTestServer = false;
fixture.detectChanges();
});

it('should display all git information', () => {
const gitBranchElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(1)');
const gitCommitElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(2)');
const gitTimestampElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(3)');
const gitUserElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(4)');

expect(gitBranchElement.textContent).toContain('main');
expect(gitCommitElement.textContent).toContain('abc123');
expect(gitTimestampElement.textContent).toContain('2023-04-01T12:00:00Z');
expect(gitUserElement.textContent).toContain('user123');
});
});
Copy link

Choose a reason for hiding this comment

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

Refine git information detailed testing for readability and maintainability.

The detailed git information tests are well-structured, but they could be made more readable and maintainable by abstracting repetitive query selectors into a helper function. This would make the tests cleaner and easier to update in the future.

+ function queryGitInfo(selector) {
+     return fixture.debugElement.nativeElement.querySelector(selector);
+ }

- const gitBranchElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(1)');
+ const gitBranchElement = queryGitInfo('.footer-git-wrapper .footer-git:nth-child(1)');

Repeat this pattern for the other git information elements.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
describe('Git Information Detailed Testing', () => {
beforeEach(() => {
component.gitBranch = 'main';
component.gitCommitId = 'abc123';
component.gitTimestamp = '2023-04-01T12:00:00Z';
component.gitCommitUser = 'user123';
component.isProduction = false;
component.isTestServer = false;
fixture.detectChanges();
});
it('should display all git information', () => {
const gitBranchElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(1)');
const gitCommitElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(2)');
const gitTimestampElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(3)');
const gitUserElement = fixture.debugElement.nativeElement.querySelector('.footer-git-wrapper .footer-git:nth-child(4)');
expect(gitBranchElement.textContent).toContain('main');
expect(gitCommitElement.textContent).toContain('abc123');
expect(gitTimestampElement.textContent).toContain('2023-04-01T12:00:00Z');
expect(gitUserElement.textContent).toContain('user123');
});
});
describe('Git Information Detailed Testing', () => {
beforeEach(() => {
component.gitBranch = 'main';
component.gitCommitId = 'abc123';
component.gitTimestamp = '2023-04-01T12:00:00Z';
component.gitCommitUser = 'user123';
component.isProduction = false;
component.isTestServer = false;
fixture.detectChanges();
});
function queryGitInfo(selector) {
return fixture.debugElement.nativeElement.querySelector(selector);
}
it('should display all git information', () => {
const gitBranchElement = queryGitInfo('.footer-git-wrapper .footer-git:nth-child(1)');
const gitCommitElement = queryGitInfo('.footer-git-wrapper .footer-git:nth-child(2)');
const gitTimestampElement = queryGitInfo('.footer-git-wrapper .footer-git:nth-child(3)');
const gitUserElement = queryGitInfo('.footer-git-wrapper .footer-git:nth-child(4)');
expect(gitBranchElement.textContent).toContain('main');
expect(gitCommitElement.textContent).toContain('abc123');
expect(gitTimestampElement.textContent).toContain('2023-04-01T12:00:00Z');
expect(gitUserElement.textContent).toContain('user123');
});
});

@krusche krusche changed the title General: Adapt footer for small screens and environments General: Adapt exercise footer for small screens and environments Apr 9, 2024
@krusche krusche added this to the 7.0.0 milestone Apr 9, 2024
milljoniaer
milljoniaer previously approved these changes Apr 9, 2024
Copy link
Contributor

@milljoniaer milljoniaer left a comment

Choose a reason for hiding this comment

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

Thank you! Code LGTM 👍

@rabeatwork rabeatwork changed the title General: Adapt exercise footer for small screens and environments General: Adapt exercise footer for small screens and general footer for environments Apr 10, 2024
@muradium muradium temporarily deployed to artemis-test1.artemis.cit.tum.de April 10, 2024 15:14 — with GitHub Actions Inactive
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

See small comments

@muradium
Copy link
Contributor

Screenshot 2024-04-10 at 6 23 57 PM

Save icon does not adapt to page zoom anymore. Also the task green ticks stay the same size and go off the center, if that's related.

@rabeatwork
Copy link
Contributor Author

rabeatwork commented Apr 10, 2024

Screenshot 2024-04-10 at 6 23 57 PM Save icon does not adapt to page zoom anymore. Also the task green ticks stay the same size and go off the center, if that's related.

@muradium Which browser do you use?

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Code looks good

@krusche krusche merged commit 7aaac6d into develop Apr 11, 2024
19 of 25 checks passed
@krusche krusche deleted the chore/adapt-exercise-footer-for-small-screens branch April 11, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants