Skip to content

Commit 8717a86

Browse files
committed
refactor: rename BlockLabel type to label for consistency across models
1 parent 2f384bf commit 8717a86

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

mobile-app/lib/models/learn/curriculum_model.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class Block {
154154
final String dashedName;
155155
final SuperBlock superBlock;
156156
final BlockLayout layout;
157-
final BlockLabel type;
157+
final BlockLabel label;
158158
final List description;
159159
// Blocks in chapter-based super blocks don't have `order`.
160160
final int? order;
@@ -165,7 +165,7 @@ class Block {
165165
Block({
166166
required this.superBlock,
167167
required this.layout,
168-
required this.type,
168+
required this.label,
169169
required this.name,
170170
required this.dashedName,
171171
required this.description,
@@ -216,7 +216,7 @@ class Block {
216216
),
217217
layout: handleLayout(data['blockLayout']),
218218
// Support both blockLabel and blockType for backward compatibility
219-
type: (data['blockLabel'] ?? data['blockType']) != null
219+
label: (data['blockLabel'] ?? data['blockType']) != null
220220
? blockLabelFromString(data['blockLabel'] ?? data['blockType'])
221221
: BlockLabel.legacy,
222222
name: data['name'],

mobile-app/lib/models/learn/daily_challenge_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class DailyChallengeBlock {
115115
name: 'Daily Challenges',
116116
),
117117
layout: BlockLayout.challengeGrid,
118-
type: BlockLabel.legacy,
118+
label: BlockLabel.legacy,
119119
description: [description],
120120
challenges: challenges
121121
.map((overview) => ChallengeOrder(

mobile-app/lib/ui/views/learn/block/block_template_view.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class BlockTemplateView extends StatelessWidget {
2929
model,
3030
child,
3131
) {
32-
final (icon, color) = model.getIconData(block.type);
32+
final (icon, color) = model.getIconData(block.label);
3333

3434
return Padding(
3535
padding: const EdgeInsets.only(bottom: 16.0),

mobile-app/test/unit/challenge_utils_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void main() {
2929
return Block(
3030
superBlock: SuperBlock(dashedName: 'superblock', name: 'Super Block'),
3131
layout: BlockLayout.challengeList,
32-
type: BlockLabel.lecture,
32+
label: BlockLabel.lecture,
3333
name: 'Block 1',
3434
dashedName: 'block-1',
3535
description: [],

0 commit comments

Comments
 (0)