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(ojoi): Fixing bugs found in demo #15130

Merged
merged 7 commits into from
Jun 6, 2024
Merged

Conversation

jonbjarnio
Copy link
Member

@jonbjarnio jonbjarnio commented Jun 6, 2024

What

  • fixing outdated graphql
  • fixing ui bugs

Why

For better UX

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 pagination in the AdvertModal component for better navigation through adverts.
    • Added new GraphQL queries for departments and types.
  • Bug Fixes

    • Corrected styling issues for responsive design in the Signatures and HTMLEditor components.
  • Improvements

    • Enhanced the RegularSignature component layout for better user experience.
    • Updated GraphQL query parameters for improved data retrieval.
    • Made various fields optional in the data schema for more flexible form submissions.

@jonbjarnio jonbjarnio requested review from a team as code owners June 6, 2024 13:01
Copy link
Contributor

coderabbitai bot commented Jun 6, 2024

Walkthrough

The changes primarily involve updating GraphQL query parameters, adding pagination, refining CSS for responsive design, and restructuring the RegularSignature component. The updates enhance the functionality, maintainability, and user experience of the Official Journal of Iceland application by introducing new classes, modifying existing queries, and improving UI components.

Changes

File(s) Change Summary
apps/web/screens/queries/OfficialJournalOfIceland.ts Updated ADVERT_QUERY parameter type.
libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts Added pageSize field, renamed AdvertQueryParams to AdvertSingleParams.
libs/api/domains/official-journal-of-iceland/src/lib/models/advert.response.ts Added new classes AdvertTypesResponse and AdvertDepartmentsResponse.
libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts Introduced AdvertSingleParams class with id field.
libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts Renamed AdvertQueryParams to AdvertSingleParams, added new response models.
libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts Renamed parameters and return types for methods, updated method signatures.
libs/application/templates/official-journal-of-iceland/src/components/htmlEditor/HTMLEditor.css.ts Added marginBottom property to .advertisement__title-main class.
libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx Reorganized JSX elements, updated Button component.
libs/application/templates/official-journal-of-iceland/src/components/signatures/Signatures.css.ts Adjusted styling for responsive design using media queries.
libs/application/templates/official-journal-of-iceland/src/fields/Advert.css.ts Added new style inputWrapper, modified modal style.
libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx Added CSS import, modified departments array structure, updated GraphQL query and styling.
libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx Added Pagination import, updated useQuery variables, added pagination component.
libs/application/templates/official-journal-of-iceland/src/fields/Preview.tsx Changed query variable, updated category data access.
libs/application/templates/official-journal-of-iceland/src/fields/Publishing.tsx Added logic for minimum date and default date calculation, updated pageSize parameter.
libs/application/templates/official-journal-of-iceland/src/fields/Summary.tsx Renamed queries, updated query variables and data retrieval methods.
libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts Renamed parameters in GraphQL queries, added new queries.
libs/application/templates/official-journal-of-iceland/src/lib/constants.ts Removed fastTrack property from INITIAL_ANSWERS.
libs/application/templates/official-journal-of-iceland/src/lib/dataSchema.ts Converted required fields to optional within advert and publishing objects.
libs/clients/official-journal-of-iceland/public/src/clientConfig.json Simplified JSON schema structure for better readability.
libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts Added new methods department and type, added error handling to types method.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant Database

    User->>Frontend: Request Advert Details
    Frontend->>Backend: ADVERT_QUERY with OfficialJournalOfIcelandAdvertSingleParams
    Backend->>Database: Fetch Advert Details
    Database->>Backend: Return Advert Details
    Backend->>Frontend: Return Advert Details
    Frontend->>User: Display Advert Details

    User->>Frontend: Request Department List
    Frontend->>Backend: DEPARTMENT_QUERY with OfficialJournalOfIcelandAdvertSingleParams
    Backend->>Database: Fetch Department List
    Database->>Backend: Return Department List
    Backend->>Frontend: Return Department List
    Frontend->>User: Display Department List

    User->>Frontend: Navigate to Regular Signature
    Frontend->>Frontend: Render RegularSignature Component
    Frontend->>User: Display RegularSignature Form
Loading

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.
    • @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 as 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.

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.

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

Outside diff range and nitpick comments (2)
libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts (1)

40-49: Consider replacing console.log and console.error with a more robust logging framework.

libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx (1)

Line range hint 71-71: Specify button type to prevent form submission.

