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

fix(web): Change custom syslumenn pages config for header #16299

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

mannipje
Copy link
Member

@mannipje mannipje commented Oct 7, 2024

Change custom syslumenn pages config for header

What

Change config setup for custom syslumenn pages.

Why

So the island.is header color scheme is right when using default header config.

Screenshots / Gifs

Before

image

After

image

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced dynamic header theming in the Auctions, Homestay, and Operating Licenses components based on the presence of a default header.
    • Enhanced flexibility of header appearance by adapting color schemes according to configuration.
  • Bug Fixes

    • Removed hardcoded header color schemes for a more responsive design based on user settings.

@mannipje mannipje added the automerge Merge this PR as soon as all checks pass label Oct 7, 2024
@mannipje mannipje requested a review from a team as a code owner October 7, 2024 14:48
Copy link
Contributor

coderabbitai bot commented Oct 7, 2024

Walkthrough

The pull request introduces changes to three components: Auctions, Homestay, and OperatingLicenses. Each component now includes a new boolean variable usingDefaultHeader that determines the use of a default header based on the namespace object. This variable influences the themeConfig returned from the getProps method, allowing for conditional styling of the header. The previous hardcoded header color schemes have been replaced with a dynamic configuration based on the value of usingDefaultHeader.

Changes

File Path Change Summary
apps/web/screens/Organization/Syslumenn/Auctions.tsx Added usingDefaultHeader boolean and updated themeConfig in getProps.
apps/web/screens/Organization/Syslumenn/Homestay.tsx Added usingDefaultHeader boolean and updated themeConfig in getProps.
apps/web/screens/Organization/Syslumenn/OperatingLicenses.tsx Added usingDefaultHeader boolean and updated themeConfig in getProps.

Possibly related PRs

Suggested reviewers

  • RunarVestmann

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

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.

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: 0

🧹 Outside diff range and nitpick comments (3)
apps/web/screens/Organization/Syslumenn/Homestay.tsx (2)

375-376: LGTM! Consider adding type assertion for improved type safety.

The introduction of the usingDefaultHeader variable is a good addition that aligns with the PR objective. The use of the nullish coalescing operator for providing a default value is a good practice.

For improved type safety, consider adding a type assertion to the namespace object:

const usingDefaultHeader: boolean = (namespace as { usingDefaultHeader?: boolean })['usingDefaultHeader'] ?? false;

This ensures that TypeScript understands the structure of the namespace object and prevents potential type-related issues.


383-388: LGTM! Consider improving object literal formatting for better readability.

The conditional setting of themeConfig based on usingDefaultHeader is a good implementation that aligns with the PR objective. It ensures that the header color scheme is correctly configured based on whether the default header is being used or not.

Consider improving the formatting of the object literal for better readability:

themeConfig: !usingDefaultHeader
  ? {
      headerButtonColorScheme: 'negative',
      headerColorScheme: 'white',
    }
  : {},

This format aligns the object properties and makes the code structure more clear.

apps/web/screens/Organization/Syslumenn/OperatingLicenses.tsx (1)

671-683: LGTM! Consider minor readability improvement.

The changes look good and align with the PR objectives. The introduction of usingDefaultHeader adds flexibility to the header configuration, and the conditional setting of themeConfig allows for dynamic theming.

A minor suggestion for improved readability:

-  const usingDefaultHeader: boolean = namespace['usingDefaultHeader'] ?? false
+  const usingDefaultHeader = namespace['usingDefaultHeader'] ?? false

The explicit : boolean type annotation is unnecessary here as TypeScript can infer the type from the right-hand side of the assignment.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c7ad42c and 426e771.

📒 Files selected for processing (3)
  • apps/web/screens/Organization/Syslumenn/Auctions.tsx (1 hunks)
  • apps/web/screens/Organization/Syslumenn/Homestay.tsx (1 hunks)
  • apps/web/screens/Organization/Syslumenn/OperatingLicenses.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/web/screens/Organization/Syslumenn/Auctions.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Organization/Syslumenn/Homestay.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Organization/Syslumenn/OperatingLicenses.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (4)
