Skip to content

Commit 13f5dc2

Browse files
committed
feat(ui): add read-only mode for skill tree component
- Add disabled state to skill tree input with muted styling - Prevent interaction when skill tree is in readonly mode - Remove unused PerkDetailDirective import from item-detail-perks
1 parent 884daef commit 13f5dc2

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed

apps/web/app/widgets/data/item-detail/item-detail-perks.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ import { apiResource } from '~/utils'
1313
import { ItemDetailStore } from './item-detail.store'
1414
import { ItemEditorEventsService } from './item-editor-events.service'
1515
import { PerkSlotExplained } from './selectors'
16-
import { PerkDetailDirective } from "../perk-detail/perk-detail.directive";
1716

1817
@Component({
1918
selector: 'nwb-item-detail-perks',
2019
templateUrl: './item-detail-perks.component.html',
2120
changeDetection: ChangeDetectionStrategy.OnPush,
22-
imports: [CommonModule, NwModule, ItemFrameModule, IconsModule, TooltipModule, PerkDetailDirective],
21+
imports: [CommonModule, NwModule, ItemFrameModule, IconsModule, TooltipModule],
2322
host: {
2423
class: 'flex flex-col gap-1',
2524
'animate.enter': 'fade-grow-y-in',

apps/web/app/widgets/skill-tree/skill-tree-input.component.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,50 @@
116116
transform: scale(0.66);
117117
}
118118
}
119+
120+
/* Readonly / disabled tree styling */
121+
.is-readonly {
122+
.grid-cell {
123+
cursor: default;
124+
125+
picture {
126+
/* Change cyan outline to dark grey */
127+
@apply outline-neutral;
128+
}
129+
130+
/* Mute the connecting lines in readonly mode */
131+
&::before,
132+
&::after {
133+
opacity: 0.2;
134+
}
135+
}
136+
137+
/* Checked cells in readonly mode should have darker styling for better visibility */
138+
.is-checked {
139+
picture {
140+
/* Much darker outline for active skills */
141+
@apply outline-gray-600;
142+
img {
143+
/* Slightly reduce opacity to show it's not interactive */
144+
opacity: 0.8;
145+
}
146+
}
147+
148+
/* Active cells should have darker lines (more visible than inactive but not bright) */
149+
&::before,
150+
&::after {
151+
opacity: 0.5;
152+
}
153+
}
154+
155+
/* Unlocked cells shouldn't show pointer cursor */
156+
.is-unlocked {
157+
cursor: default;
158+
159+
/* Override the bright lines with muted version */
160+
&::before,
161+
&::after {
162+
opacity: 0.2;
163+
}
164+
}
165+
}

apps/web/app/widgets/skill-tree/skill-tree-input.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="skill-tree-title text-lg uppercase text-center font-serif text-nw-description nw-bg-title bg-bottom pt-4">
22
{{ title() | nwText }} - <span class="font-caslon">{{ value()?.length || 0 }}</span>
33
</div>
4-
<div class="skill-tree-content grid p-3 relative" [class]="colsClass()">
4+
<div class="skill-tree-content grid p-3 relative" [class]="colsClass()" [class.is-readonly]="disabled()">
55
@for (row of rows(); track $index) {
66
@for (cell of row; track $index) {
77
@if (!cell.ability) {
@@ -17,7 +17,7 @@
1717
></div>
1818
} @else {
1919
<div
20-
[tabindex]="cell.unlocked ? 0 : -1"
20+
[tabindex]="cell.unlocked && !disabled() ? 0 : -1"
2121
class="grid-cell aspect-square flex items-center justify-center transition-opacity relative"
2222
[class.is-disabled]="!cell.unlocked"
2323
[class.is-unlocked]="cell.unlocked"
@@ -29,9 +29,9 @@
2929
[class.edge-r]="cell.edgeRight"
3030
[class.edge-tl]="cell.edgeTopLeft"
3131
[class.edge-tr]="cell.edgeTopRight"
32-
(click)="toggle(cell)"
33-
(keydown.space)="toggle(cell)"
34-
(keydown.enter)="toggle(cell)"
32+
(click)="!disabled() && toggle(cell)"
33+
(keydown.space)="!disabled() && toggle(cell)"
34+
(keydown.enter)="!disabled() && toggle(cell)"
3535
[tooltip]="tip"
3636
[tooltipDelay]="0"
3737
[tooltipClass]="'p-0'"

0 commit comments

Comments
 (0)