- <button onClick={closeModal}>
+ <button type="button" onClick={closeModal}>

Ensure that the button does not inadvertently submit forms by explicitly setting its type to "button".

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dbef0de and 37ea836.

Files selected for processing (20)
  • apps/web/screens/queries/OfficialJournalOfIceland.ts (1 hunks)
  • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts (3 hunks)
  • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.response.ts (2 hunks)
  • libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts (1 hunks)
  • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts (3 hunks)
  • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts (3 hunks)
  • libs/application/templates/official-journal-of-iceland/src/components/htmlEditor/HTMLEditor.css.ts (1 hunks)
  • libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx (4 hunks)
  • libs/application/templates/official-journal-of-iceland/src/components/signatures/Signatures.css.ts (1 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/Advert.css.ts (2 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx (8 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx (4 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/Preview.tsx (2 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/Publishing.tsx (7 hunks)
  • libs/application/templates/official-journal-of-iceland/src/fields/Summary.tsx (1 hunks)
  • libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts (2 hunks)
  • libs/application/templates/official-journal-of-iceland/src/lib/constants.ts (1 hunks)
  • libs/application/templates/official-journal-of-iceland/src/lib/dataSchema.ts (2 hunks)
  • libs/clients/official-journal-of-iceland/public/src/clientConfig.json (31 hunks)
  • libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • libs/application/templates/official-journal-of-iceland/src/components/htmlEditor/HTMLEditor.css.ts
  • libs/clients/official-journal-of-iceland/public/src/clientConfig.json
Additional context used
Path-based instructions (18)
libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/Advert.css.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/official-journal-of-iceland/src/lib/models/advert.response.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/components/signatures/Signatures.css.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/lib/constants.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/Summary.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/Preview.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/web/screens/queries/OfficialJournalOfIceland.ts (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."
libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/lib/dataSchema.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/Publishing.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts

[error] 35-35: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 42-42: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 49-49: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 56-56: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 63-63: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 70-70: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 77-77: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 84-84: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 91-91: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx

[error] 71-71: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

Additional comments not posted (43)
libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts (1)

1-7: LGTM! The AdvertSingleParams class is well-defined with appropriate GraphQL decorators.

libs/application/templates/official-journal-of-iceland/src/fields/Advert.css.ts (2)

4-11: Responsive design improvements in inputWrapper are well-implemented.


32-34: Enhancements to the modal style improve usability by enabling vertical scrolling and setting a specific height.

libs/api/domains/official-journal-of-iceland/src/lib/models/advert.response.ts (2)

13-15: Addition of type field in AdvertTypeResponse enhances data specificity.


46-48: Addition of department field in AdvertDepartmentResponse improves data handling.

libs/clients/official-journal-of-iceland/public/src/lib/officialJournalOfIcelandClient.service.ts (1)

27-29: New methods department and type are correctly implemented for API interactions.

Also applies to: 35-37

libs/application/templates/official-journal-of-iceland/src/components/signatures/Signatures.css.ts (3)

29-33: Responsive design adjustment for smaller screens is correctly implemented.


40-44: Responsive design adjustment for smaller screens is correctly implemented.


59-60: Styling adjustments for the remove button are appropriate for maintaining layout consistency.

libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts (4)

28-30: Method update aligns with the new data model changes.


46-48: Method update aligns with the new data model changes.


50-50: Method update correctly handles the new structure for multiple types.


58-58: Method update improves data handling by mapping advert status.

libs/application/templates/official-journal-of-iceland/src/fields/Summary.tsx (2)

6-6: Updated GraphQL queries are correctly implemented to match backend changes.

Also applies to: 33-33


41-42: Improved date handling logic using MINIMUM_WEEKDAYS enhances the accuracy of date estimations.

Also applies to: 62-64

libs/application/templates/official-journal-of-iceland/src/fields/Preview.tsx (3)

16-16: Ensure that the TYPE_QUERY is correctly defined and matches the expected GraphQL schema.

Verification successful

The TYPE_QUERY is correctly defined in the queries.ts file and is used appropriately in the Preview.tsx file to fetch data related to AdvertType. The query is executed using the useQuery hook from Apollo Client, and the fetched data is utilized within the component.

  • TYPE_QUERY is defined in queries.ts and matches the expected GraphQL schema.
  • TYPE_QUERY is imported and used correctly in Preview.tsx.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the definition of `TYPE_QUERY` in the GraphQL queries file.
cat libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts | grep -A 10 "export const TYPE_QUERY"

Length of output: 396



Script:

#!/bin/bash
# Description: Verify the usage of `TYPE_QUERY` in the Preview.tsx file.
grep -A 10 "TYPE_QUERY" libs/application/templates/official-journal-of-iceland/src/fields/Preview.tsx

Length of output: 543


23-31: Check the data structure used in the useQuery response to ensure it matches the expected schema, especially the officialJournalOfIcelandType field.

Verification successful

The TYPE_QUERY definition in libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts matches the expected schema structure used in the useQuery hook. The officialJournalOfIcelandType field contains a nested type field with the title property.

  • libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts:
    export const TYPE_QUERY = gql`
      query AdvertType($params: OfficialJournalOfIcelandAdvertSingleParams!) {
        officialJournalOfIcelandType(params: $params) {
          type {
            id
            title
            slug
            department {
              id
              title
              slug
            }
          }
        }
      }
    `
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the data structure returned by `TYPE_QUERY`.
ast-grep --lang typescript --pattern $'query TYPE_QUERY {
  $$$
  officialJournalOfIcelandType {
    type {
      title
    }
  }
}'

Length of output: 648



Script:

#!/bin/bash
# Description: Verify the data structure returned by `TYPE_QUERY`.
ast-grep --lang graphql --pattern $'{
  officialJournalOfIcelandType {
    type {
      title
    }
  }
}'

Length of output: 222



Script:

#!/bin/bash
# Description: Locate the definition of `TYPE_QUERY` and verify its structure.
rg 'TYPE_QUERY' --glob '*.graphql' --glob '*.ts' --glob '*.tsx'

Length of output: 700



Script:

#!/bin/bash
# Description: Display the contents of the file containing the `TYPE_QUERY` definition.
cat libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts

Length of output: 3775


66-66: Confirm that the type variable is being used correctly within the HTMLEditor component and that it aligns with the expected data types and structure.

libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts (3)

61-65: Check that the type method is correctly implemented and matches the service method it calls.

Verification successful

The type method in the OfficialJournalOfIcelandResolver correctly calls the type method in the OfficialJournalOfIcelandService, which in turn calls the type method in the OfficialJournalOfIcelandClientService. This chain of method calls appears to be correctly implemented.

  • OfficialJournalOfIcelandResolver calls this.ojoiService.type(params).
  • OfficialJournalOfIcelandService calls this.ojoiService.type(params).

No issues were found with the implementation of the type method in the resolver or the service.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `type` method in the resolver.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandResolver {
  $$$
  type($_) {
    return this.ojoiService.type($_)
  }
  $$$
}'

Length of output: 8314



Script:

#!/bin/bash
# Description: Verify the `type` method in the OfficialJournalOfIcelandService.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandService {
  $$$
  type($_) {
    $$$
  }
  $$$
}'

Length of output: 7956

Tools
Biome

[error] 63-63: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


35-35: Ensure that the advert method correctly handles the AdvertSingleParams and aligns with the service method it calls.

Verification successful

The advert method in the OfficialJournalOfIcelandService class was located and it appears to handle the AdvertSingleParams correctly. Here are the relevant lines from the search results:

  • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts: async advert(params: AdvertSingleParams): Promise<AdvertResponse> {
  • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts: const { advert } = await this.ojoiService.advert(params)

This confirms that the advert method in the resolver correctly calls the service method and handles the AdvertSingleParams.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `advert` method in the resolver.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandResolver {
  $$$
  advert($_) {
    return this.ojoiService.advert($_)
  }
  $$$
}'

Length of output: 8318



Script:

#!/bin/bash
# Description: Locate and review the `advert` method in the `OfficialJournalOfIcelandService` class.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandService {
  $$$
  advert($_) {
    $$$
  }
  $$$
}'

Length of output: 121



Script:

#!/bin/bash
# Description: Search for the `advert` method across all TypeScript files.
rg 'advert' --type ts

Length of output: 32763

Tools
Biome

[error] 35-35: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


7-21: Confirm that all newly imported models are used correctly in the resolver methods and match the expected GraphQL schema.

Verification successful

The newly imported models are correctly used in the resolver methods:

  • AdvertSingleParams is used in the advert and department methods.
  • AdvertsInput is used in the adverts method.
  • AdvertResponse, AdvertsResponse, and AdvertDepartmentResponse are used as return types for the respective methods.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of new models in resolver methods.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandResolver {
  $$$
  @Query($_) {
    $$$
  }
  $$$
}'

Length of output: 626



Script:

#!/bin/bash
# Description: Verify the usage of new models in resolver methods.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandResolver {
  @Query($_) {
    $$$
  }
}'

Length of output: 602



Script:

#!/bin/bash
# Description: Verify the usage of new models in resolver methods.
ast-grep --lang typescript --pattern $'class OfficialJournalOfIcelandResolver {
  $_($_) {
    $$$
  }
}'

Length of output: 106



Script:

#!/bin/bash
# Description: Search for the OfficialJournalOfIcelandResolver class and its methods.
rg 'class OfficialJournalOfIcelandResolver' -A 20

Length of output: 2590

libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts (2)

20-22: Confirm that the pageSize field is correctly added to the AdvertsInput class and is used appropriately in queries.

Verification successful

The pageSize field is correctly added to the AdvertsInput class in the advert.input.ts file. Additionally, the pageSize field is used in various parts of the codebase, including GraphQL queries and other TypeScript files.

  • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts: The pageSize field is defined within the AdvertsInput class.
  • Multiple instances of pageSize usage across the codebase, confirming its integration.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `pageSize` in GraphQL queries.
ast-grep --lang typescript --pattern $'class AdvertsInput {
  $$$
  pageSize: $_,
  $$$
}'

