11import { Component , inject } from "@angular/core" ;
2- import { CommonModule } from "@angular/common" ;
32import { TranslateService } from "@ngx-translate/core" ;
43
54@Component ( {
65 selector : "app-hierarchy-viz" ,
7- standalone : true ,
8- imports : [ CommonModule ] ,
96 template : `
10- <div class="hierarchy-container">
11- <h3>Service Hierarchy</h3>
12- <div class="hierarchy-tree">
13- <ng-container *ngFor="let service of hierarchy; let last = last">
14- <div class="service-node" [class.current]="last">
15- <div class="node-icon">
16- <span *ngIf="service.isRoot; else childIcon">🏠</span>
17- <ng-template #childIcon>📦</ng-template>
7+ <div class="hierarchy-container">
8+ <h3>Service Hierarchy</h3>
9+ <div class="hierarchy-tree">
10+ @for (service of hierarchy; track service; let last = $last) {
11+ <div class="service-node" [class.current]="last">
12+ <div class="node-icon">
13+ <span>
14+ @if (service.isRoot) {
15+ 🏠
16+ } @else {
17+ 📦
18+ }
19+ </span>
20+ </div>
21+ <div class="node-info">
22+ <span class="node-type">{{
23+ service.isRoot ? "Root Service" : "Child Service"
24+ }}</span>
25+ <span class="node-lang"
26+ >Lang: <code>{{ service.currentLang }}</code></span
27+ >
28+ @if (service.fallbackLang) {
29+ <span class="node-fallback"
30+ >Fallback: <code>{{ service.fallbackLang }}</code></span
31+ >
32+ }
33+ </div>
34+ </div>
35+ @if (!last) {
36+ <div class="connector">
37+ <div class="line"></div>
38+ </div>
39+ }
40+ }
1841 </div>
19- <div class="node-info">
20- <span class="node-type">{{ service.isRoot ? 'Root Service' : 'Child Service' }}</span>
21- <span class="node-lang">Lang: <code>{{ service.currentLang }}</code></span>
22- <span class="node-fallback" *ngIf="service.fallbackLang">Fallback: <code>{{ service.fallbackLang }}</code></span>
23- </div>
24- </div>
25- <div class="connector" *ngIf="!last">
26- <div class="line"></div>
27- </div>
28- </ng-container>
29- </div>
30- </div>
31- ` ,
42+ </div>
43+ ` ,
3244 styles : `
33- .hierarchy-container {
34- background: var(--surface);
35- border-radius: var(--radius-lg);
36- border: 1px solid var(--border);
37- padding: 1.5rem;
38- margin-top: 2rem;
39- box-shadow: var(--shadow-sm);
40- }
41- h3 {
42- font-size: 1rem;
43- font-weight: 600;
44- margin-bottom: 1rem;
45- color: var(--text-muted);
46- text-transform: uppercase;
47- letter-spacing: 0.05em;
48- }
49- .hierarchy-tree {
50- display: flex;
51- flex-direction: column;
52- align-items: flex-start;
53- }
54- .service-node {
55- display: flex;
56- align-items: center;
57- gap: 1rem;
58- padding: 0.75rem 1rem;
59- background: #f1f5f9;
60- border-radius: var(--radius-md);
61- border: 1px solid var(--border);
62- width: 100%;
63- transition: all 0.2s;
64- }
65- .service-node.current {
66- background: #eef2ff;
67- border-color: var(--primary);
68- box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
69- }
70- .node-icon {
71- font-size: 1.25rem;
72- }
73- .node-info {
74- display: flex;
75- flex-direction: column;
76- gap: 0.25rem;
77- }
78- .node-type {
79- font-size: 0.875rem;
80- font-weight: 600;
81- color: var(--text-main);
82- }
83- .node-lang, .node-fallback {
84- font-size: 0.75rem;
85- color: var(--text-muted);
86- }
87- .connector {
88- display: flex;
89- justify-content: center;
90- width: 3rem;
91- height: 1.5rem;
92- margin-left: 0.5rem;
93- }
94- .line {
95- width: 2px;
96- height: 100%;
97- background: var(--border);
98- }
99- `
45+ .hierarchy-container {
46+ background: var(--surface);
47+ border-radius: var(--radius-lg);
48+ border: 1px solid var(--border);
49+ padding: 1.5rem;
50+ margin-top: 2rem;
51+ box-shadow: var(--shadow-sm);
52+ }
53+ h3 {
54+ font-size: 1rem;
55+ font-weight: 600;
56+ margin-bottom: 1rem;
57+ color: var(--text-muted);
58+ text-transform: uppercase;
59+ letter-spacing: 0.05em;
60+ }
61+ .hierarchy-tree {
62+ display: flex;
63+ flex-direction: column;
64+ align-items: flex-start;
65+ }
66+ .service-node {
67+ display: flex;
68+ align-items: center;
69+ gap: 1rem;
70+ padding: 0.75rem 1rem;
71+ background: #f1f5f9;
72+ border-radius: var(--radius-md);
73+ border: 1px solid var(--border);
74+ width: 100%;
75+ transition: all 0.2s;
76+ }
77+ .service-node.current {
78+ background: #eef2ff;
79+ border-color: var(--primary);
80+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
81+ }
82+ .node-icon {
83+ font-size: 1.25rem;
84+ }
85+ .node-info {
86+ display: flex;
87+ flex-direction: column;
88+ gap: 0.25rem;
89+ }
90+ .node-type {
91+ font-size: 0.875rem;
92+ font-weight: 600;
93+ color: var(--text-main);
94+ }
95+ .node-lang,
96+ .node-fallback {
97+ font-size: 0.75rem;
98+ color: var(--text-muted);
99+ }
100+ .connector {
101+ display: flex;
102+ justify-content: center;
103+ width: 3rem;
104+ height: 1.5rem;
105+ margin-left: 0.5rem;
106+ }
107+ .line {
108+ width: 2px;
109+ height: 100%;
110+ background: var(--border);
111+ }
112+ ` ,
100113} )
101114export class HierarchyVizComponent {
102115 private currentService = inject ( TranslateService ) ;
@@ -109,7 +122,7 @@ export class HierarchyVizComponent {
109122 list . unshift ( {
110123 isRoot : current . isRoot ,
111124 currentLang : current . getCurrentLang ( ) ,
112- fallbackLang : current . getFallbackLang ( )
125+ fallbackLang : current . getFallbackLang ( ) ,
113126 } ) ;
114127 current = current . parent ;
115128 }
0 commit comments