apps/web/screens/Organization/Syslumenn/Homestay.tsx (1)

375-388: Overall changes align well with PR objectives and follow best practices.

The modifications to the Homestay component, particularly in the getProps method, effectively implement the desired functionality for custom syslumenn pages configuration. The introduction of the usingDefaultHeader variable and the conditional setting of themeConfig ensure that the header color scheme aligns correctly with the default header configuration on the island.is platform.

The changes adhere to TypeScript and NextJS best practices, including efficient state management and type safety. The code is concise, readable, and maintains the overall structure and functionality of the component.

Great job on implementing these changes! They successfully address the PR objectives while maintaining code quality and following best practices.

apps/web/screens/Organization/Syslumenn/Auctions.tsx (3)

Line range hint 1-1102: LGTM: Well-structured React component with robust filtering logic.

The Auctions component is well-implemented, following React and TypeScript best practices. It effectively uses island.is UI components and custom hooks, handling complex filtering and display logic for auctions.


1103-1116: LGTM: Dynamic header configuration aligns with PR objectives.

The introduction of usingDefaultHeader and the conditional themeConfig effectively implements the required changes for custom syslumenn pages. This change allows for dynamic header styling, which aligns well with the PR's objective of ensuring correct header color scheme alignment.


1117-1122: LGTM: Proper component export with layout wrapper.

The export statement correctly uses the withMainLayout higher-order component, following good practices for component organization and layout management.

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 36.83%. Comparing base (8fbd08d) to head (bdc0ef1).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ps/web/screens/Organization/Syslumenn/Auctions.tsx 0.00% 3 Missing ⚠️
...ps/web/screens/Organization/Syslumenn/Homestay.tsx 0.00% 3 Missing ⚠️
...reens/Organization/Syslumenn/OperatingLicenses.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16299      +/-   ##
==========================================
- Coverage   36.86%   36.83%   -0.03%     
==========================================
  Files        6798     6796       -2     
  Lines      140486   140412      -74     
  Branches    39936    39931       -5     
==========================================
- Hits        51792    51726      -66     
+ Misses      88694    88686       -8     
Flag Coverage Δ
portals-admin-regulations-admin 1.88% <ø> (ø)
testing-e2e ?
web 1.83% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ps/web/screens/Organization/Syslumenn/Auctions.tsx 0.00% <0.00%> (ø)
...ps/web/screens/Organization/Syslumenn/Homestay.tsx 0.00% <0.00%> (ø)
...reens/Organization/Syslumenn/OperatingLicenses.tsx 0.00% <0.00%> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8fbd08d...bdc0ef1. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 7, 2024

Datadog Report

All test runs 748dafb 🔗

2 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 3 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
portals-admin-regulations-admin 0 0 0 24 0 16.35s 1 no change Link
web 0 0 0 84 0 33.11s 1 no change Link