Length of output: 91



Script:

#!/bin/bash
# Locate the AdvertsInput class definition
ast-grep --lang typescript --pattern 'class AdvertsInput { $$$ }'

# Verify the presence of the pageSize field within the AdvertsInput class
ast-grep --lang typescript --pattern 'class AdvertsInput { $$$ pageSize?: number $$$ }'

# Search for the usage of the pageSize field in GraphQL queries
rg 'pageSize' --type ts

Length of output: 23419


Line range hint 54-69: Ensure that the new AdvertSingleParams class and the updated QueryParams class are correctly defined and used in GraphQL queries.

Verification successful

The AdvertSingleParams and QueryParams classes are correctly defined and used in the codebase. Here are the relevant locations:

  • AdvertSingleParams class:

    • Definition:
      • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts
      • libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts
    • Usage:
      • libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts
      • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts
      • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts
      • apps/web/screens/queries/OfficialJournalOfIceland.ts
  • QueryParams class:

    • Definition:
      • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts
    • Usage:
      • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.service.ts
      • libs/api/domains/official-journal-of-iceland/src/lib/officialJournalOfIceland.resolver.ts

The classes are correctly defined and used in the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the new `AdvertSingleParams` class and the updated `QueryParams` class.
ast-grep --lang typescript --pattern $'@InputType($_) {
  $$$
  class AdvertSingleParams {
    $$$
  }
  $$$
  class QueryParams {
    $$$
  }
  $$$
}'

Length of output: 686



Script:

#!/bin/bash
# Verify the presence and definition of the AdvertSingleParams class
ast-grep --lang typescript --pattern $'@InputType($_) class AdvertSingleParams { $$$ }'

# Verify the presence and definition of the QueryParams class
ast-grep --lang typescript --pattern $'@InputType($_) class QueryParams { $$$ }'

Length of output: 170



Script:

#!/bin/bash
# Search for the definition of the AdvertSingleParams class
rg 'class AdvertSingleParams' --typescript

# Search for the definition of the QueryParams class
rg 'class QueryParams' --typescript

# Search for the usage of AdvertSingleParams in GraphQL queries
rg 'AdvertSingleParams' --typescript

# Search for the usage of QueryParams in GraphQL queries
rg 'QueryParams' --typescript

Length of output: 1897



Script:

#!/bin/bash
# Search for the definition of the AdvertSingleParams class
rg 'class AdvertSingleParams' --type ts

# Search for the definition of the QueryParams class
rg 'class QueryParams' --type ts

# Search for the usage of AdvertSingleParams in GraphQL queries
rg 'AdvertSingleParams' --type ts

# Search for the usage of QueryParams in GraphQL queries
rg 'QueryParams' --type ts

Length of output: 13090

apps/web/screens/queries/OfficialJournalOfIceland.ts (1)

40-40: Ensure that the ADVERT_QUERY is correctly updated to use the OfficialJournalOfIcelandAdvertSingleParams and matches the expected GraphQL schema.

Verification successful

The OfficialJournalOfIcelandAdvertSingleParams input type is correctly defined in the GraphQL schema files single.input.ts and advert.input.ts. The ADVERT_QUERY in OfficialJournalOfIceland.ts is correctly using this input type.

  • libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts
  • libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the definition of `ADVERT_QUERY` in the GraphQL queries file.
