Skip to content

chore: add template syntax#1

Merged
santoshyadavdev merged 2 commits intomainfrom
santoshyadavdev/template-syntax
Feb 26, 2026
Merged

chore: add template syntax#1
santoshyadavdev merged 2 commits intomainfrom
santoshyadavdev/template-syntax

Conversation

@santoshyadavdev
Copy link
Owner

@santoshyadavdev santoshyadavdev commented Feb 25, 2026

Summary by CodeRabbit

  • New Features

    • Dashboard is now the main application view.
    • Dashboard lists hotels with names and locations; shows an empty-state message when none are available.
  • Tests

    • Added unit tests covering the Dashboard component.
  • Chores

    • CI configuration updated (build workflow adjustments and runtime version bump).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 1644604 and 5b18162.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • apps/hotelmanagement/src/app/dashboard/dashboard.html
 __________________________________________________________
< If your code was a carrot, I'd bury it and forget where. >
 ----------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

📝 Walkthrough

Walkthrough

The pull request introduces a new Dashboard component to the hotel management application and updates the main app template to display this dashboard instead of the welcome screen. The Dashboard component renders hotel information with basic properties like title, booking count, and a list of hotels with their details.

Changes

Cohort / File(s) Summary
App Shell Updates
apps/hotelmanagement/src/app/app.html, apps/hotelmanagement/src/app/app.ts
Replaced NxWelcome component with Dashboard component in the app template and updated component imports accordingly.
Dashboard Component
apps/hotelmanagement/src/app/dashboard/dashboard.ts, apps/hotelmanagement/src/app/dashboard/dashboard.html, apps/hotelmanagement/src/app/dashboard/dashboard.spec.ts
New Dashboard component with a local Hotel interface, public properties for title, bookings, and hotel list, an HTML template that conditionally displays hotels, and a basic unit test for component creation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

enhancement

Poem

🐰 A dashboard hops into view,
Where hotels greet me bright and new,
No welcome screen to slow me down—
Just bookings, names, a hotel town! 🏨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore: add template syntax' is vague and does not clearly reflect the main changes—replacing NxWelcome with a Dashboard component and implementing a hotel management dashboard interface. Use a more specific title like 'feat: implement hotel dashboard component' or 'chore: replace NxWelcome with Dashboard component' to better reflect the actual changes made.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch santoshyadavdev/template-syntax

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Feb 25, 2026
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.

🧹 Nitpick comments (5)
apps/hotelmanagement/src/app/dashboard/dashboard.html (2)

18-24: Remove stale commented-out code.

The legacy *ngFor block references hotels (should be hotelList), and hotel.image/hotel.description which don't exist on the Hotel interface. It also uses the old structural directive syntax that has been superseded. Clean this up before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.html` around lines 18 - 24,
Delete the stale commented-out block that contains the legacy *ngFor and
references to hotels, hotel.image and hotel.description; remove the entire
commented HTML snippet (do not attempt to resurrect it), and if the UI should
display a list ensure you implement or reference the current property name
hotelList and fields defined on the Hotel interface elsewhere instead of reusing
the old names.

5-16: Simplify with @for's built-in @empty block.

The outer @if guard is redundant — Angular's @for block directly supports an @empty section that is displayed when the collection is empty. Replace the @if + @for + @else combination with a single @for + @empty:

♻️ Proposed refactor
-@if (hotelList.length > 0) { `@for` (hotel of hotelList; track $index) {
+@for (hotel of hotelList; track $index) {
 <div class="hotel">
   ID:
   <p>{{$index + 1}}</p>
   Name:
   <h4>{{hotel.name}}</h4>
   Location:
   <p>{{hotel.location}}</p>
 </div>
-} } `@else` {
+} `@empty` {
 <h4>No hotels available.</h4>
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.html` around lines 5 - 16,
Remove the redundant outer `@if` check and convert the current `@for/`@else pattern
into a single `@for` block that uses `@empty`; specifically, replace the surrounding
"@if (hotelList.length > 0) { `@for` (hotel of hotelList; track $index) { ... } }
`@else` { <h4>No hotels available.</h4> }" with "@for (hotel of hotelList; track
$index) { ... } `@empty` { <h4>No hotels available.</h4> }", keeping the existing
template content that references hotel and $index unchanged.
apps/hotelmanagement/src/app/dashboard/dashboard.spec.ts (1)

13-16: Add fixture.detectChanges() before whenStable().

Without an explicit fixture.detectChanges() call, Angular's initial change detection cycle never runs — component template bindings are not evaluated and lifecycle hooks like ngOnInit are not triggered. whenStable() alone does not kick off change detection.

♻️ Proposed fix
 fixture = TestBed.createComponent(Dashboard);
 component = fixture.componentInstance;
+fixture.detectChanges();
 await fixture.whenStable();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.spec.ts` around lines 13 -
16, The test creates the component with TestBed.createComponent(Dashboard) but
never runs Angular's initial change detection; add an explicit
fixture.detectChanges() call immediately after creating the component (before
await fixture.whenStable()) so bindings and lifecycle hooks (e.g., ngOnInit)
execute; update the block around TestBed.createComponent(Dashboard), component =
fixture.componentInstance to call fixture.detectChanges() prior to awaiting
fixture.whenStable().
apps/hotelmanagement/src/app/dashboard/dashboard.ts (1)

16-23: numberOfBookings and dateOfLastBooking are declared but never rendered.

Both properties are initialised on the component but absent from dashboard.html. If they are intended as future placeholders, a short // TODO comment would clarify intent; otherwise consider removing them to avoid dead surface area.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.ts` around lines 16 - 23,
The properties numberOfBookings and dateOfLastBooking on the Dashboard component
are defined but never used in the template; either remove them to eliminate dead
surface area or make their intent explicit and/or render them: if they are
placeholders add a short TODO comment above each field in dashboard.ts
referencing numberOfBookings and dateOfLastBooking, otherwise remove the unused
fields, or update dashboard.html to display them (bind the values or
conditionally show dateOfLastBooking) so the component fields are actually
consumed.
apps/hotelmanagement/src/app/app.ts (1)

2-6: RouterModule is now unused.

app.html only renders <hm-dashboard> — there is no <router-outlet> or routerLink in the template, so RouterModule contributes nothing and can be dropped from both the import statement and the imports array.

♻️ Proposed fix
 import { Component } from '@angular/core';
-import { RouterModule } from '@angular/router';
 import { Dashboard } from './dashboard/dashboard';

 `@Component`({
-  imports: [ RouterModule, Dashboard],
+  imports: [Dashboard],
   selector: 'hm-root',
   templateUrl: './app.html',
   styleUrl: './app.css',
 })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/hotelmanagement/src/app/app.ts` around lines 2 - 6, Remove the unused
RouterModule import and its reference in the component metadata: delete the
RouterModule import line and remove RouterModule from the `@Component`({ imports:
[...] }) array (leave Dashboard in imports); verify app.html renders
<hm-dashboard> and no router-outlet/routerLink exists so RouterModule is
unnecessary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/hotelmanagement/src/app/app.ts`:
- Around line 2-6: Remove the unused RouterModule import and its reference in
the component metadata: delete the RouterModule import line and remove
RouterModule from the `@Component`({ imports: [...] }) array (leave Dashboard in
imports); verify app.html renders <hm-dashboard> and no router-outlet/routerLink
exists so RouterModule is unnecessary.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.html`:
- Around line 18-24: Delete the stale commented-out block that contains the
legacy *ngFor and references to hotels, hotel.image and hotel.description;
remove the entire commented HTML snippet (do not attempt to resurrect it), and
if the UI should display a list ensure you implement or reference the current
property name hotelList and fields defined on the Hotel interface elsewhere
instead of reusing the old names.
- Around line 5-16: Remove the redundant outer `@if` check and convert the current
`@for/`@else pattern into a single `@for` block that uses `@empty`; specifically,
replace the surrounding "@if (hotelList.length > 0) { `@for` (hotel of hotelList;
track $index) { ... } } `@else` { <h4>No hotels available.</h4> }" with "@for
(hotel of hotelList; track $index) { ... } `@empty` { <h4>No hotels
available.</h4> }", keeping the existing template content that references hotel
and $index unchanged.

In `@apps/hotelmanagement/src/app/dashboard/dashboard.spec.ts`:
- Around line 13-16: The test creates the component with
TestBed.createComponent(Dashboard) but never runs Angular's initial change
detection; add an explicit fixture.detectChanges() call immediately after
creating the component (before await fixture.whenStable()) so bindings and
lifecycle hooks (e.g., ngOnInit) execute; update the block around
TestBed.createComponent(Dashboard), component = fixture.componentInstance to
call fixture.detectChanges() prior to awaiting fixture.whenStable().

In `@apps/hotelmanagement/src/app/dashboard/dashboard.ts`:
- Around line 16-23: The properties numberOfBookings and dateOfLastBooking on
the Dashboard component are defined but never used in the template; either
remove them to eliminate dead surface area or make their intent explicit and/or
render them: if they are placeholders add a short TODO comment above each field
in dashboard.ts referencing numberOfBookings and dateOfLastBooking, otherwise
remove the unused fields, or update dashboard.html to display them (bind the
values or conditionally show dateOfLastBooking) so the component fields are
actually consumed.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21d696d and 1644604.

📒 Files selected for processing (6)
  • apps/hotelmanagement/src/app/app.html
  • apps/hotelmanagement/src/app/app.ts
  • apps/hotelmanagement/src/app/dashboard/dashboard.css
  • apps/hotelmanagement/src/app/dashboard/dashboard.html
  • apps/hotelmanagement/src/app/dashboard/dashboard.spec.ts
  • apps/hotelmanagement/src/app/dashboard/dashboard.ts

@santoshyadavdev santoshyadavdev merged commit 3f6730c into main Feb 26, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant