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

feat: add library as beta to studio page header with news #14491

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

standeren
Copy link
Contributor

@standeren standeren commented Jan 22, 2025

Description

Add library as beta to studio page header with news:

Skjermbilde 2025-01-21 kl  17 06 05
Skjermbilde 2025-01-21 kl  17 06 08
Skjermbilde 2025-01-22 kl  14 07 17
Skjermbilde 2025-01-22 kl  14 07 24
Skjermbilde 2025-01-22 kl  14 07 39

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new Content Library feature accessible from the menu bar
    • Added a new menu item for Content Library with a beta tag
  • Improvements

    • Updated header menu to include Content Library option
    • Modified image library messaging to indicate upcoming features
  • Localization

    • Updated Norwegian language translations for Content Library
    • Added new message about upcoming image upload functionality
  • User Interface

    • Added beta styling to Content Library header
    • Refined header menu design and navigation options

@standeren standeren added frontend team/studio-domain1 skip-documentation Issues where updating documentation is not relevant labels Jan 22, 2025
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new ContentLibrary menu item to the application's header menu. The changes span multiple files across the frontend, adding a new enum entry, updating header menu utilities, modifying language translations, and implementing a new library feature. The changes include adding a beta-tagged menu item, updating test cases, and preparing for future content library functionality with a focus on code lists and potential future image and text storage.

Changes

File Change Summary
frontend/app-development/enums/HeaderMenuItemKey.ts Added new enum entry ContentLibrary = 'top_menu.content_library'
frontend/app-development/features/overview/components/News/NewsContent/news.nb.json Added a new news entry about the content library's availability
frontend/app-development/utils/headerMenu/headerMenuUtils.test.ts Updated test assertion to include new ContentLibrary key
frontend/app-development/utils/headerMenu/headerMenuUtils.ts Added new menu item for ContentLibrary with BookIcon and beta flag
frontend/language/src/nb.json Added new translation for content library image upload
frontend/libs/studio-content-library/...ImagesPage/ImagesPage.test.tsx Updated test to check for "coming soon" message
frontend/libs/studio-content-library/...ImagesPage/ImagesPage.tsx Changed alert message for no images
frontend/libs/studio-content-library/...LibraryHeader/LibraryHeader.module.css Added new .headingText CSS class
frontend/libs/studio-content-library/...LibraryHeader/LibraryHeader.test.tsx Added test for beta class on header
frontend/libs/studio-content-library/...LibraryHeader/LibraryHeader.tsx Updated header component with beta styling

Possibly related PRs

Suggested labels

area/ui-editor, kind/feature-request

Suggested reviewers

  • Ildest
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@standeren standeren added the area/content-library Area: Related to library for shared resources label Jan 22, 2025
@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. area/overview Area: Related to the overview page and removed area/content-library Area: Related to library for shared resources labels Jan 22, 2025
@standeren standeren linked an issue Jan 22, 2025 that may be closed by this pull request
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.71%. Comparing base (63f248b) to head (1921037).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14491   +/-   ##
=======================================
  Coverage   95.71%   95.71%           
=======================================
  Files        1904     1904           
  Lines       24804    24805    +1     
  Branches     2840     2840           
=======================================
+ Hits        23741    23743    +2     
  Misses        802      802           
+ Partials      261      260    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@standeren standeren marked this pull request as ready for review January 23, 2025 14:31
Copy link
Member

@nkylstad nkylstad left a comment

Choose a reason for hiding this comment

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

Code changes look good! 💪
I guess merging here is blocked by the text-resource issue for code lists?

Base automatically changed from fix-beta-tag to main January 27, 2025 09:54
Copy link
Contributor

@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

🧹 Nitpick comments (2)
frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.tsx (1)

3-3: LGTM! Consider adding type safety for classnames.

The implementation correctly adds the beta tag styling to the library header and maintains proper internationalization.

Consider using a typed version of classnames for better type safety:

-import cn from 'classnames';
+import cn from 'classnames/bind';

+const styles = cn.bind(classes);

-<StudioHeading size='small' className={cn(classes.headingText, studioBetaTagClasses.isBeta)}>
+<StudioHeading size='small' className={styles('headingText', studioBetaTagClasses.isBeta)}>

Also applies to: 6-6, 14-16

frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.test.tsx (1)

20-26: Enhance test coverage for class assertions.