cat apps/web/screens/queries/OfficialJournalOfIceland.ts | grep -A 20 "export const ADVERT_QUERY"

Length of output: 545



Script:

#!/bin/bash
# Description: Verify the definition of `OfficialJournalOfIcelandAdvertSingleParams` in the GraphQL schema files.
rg "OfficialJournalOfIcelandAdvertSingleParams" --type graphql

Length of output: 94



Script:

#!/bin/bash
# Description: Verify the definition of `OfficialJournalOfIcelandAdvertSingleParams` in the GraphQL schema files.
rg "OfficialJournalOfIcelandAdvertSingleParams"

Length of output: 898



Script:

#!/bin/bash
# Description: Display the definition of `OfficialJournalOfIcelandAdvertSingleParams` in `single.input.ts` and `advert.input.ts`.
rg --context 10 "@InputType('OfficialJournalOfIcelandAdvertSingleParams')" libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts

Length of output: 234



Script:

#!/bin/bash
# Description: Display the definition of `OfficialJournalOfIcelandAdvertSingleParams` in `single.input.ts` and `advert.input.ts`.
rg "@InputType('OfficialJournalOfIcelandAdvertSingleParams')" libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts

Length of output: 221



Script:

#!/bin/bash
# Description: Display the definition of `OfficialJournalOfIcelandAdvertSingleParams` in `single.input.ts` and `advert.input.ts`.
rg "OfficialJournalOfIcelandAdvertSingleParams" libs/api/domains/official-journal-of-iceland/src/lib/models/single.input.ts libs/api/domains/official-journal-of-iceland/src/lib/models/advert.input.ts

Length of output: 465

libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts (2)

60-60: Update GraphQL query parameter type to match new input model.

The change from OfficialJournalOfIcelandAdvertQuery to OfficialJournalOfIcelandAdvertSingleParams aligns with the updated GraphQL schema and input model requirements.


133-160: Add new GraphQL queries for department and type.

The addition of DEPARTMENT_QUERY and TYPE_QUERY with the new OfficialJournalOfIcelandAdvertSingleParams parameter type is consistent with the changes in the data model and will support more granular data fetching.

libs/application/templates/official-journal-of-iceland/src/fields/AdvertModal.tsx (3)

7-7: Add pagination to the advert modal.

The inclusion of the Pagination component enhances UX by allowing users to navigate through large sets of data efficiently.


Line range hint 38-50: Implement state management for pagination and search.

The use of useState for managing page and search states, along with the debounced search function, provides a responsive and efficient user interaction in the advert modal.


113-129: Integrate pagination component into the UI.

The integration of the Pagination component within the modal's UI allows for a seamless and intuitive navigation experience for the end-users.

libs/application/templates/official-journal-of-iceland/src/lib/dataSchema.ts (2)

31-34: Make fields optional in the advert schema.

Changing these fields to optional in the advert schema aligns with the requirements to make the application more flexible and user-friendly by reducing the number of mandatory fields.


180-186: Update publishing schema to make fields optional.

The modifications to make date and contentCategories optional in the publishing schema are appropriate, providing flexibility in data entry and aligning with the less stringent data collection requirements.

libs/application/templates/official-journal-of-iceland/src/fields/Publishing.tsx (3)

59-67: Implement logic to calculate the minimum and default dates.

The logic to set minDate and defaultDate based on current time and predefined business rules (like adding weekdays) is a good practice for ensuring data validity and enhancing user experience.


93-93: Set a large page size for category fetching.

Setting a large pageSize for fetching categories ensures that all possible categories are retrieved in a single query, reducing the need for pagination and simplifying the UI logic.


197-197: Set default values and constraints for the date picker.

Configuring the DatePickerController with default values and constraints such as minDate and maxDate ensures that the user input is valid and within the expected range.

libs/application/templates/official-journal-of-iceland/src/fields/Advert.tsx (7)

25-25: Import statement for styles added.

This change is straightforward and necessary for applying the new styles.


45-53: Refactored the departments array to exclude departments with the slug 'tolublod'.

This change effectively filters out unwanted departments, improving the data quality presented to the user.


109-116: Added an onCompleted callback to the GraphQL query to update the types state.

This is a good use of the onCompleted callback to ensure state is updated only after the query completes successfully.


Line range hint 173-190: Enhanced the department selection UI with new styling and logic to reset the type when a new department is selected.

