-
Notifications
You must be signed in to change notification settings - Fork 61
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(web): grant slice for articles #17262
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces a comprehensive enhancement to the grant cards functionality across multiple files in the project. The changes include adding a new Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Datadog ReportAll test runs ✅ 10 Total Test Services: 0 Failed, 9 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (4) |
Affected services are: air-discount-scheme-api,api,application-system-api,financial-aid-api,financial-aid-backend,financial-aid-open-api,judicial-system-api,judicial-system-backend,services-auth-personal-representative,services-search-indexer,services-user-notification,air-discount-scheme-web,consultation-portal,contentful-apps,financial-aid-web-osk,financial-aid-web-veita,judicial-system-web,skilavottord-web,web,application-system-form,island-ui-storybook,portals-admin,service-portal,system-e2e, Deployed services: application-system-api,application-system-form,service-portal,portals-admin,consultation-portal,api,web,skilavottord-web,island-ui-storybook,air-discount-scheme-web,air-discount-scheme-api,application-system-api-worker,services-bff-portals-admin,services-bff-portals-my-pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor date format comment otherwise 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
apps/web/screens/queries/fragments.ts (1)
Line range hint
1-1200
: Remove duplicateEmbedFields
fragment.The
EmbedFields
fragment appears twice in the file. This could lead to GraphQL validation errors.Remove one of the duplicate fragments to ensure proper GraphQL schema validation.
🧹 Nitpick comments (9)
apps/web/components/GrantCardsList/GrantCardsList.tsx (4)
1-6
: Ensure NextJS/React import usage adheres to best practices.Even though this is a client-side component, you may consider whether any SSR or SSG approach could enhance performance or SEO. However, for an exclusively dynamic component, depending on user interaction (like a router push), this pattern looks fine.
23-36
: Provide a more descriptive error message.Catching an exception within the date formatter is good, but “Error formatting date” is too generic. Providing the date or a mention of the failing locale may help with debugging.
111-126
: Provide a fallback UI for single-item scenario.Rendering a single ActionCard is a great approach. Consider how it handles situations where the
Grant
data might be missing essential fields likename
. Currently, the card would render with an empty heading. Handling empty states explicitly can promote consistent UX.
128-184
: Validate date fields before formatting.When mapping over grants, deeper validation before calling
format(...)
may prevent runtime errors ifgrant.dateFrom
orgrant.dateTo
isn’t a valid ISO string. A quick check for valid dates or try/catch around format calls would be safer.libs/cms/src/lib/models/grantCardsList.model.ts (2)
12-17
: Consider adding descriptions to enum valuesThe
CardSorting
enum would benefit from GraphQL descriptions to improve API documentation.enum CardSorting { + @Field({ description: 'Sort grants alphabetically by title' }) ALPHABETICAL, + @Field({ description: 'Sort grants by most recently updated first' }) MOST_RECENTLY_UPDATED_FIRST, }
37-55
: LGTM with minor enhancement suggestionThe mapping function is well-structured and handles nullable fields appropriately. Consider adding input validation for required fields.
export const mapGrantCardsList = ({ fields, sys, }: IGrantCardsList): SystemMetadata<GrantCardsList> => { + if (!fields.grantCardListTitle) { + throw new Error('Grant card list title is required'); + } + return { // ... rest of the implementation } }libs/cms/src/lib/search/importers/grants.service.ts (1)
102-107
: Consider extracting tag creation logic.The tag creation logic is repeated across different tag types. Consider extracting this into a helper function to improve maintainability and reduce duplication.
+const createTag = (type: string, key: string, value?: string) => ({ + type, + key, + value, +}); -tags.push({ - type: 'organization', - key: mapped.fund.parentOrganization.slug, - value: mapped.fund.parentOrganization.title, -}); +tags.push(createTag( + 'organization', + mapped.fund.parentOrganization.slug, + mapped.fund.parentOrganization.title +));libs/cms/src/lib/cms.resolver.ts (2)
863-875
: Optimize the input validation condition.The condition can be simplified by removing the redundant optional chaining operator.
- if (!input || input?.size === 0) { + if (!input || input.size === 0) {
879-879
: Fix typo in variable name.There's a typo in the variable name 'respones'.
- const respones = await this.cmsContentfulService.getNamespace( + const response = await this.cmsContentfulService.getNamespace(
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
libs/cms/src/lib/generated/contentfulTypes.d.ts
is excluded by!**/generated/**
📒 Files selected for processing (15)
apps/tools/contentful-role-permissions/constants/index.ts
(1 hunks)apps/web/components/GrantCardsList/GrantCardsList.tsx
(1 hunks)apps/web/components/GrantCardsList/index.ts
(1 hunks)apps/web/components/GrantCardsList/types.ts
(1 hunks)apps/web/screens/Home/Home.tsx
(1 hunks)apps/web/screens/queries/fragments.ts
(2 hunks)apps/web/utils/richText.tsx
(3 hunks)libs/cms/src/lib/cms.elasticsearch.service.ts
(2 hunks)libs/cms/src/lib/cms.module.ts
(2 hunks)libs/cms/src/lib/cms.resolver.ts
(2 hunks)libs/cms/src/lib/dto/getGrants.input.ts
(1 hunks)libs/cms/src/lib/models/grantCardsList.model.ts
(1 hunks)libs/cms/src/lib/search/importers/grants.service.ts
(1 hunks)libs/cms/src/lib/unions/slice.union.ts
(5 hunks)libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/web/components/GrantCardsList/index.ts
🧰 Additional context used
📓 Path-based instructions (14)
libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.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."
apps/tools/contentful-role-permissions/constants/index.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/cms/src/lib/dto/getGrants.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/components/GrantCardsList/types.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/cms/src/lib/cms.module.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/cms/src/lib/search/importers/grants.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."
apps/web/screens/queries/fragments.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."
apps/web/utils/richText.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."
libs/cms/src/lib/models/grantCardsList.model.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/cms/src/lib/cms.elasticsearch.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."
apps/web/components/GrantCardsList/GrantCardsList.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/Home/Home.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."
libs/cms/src/lib/cms.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/cms/src/lib/unions/slice.union.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."
🔇 Additional comments (18)
libs/cms/src/lib/dto/getGrants.input.ts (1)
47-50
: Optional field introduced—validate upstream usage.
The newly added 'funds' field allows multiple string entries. Ensure the resolver and service logic handle empty arrays or undefined values gracefully.
✅ Verification successful
Let me analyze the code further to verify the handling of the optional funds
field.
Based on the previous outputs, I can now generate a final response since we have seen:
- The elasticsearch service properly handles the optional
funds
field with a conditional check (if (funds)
) before using it in the query - The resolver simply passes the input to the elasticsearch service
- The field is properly decorated with
@IsOptional()
and@IsArray()
validations
Optional field is properly handled
The newly added funds
field is correctly implemented with proper validation decorators and the service layer handles the optional nature of the field appropriately. The elasticsearch query is constructed conditionally when the field is present, ensuring graceful handling of empty arrays or undefined values.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Searching the codebase for all references to `funds` usage in the relevant grants resolver/service.
rg -A 4 "funds"
Length of output: 21577
Script:
#!/bin/bash
# Let's check the implementation of the grants resolver and service
ast-grep --pattern 'class $_ {
$$$
getGrants($$$) {
$$$
}
$$$
}'
Length of output: 78
Script:
#!/bin/bash
# Let's check the elasticsearch service implementation for handling funds
rg -A 10 "getGrants.*Input" --type ts
Length of output: 746
apps/tools/contentful-role-permissions/constants/index.ts (1)
38-38
: Confirm alignment with Contentful entry type.
The grantCardsList
entry is now editable. Verify that there’s a corresponding content type in Contentful and that necessary permissions are in place.
✅ Verification successful
Content type and permissions are properly configured
Based on the generated Contentful type definitions, the grantCardsList
content type is properly defined in Contentful with all necessary fields including title, display options, funds relationship, max number of cards, and sorting preferences. The type is correctly integrated into the codebase with proper model definitions and resolvers.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Attempt to locate references to `grantCardsList` in the code, ensuring usage is consistent.
rg -A 3 "grantCardsList"
Length of output: 3115
Script:
#!/bin/bash
# Let's check the contentful type definition for grantCardsList
ast-grep --pattern 'interface IGrantCardsList {
$$$
}'
Length of output: 58
Script:
#!/bin/bash
# Let's check the contentful type definition in the generated types file
cat libs/cms/src/lib/generated/contentfulTypes.d.ts | grep -A 20 "export interface IGrantCardsList"
Length of output: 915
libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx (1)
57-57
: Verify design system color token usage
The change from "white" to "blue200" affects all instances of InfoCard. Ensure this change is intentional and aligns with the design system.
✅ Verification successful
Change to blue200 border color aligns with design system
The change from "white" to "blue200" is consistent with the design system's color tokens. The blue200
color is widely used across the codebase for borders, particularly in UI components that require subtle emphasis or structure. This color token is defined in the theme system and is used consistently for similar UI patterns.
Key findings from the codebase:
blue200
is a standard border color token defined in the theme system- It's commonly used for borders in card-like components and interactive elements
- The color is part of the established design system, appearing in multiple UI libraries and applications
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other components using InfoCard to assess impact
rg -l "InfoCard" --type tsx
# Check for other uses of blue200 color token
rg "blue200" --type tsx
Length of output: 107
Script:
#!/bin/bash
# Search for other components using InfoCard to assess impact
rg -l "InfoCard"
# Check for other uses of blue200 color token
rg "blue200"
# Check design system color tokens
fd "colors" --type f
Length of output: 41680
libs/cms/src/lib/cms.module.ts (1)
12-12
: Verify resolver dependencies and initialization order
The GrantCardsListResolver
is correctly added to both imports and providers. However, verify that there are no circular dependencies with other resolvers.
Also applies to: 45-45
✅ Verification successful
Let me gather more information about potential circular dependencies.
Let me check for any potential circular dependencies in the resolver implementation.
Based on the analysis of the codebase, I can now provide the final response:
No circular dependencies or initialization order issues found
The GrantCardsListResolver
is properly implemented with:
- Clean dependency injection of required services (
cmsElasticsearchService
andcmsContentfulService
) - No circular imports or dependencies detected
- Proper resolver field implementations with appropriate error handling
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for GrantCardsListResolver dependencies
rg "GrantCardsListResolver" --type ts
# Check for circular imports
ast-grep --pattern 'import { $_ } from "./cms.resolver"'
Length of output: 283
Script:
#!/bin/bash
# Check the content of cms.resolver.ts to see its dependencies
cat libs/cms/src/lib/cms.resolver.ts
# Look for any imports in the resolver file
ast-grep --pattern 'import { $_ } from "$_"' libs/cms/src/lib/cms.resolver.ts
Length of output: 33272
Script:
#!/bin/bash
# Check for GrantCardsListResolver implementation and its dependencies
ast-grep --pattern 'class GrantCardsListResolver {
$$$
}'
# Check for any imports of GrantCardsListResolver in other files
rg "import.*GrantCardsListResolver" --type ts
Length of output: 2302
apps/web/screens/Home/Home.tsx (1)
1-32
: LGTM! Clean and well-organized imports.
The import statements are properly organized and follow TypeScript best practices with explicit type imports.
libs/cms/src/lib/search/importers/grants.service.ts (1)
94-100
: LGTM! Well-structured fund tagging implementation.
The new fund tagging logic is properly implemented with type safety and follows the existing tag structure pattern.
apps/web/utils/richText.tsx (2)
69-69
: LGTM! Clean integration of GrantCardsList.
The import statements and type definitions are properly organized and follow the established pattern.
Also applies to: 95-95
295-297
: LGTM! Consistent component mapping implementation.
The GrantCardsList component is properly integrated into the defaultRenderComponent object, following the existing pattern for slice rendering.
libs/cms/src/lib/unions/slice.union.ts (4)
51-51
: LGTM: Import declarations follow the established pattern.
The imports are correctly organized, following the same pattern as other slice types in the file.
Also applies to: 149-152
199-199
: LGTM: SliceTypes union is properly extended.
The IGrantCardsList
type is correctly added to the union type.
253-253
: LGTM: SliceUnion type array is properly updated.
The GrantCardsList
type is correctly added to the types array.
351-352
: LGTM: mapSliceUnion function is properly extended.
The new case for 'grantCardsList' is correctly added with proper type casting.
apps/web/screens/queries/fragments.ts (1)
795-851
: LGTM: GraphQL fragment is well-structured and comprehensive.
The fragment includes all necessary fields for grants, funds, and organizations, following GraphQL best practices.
libs/cms/src/lib/cms.elasticsearch.service.ts (3)
619-619
: LGTM: Method signature properly updated.
The funds
parameter is correctly added to the method signature.
709-719
: LGTM: Organization tags query is well-structured.
The nested query for organization tags follows Elasticsearch best practices.
Line range hint 721-738
: LGTM: Fund tags query implementation is correct.
The nested query for fund tags follows the same pattern as other tag filters and properly implements the fund filtering functionality.
✅ Verification successful
Let me gather more context about the tag implementation to ensure the fund tag filtering is consistent.
Let me search for more tag filtering implementations to ensure consistency.
Based on the search results, I can see that the tag filtering pattern is consistently implemented across the codebase. The fund tag query follows the same nested query structure as other tag types like 'genericTag', 'organization', 'referencedBy', etc. Each tag filter uses the same pattern of checking both the tag type and key/value in a nested query.
LGTM: Fund tag filtering implementation is consistent with other tag filters
The implementation correctly uses the nested query pattern with 'tags.type': 'fund' which matches the established pattern used for other tag types in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify the fund tag type usage in other files
rg -A 2 "tags\.type.*fund"
Length of output: 247
Script:
#!/bin/bash
# Search for tag type definitions and implementations
ast-grep --pattern 'tags: { type: $_ }'
# Also check for any tag-related interfaces or types
rg -A 5 "interface.*Tag"
rg -A 5 "type.*Tag"
# Look for other tag filtering implementations
ast-grep --pattern $'nested: {
path: "tags",
query: $$$
}'
Length of output: 114270
Script:
#!/bin/bash
# Search for tag type usage in queries
rg -A 5 "'tags\.type'.*:|'tags\.type'.*=>"
# Look for tag filtering in elasticsearch service
rg -A 10 "nested.*path: 'tags'" libs/cms/src/lib/cms.elasticsearch.service.ts
Length of output: 4856
libs/cms/src/lib/cms.resolver.ts (2)
139-139
: LGTM!
The import statement follows the established pattern and is correctly placed with other model imports.
855-861
: LGTM!
The resolver class follows the established pattern with:
- Proper decorator usage
- Correct dependency injection
- Consistent cache control configuration
There was a problem hiding this 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 comments (3)
apps/web/screens/Home/Home.tsx (3)
Line range hint
47-51
: Consider moving document language setting to an effect or layout componentThe document language setting should be handled in a useEffect or moved to a layout component to ensure proper side-effect management:
- if (typeof document === 'object') { - document.documentElement.lang = activeLocale - } + useEffect(() => { + if (typeof document === 'object') { + document.documentElement.lang = activeLocale + } + }, [activeLocale])
Line range hint
114-117
: Remove TypeScript ignore comment and fix the underlying type issueThe
@ts-ignore
comment should be addressed by properly typing the WatsonChatPanel component:Consider creating proper types for the WatsonChatPanel configuration:
interface WatsonConfig { // Add appropriate types based on the actual config [key in Locale]?: WatsonPanelProps }
Line range hint
121-185
: Add error handling and loading states for data fetchingThe current implementation lacks error handling for GraphQL queries. Consider implementing proper error boundaries and loading states:
Home.getProps = async ({ apolloClient, locale }) => { + try { const [ { data: { getArticleCategories } }, { data: { getNews: { items: news } } }, { data: { getFrontpage } } ] = await Promise.all([ // ... existing queries ... ]) return { // ... existing return ... } + } catch (error) { + console.error('Failed to fetch home page data:', error) + return { + news: [], + categories: [], + page: null, + showSearchInHeader: false, + locale: locale as Locale, + } + } }
🧹 Nitpick comments (5)
libs/cms/src/lib/models/grantCardsList.model.ts (3)
11-16
: Add descriptions for the enum valuesConsider adding descriptions to the enum registration for better API documentation.
-registerEnumType(CardSorting, { name: 'GrantCardsListSorting' }) +registerEnumType(CardSorting, { + name: 'GrantCardsListSorting', + description: 'Sorting options for grant cards', + valuesMap: { + ALPHABETICAL: { description: 'Sort grants alphabetically by title' }, + MOST_RECENTLY_UPDATED_FIRST: { description: 'Sort grants by their last update timestamp' } + } +})
29-30
: Improve type safety for resolvedGrantsListThe
resolvedGrantsList
field type could be more specific thanGetGrantsInput
.- @CacheField(() => GrantList, { nullable: true }) - resolvedGrantsList?: GetGrantsInput + @CacheField(() => GrantList, { nullable: true }) + resolvedGrantsList?: Pick<GetGrantsInput, 'lang' | 'funds' | 'size'>
46-49
: Enhance locale handling robustnessThe current locale handling assumes only 'is-IS' as a special case. Consider using a more maintainable approach.
- lang: - sys.locale === 'is-IS' - ? 'is' - : (sys.locale as ElasticsearchIndexLocale), + lang: mapLocaleToLang(sys.locale),Add this helper function:
const mapLocaleToLang = (locale: string): ElasticsearchIndexLocale => { const localeMap: Record<string, ElasticsearchIndexLocale> = { 'is-IS': 'is', // Add other locale mappings as needed }; return localeMap[locale] ?? (locale as ElasticsearchIndexLocale); };apps/web/screens/Home/Home.tsx (2)
4-22
: Consider strengthening TypeScript type safetyWhile the imports are well-organized, consider adding more specific types for the GraphQL queries to improve type safety:
- GetArticleCategoriesQuery, + GetArticleCategoriesQuery['getArticleCategories'], - GetFrontpageQuery, + GetFrontpageQuery['getFrontpage'],
Line range hint
35-41
: Add JSDoc documentation for the interfaceConsider adding JSDoc documentation to improve maintainability and developer experience:
+/** + * Props for the Home component + * @property {GetArticleCategoriesQuery['getArticleCategories']} categories - Article categories + * @property {GetNewsQuery['getNews']['items']} news - News items + * @property {GetFrontpageQuery['getFrontpage']} page - Frontpage data + * @property {Locale} locale - Current locale + */ interface HomeProps { categories: GetArticleCategoriesQuery['getArticleCategories'] news: GetNewsQuery['getNews']['items'] page: GetFrontpageQuery['getFrontpage'] locale: Locale }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/web/screens/Home/Home.tsx
(1 hunks)libs/cms/src/lib/models/grantCardsList.model.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/cms/src/lib/models/grantCardsList.model.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/Home/Home.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)
libs/cms/src/lib/models/grantCardsList.model.ts (3)
1-10
: LGTM! Clean and well-organized imports
The imports are properly structured and all dependencies are relevant for the functionality.
32-33
: Type safety improvement needed for namespace field
The namespace
field using GraphQLJSONObject
lacks type safety.
1-54
: Excellent adherence to libs directory guidelines
The implementation follows best practices for:
- Reusability: Clean model definition suitable for cross-app usage
- TypeScript: Strong typing with GraphQL integration
- Tree-shaking: Specific exports that enable effective bundling
apps/web/screens/Home/Home.tsx (1)
Line range hint 187-190
: LGTM! Layout wrapper implementation is correct
The use of withMainLayout HOC with proper configuration follows NextJS best practices.
There was a problem hiding this 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 comments (1)
apps/web/components/TableOfContents/TableOfContents.tsx (1)
Line range hint
13-15
: Technical Debt: Remove ts-ignore comment.The ts-ignore comment suggests there's a type safety issue that needs to be addressed. Consider fixing the underlying type issue instead of suppressing it.
Consider:
- Properly typing the
json
field in theSlice
interface- Using type guards to handle potential undefined values
- Adding proper null checks for the nested properties
Example approach:
interface SliceJson { title?: string; // add other potential json fields } // Then update the access to be type-safe: text: (slice.json as SliceJson)?.title ?? slice.title ?? slice.leftTitle ?? ''
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/components/TableOfContents/TableOfContents.tsx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/web/components/TableOfContents/TableOfContents.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."
What
GrantCardsList
Article
Why
Screenshots / Gifs
Checklist:
Summary by CodeRabbit
Release Notes
New Features
GrantCardsList
component for displaying grant cards.grantCardsList
, to the editable entry types.funds
to the grants input for filtering by funds.GrantCardsList
into the rendering logic for improved user experience.Bug Fixes
getSingleVacancy
method.Documentation
Style
InfoCard
component for improved visual consistency.