The test correctly verifies the beta tag, but could be more comprehensive.

Consider enhancing the test to verify both classes and use a more specific selector:

 it('renders the content library header with isBeta class', () => {
   renderLibraryHeader();
   const libraryHeader = screen.getByRole('heading', {
     name: textMock('app_content_library.library_heading'),
   });
-  expect(libraryHeader).toHaveClass('isBeta');
+  expect(libraryHeader).toHaveClass('headingText', 'isBeta');
+  // Or for more specific testing:
+  expect(libraryHeader.className).toMatch(/headingText.*isBeta/);
 });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63f248b and 1921037.

📒 Files selected for processing (10)
  • frontend/app-development/enums/HeaderMenuItemKey.ts (1 hunks)
  • frontend/app-development/features/overview/components/News/NewsContent/news.nb.json (1 hunks)
  • frontend/app-development/utils/headerMenu/headerMenuUtils.test.ts (1 hunks)
  • frontend/app-development/utils/headerMenu/headerMenuUtils.ts (2 hunks)
  • frontend/language/src/nb.json (2 hunks)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/ImagesPage/ImagesPage.test.tsx (1 hunks)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/ImagesPage/ImagesPage.tsx (1 hunks)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.module.css (1 hunks)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.test.tsx (1 hunks)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/libs/studio-content-library/src/ContentLibrary/LibraryHeader/LibraryHeader.module.css
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build environment and run e2e test
  • GitHub Check: Testing
  • GitHub Check: CodeQL
🔇 Additional comments (7)
frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/ImagesPage/ImagesPage.tsx (1)

27-27: LGTM! Good user experience improvement.

The change from "no content" to "coming soon" message provides better feedback to users about the upcoming feature.

frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/ImagesPage/ImagesPage.test.tsx (1)

25-26: LGTM! Test updated correctly.

The test has been properly updated to match the new "coming soon" message, maintaining test coverage for the component change.

frontend/language/src/nb.json (1)

47-47: LGTM! Translation added correctly.

The new translation key app_content_library.images.coming_soon with the Norwegian text "Snart blir det mulig å laste opp bilder i biblioteket. Vi jobber med saken!" is well-structured and provides clear information to users.

frontend/app-development/enums/HeaderMenuItemKey.ts (1)

8-8: LGTM!

The new enum entry follows the established naming conventions and is correctly placed before the None entry.

frontend/app-development/utils/headerMenu/headerMenuUtils.ts (2)

6-13: LGTM!

The BookIcon import is appropriately added and grouped with other icon imports.


60-67: LGTM!

The ContentLibrary menu item is well-structured with:

  • Appropriate icon choice
  • Correct repository type restriction
  • Logical grouping under Tools
  • Clear beta status indication
frontend/app-development/utils/headerMenu/headerMenuUtils.test.ts (1)

174-180: LGTM!

The test expectations are correctly updated to include the new ContentLibrary menu item while maintaining the existing order.

Comment on lines +4 to +8
{
"date": "2025-01-27",
"title": "Biblioteket er nå tilgjengelig fra menylinjen",
"content": "Vi har lagd et nytt bibliotek! Her finner du nå kodelistene dine. Vi jobber med å utvide biblioteket til at du kan finne eller lagre andre ting der, som bilder og tekster."
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update the news entry date to the current month.

The news entry date is set to "2025-01-27" which is in the future. Since the current date is January 2025, please update it to a date within the current month.

Apply this diff to fix the date:

-      "date": "2025-01-27",
+      "date": "2025-01-15",
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"date": "2025-01-27",
"title": "Biblioteket er nå tilgjengelig fra menylinjen",
"content": "Vi har lagd et nytt bibliotek! Her finner du nå kodelistene dine. Vi jobber med å utvide biblioteket til at du kan finne eller lagre andre ting der, som bilder og tekster."
},
{
"date": "2025-01-15",
"title": "Biblioteket er nå tilgjengelig fra menylinjen",
"content": "Vi har lagd et nytt bibliotek! Her finner du nå kodelistene dine. Vi jobber med å utvide biblioteket til at du kan finne eller lagre andre ting der, som bilder og tekster."
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/overview Area: Related to the overview page frontend skip-documentation Issues where updating documentation is not relevant solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain1
Projects
Status: ⚠️ Blocked
Development

Successfully merging this pull request may close these issues.

Add header menu element for library in Studio
2 participants