This change improves user experience by ensuring that irrelevant types are cleared when the department changes.


197-205: Conditional rendering added for loading state in the type selection UI.

Proper handling of loading states enhances user experience by providing feedback during data fetching.


Line range hint 241-261: Added a new input field for the advertisement template with dynamic updating.

This addition allows users to specify a template for the advertisement, enhancing the flexibility of the advertisement creation process.


261-261: Integration of the HTMLEditor component for the document field.

This integration allows for rich text editing of the document field, which is a significant usability improvement.

libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx (2)

155-192: Updated UI components for institution and date inputs with improved styling and error handling.

These changes enhance the clarity and usability of the form inputs, aligning with the overall design improvements.


Line range hint 226-271: Enhanced member input handling with new UI components and error management.

The updates provide a more robust and user-friendly interface for managing signature details, improving error visibility and interaction.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 37ea836 and 1d7c1f3.

Files selected for processing (1)
  • libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/official-journal-of-iceland/src/components/signatures/Regular.tsx

@jonbjarnio
Copy link
Member Author

@coderabbitai resolve

Copy link
Contributor

coderabbitai bot commented Jun 6, 2024

Actions performed

Comments resolved and changes approved.

@jonbjarnio jonbjarnio added the automerge Merge this PR as soon as all checks pass label Jun 6, 2024
@datadog-island-is
Copy link

datadog-island-is bot commented Jun 6, 2024

Datadog Report

All test runs 3a3fe13 🔗

9 Total Test Services: 0 Failed, 9 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.02%), 20 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 4.57s 1 no change Link
application-system-api 0 0 0 111 2 4m 12.78s 1 decreased (-0.02%) Link
application-template-api-modules 0 0 0 109 0 2m 45.63s 1 no change Link
application-templates-financial-aid 0 0 0 11 0 40.88s 1 no change Link
application-ui-shell 0 0 0 74 0 1m 11.54s 1 no change Link
financial-aid-backend 0 0 0 219 0 1m 29.91s 1 no change Link
financial-aid-shared 0 0 0 29 0 17.07s 1 no change Link
services-auth-personal-representative 0 0 0 59 0 1m 18.55s 1 no change Link
web 0 0 0 84 0 30.93s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • application-system-api - jest 37.65% (-0.02%) - Details

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 25 lines in your changes missing coverage. Please review.

Project coverage is 37.08%. Comparing base (3a44dfe) to head (c9feefb).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15130      +/-   ##
==========================================
+ Coverage   37.06%   37.08%   +0.02%     
==========================================
  Files        6422     6420       -2     
  Lines      130903   130728     -175     
  Branches    37406    37331      -75     
==========================================
- Hits        48515    48487      -28     
+ Misses      82388    82241     -147     
Flag Coverage Δ
api 3.44% <ø> (ø)
financial-aid-backend 56.34% <ø> (ø)
financial-aid-shared 18.70% <ø> (ø)
services-auth-personal-representative 48.50% <ø> (ø)
web 1.93% <ø> (ø)

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

Files Coverage Δ
...ps/web/screens/queries/OfficialJournalOfIceland.ts 0.00% <ø> (ø)
...-journal-of-iceland/src/lib/models/advert.input.ts 57.83% <60.00%> (-0.40%) ⬇️
...urnal-of-iceland/src/lib/models/advert.response.ts 64.28% <66.66%> (+0.39%) ⬆️
...eland/src/lib/officialJournalOfIceland.resolver.ts 51.35% <42.85%> (-3.49%) ⬇️
...celand/src/lib/officialJournalOfIceland.service.ts 17.85% <0.00%> (-2.98%) ⬇️
.../src/lib/officialJournalOfIcelandClient.service.ts 14.81% <0.00%> (-7.41%) ⬇️

... and 28 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 3a44dfe...c9feefb. Read the comment docs.

@kodiakhq kodiakhq bot merged commit d4b8568 into main Jun 6, 2024
48 checks passed
@kodiakhq kodiakhq bot deleted the fix/ojoi-application-demo-bugs branch June 6, 2024 15:03
sigruntg pushed a commit that referenced this pull request Jun 12, 2024
* Fixing UI bugs

* Updating client - adding single department and type

* Fixing rest of the ubgs

* Fixing position on inputs

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
lodmfjord pushed a commit that referenced this pull request Jun 14, 2024
* Fixing UI bugs

* Updating client - adding single department and type

* Fixing rest of the ubgs

* Fixing position on inputs

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
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.

4 participants