@kodiakhq kodiakhq bot merged commit ef8b3ef into main Oct 7, 2024
33 checks passed
@kodiakhq kodiakhq bot deleted the fix/custom-syslumenn-page-config branch October 7, 2024 18:00
thordurhhh pushed a commit that referenced this pull request Oct 8, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 8, 2024
6 tasks
kodiakhq bot added a commit that referenced this pull request Oct 11, 2024
…-pages (#16234)

* Service portal removal. Add portals my pages

* minor fixes

* Fix

* path fix

* fix(portals-admin): locklist (#16279)

* fix(portals-admin): locklist

* tweak

* msg id fix

* tweak

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(service-portal): feature flag resolver for documents (#16285)

* fix: def info and alert

* feat: add feature flag to resolver

* fix: move ff call to seperate function

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(vehicles-bulk-mileage): Fixes after testing review (#16295)

* fix: testing fixes v1

* fix: testing comments v2

* fix: better message

* fix: function name

* fix: duplicate loading

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(tests): New @island/testing/e2e library (#16287)

* Add @swc-node/register and @swc/core

* Add testing/e2e library

* update project.json for testing/e2e

* fix import for libTestingE2e

---------

Co-authored-by: Kristofer <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(parental-leave): ApplicationRights (#15901)

* feat(parental-leave): ApplicationRights

Added applicationRights to parental-leave when sending application. Since we are using a new way of calculating periods

* Fix days used by period calculation

* Tests for new periods

* rename function with proper camelCase

* Refactor: Made duplicate code into a function

* Make ApplicationRights nullable

* refactor: function instead of duplicate code

* remove console.log

* error handling for period data

* clientConfig nullable fix

* Fixes for calculation of months. And using clamp to get correct value of daysLeft

* Multiply amount of months by 30 for period calculation with month durations

* Fix old calculation of endDate with months

---------

Co-authored-by: hfhelgason <[email protected]>
Co-authored-by: veronikasif <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(passport-application): Updated readme (#16296)

* updated readme

* updated readme

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(regulations-admin): date format signature, remove self affect, disclaimer text (#16288)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(regulations-admin): No diff no addition in appendix (#16293)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(web): Global alert banner - Handle null case (#16298)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(web): Change custom syslumenn pages config for header (#16299)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(j-s): Digital mailbox API (#16301)

* feat(j-s): Block create subpoena on staging and dev

* Update subpoena.service.ts

* fix(j-s): Fix mailbox API

* remove changes not meant for this branch

* Update subpoena.service.ts

* fix(j-s): reverting changes from other branch

* Update subpoena.response.ts

* Update subpoena.response.ts

* Update subpoena.response.ts

* Update subpoena.response.ts

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(signature-collection): Fix list reviewed toggle (#16300)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* chore(scripts): Stricter shell script checking (#16242)

* Set style level for shellcheck

* Linting & formatting scripts

* Remove _podman.sh script

* Format all scripts

* Add reviewdog/action-shfmt step

* Configure shfmt

* Merge from main

* Linting

* Move shfmt to before lint

* Remove reviewdog

* Allow external sources in shellcheck

* Use Reviewdog for shellcheck

* Set version for Reviewdog

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* chore(new-primary-school): Update messages namespace (#16302)

Co-authored-by: veronikasif <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(driving-license): check if 65+ renewal is possible (#16292)

* check if 65 renewal is possible

* remove console log

* cleanup

* coderabbit tweaks

* coderabbit changes

* quick fix

* add type?

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(service-portal): default defender and has chosen fields for subpoena (#16306)

* fix: def info and alert

* feat: add feature flag to resolver

* fix: move ff call to seperate function

* feat: add default choices ans has chosen + loading states

* fix: use type

* fix: undefined type issue

* fix: simplify check

* Update service setup for my pages infra

* chore: charts update dirty files

* Remove from infra

* undo rename

---------

Co-authored-by: albinagu <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Ásdís Erna Guðmundsdóttir <[email protected]>
Co-authored-by: Þorkell Máni Þorkelsson <[email protected]>
Co-authored-by: Svanhildur Einarsdóttir <[email protected]>
Co-authored-by: Kristofer <[email protected]>
Co-authored-by: helgifr <[email protected]>
Co-authored-by: hfhelgason <[email protected]>
Co-authored-by: veronikasif <[email protected]>
Co-authored-by: Rafn Árnason <[email protected]>
Co-authored-by: andes-it <[email protected]>
Co-authored-by: Rúnar Vestmann <[email protected]>
Co-authored-by: mannipje <[email protected]>
Co-authored-by: unakb <[email protected]>
Co-authored-by: juni-haukur <[email protected]>
Co-authored-by: birkirkristmunds <[email protected]>
Co-authored-by: Kristján Albert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants