CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-react-top-loading-bar

A highly customizable React top-loading bar component with hook-based, ref-based, and state-based control patterns.

Agent Success

Agent success rate when using this tile

64%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.25x

Baseline

Agent success rate without this tile

51%

Overview
Eval results
Files

task.mdevals/scenario-1/

Loading Bar Configuration Manager

Build a TypeScript utility module that manages loading bar configurations with proper type safety.

Requirements

Create a module with three type-safe utilities for managing top-loading bar settings and controls:

Configuration Validator

Implement validateLoadingBarConfig that:

  • Accepts a configuration object with loading bar properties
  • Returns true if the configuration is valid, false otherwise
  • Validates numeric ranges: height (1-20), loaderSpeed (100-5000), transitionTime (100-3000)
  • Validates that color is a string when provided
  • Uses proper TypeScript types from the loading bar library

Settings Merger

Implement mergeLoadingBarSettings that:

  • Accepts optional user-provided configuration settings
  • Returns a complete configuration by merging with defaults: { color: '#2196f3', height: 3, shadow: true, loaderSpeed: 500 }
  • User settings override defaults when provided
  • Returns a properly typed configuration object

Progress Tracker

Implement LoadingBarTracker class that:

  • Accepts a loading bar reference in its constructor
  • Provides startLoading() method that calls the reference's continuousStart() method
  • Provides finishLoading() method that calls the reference's complete() method
  • Provides updateProgress(value: number) method that calls the reference's staticStart() with the value
  • Uses correct TypeScript types for the loading bar reference

Dependencies { .dependencies }

react-top-loading-bar { .dependency }

Provides the top-loading bar component and TypeScript type definitions.

Test Cases

  • Validator returns true for valid configurations with all required numeric properties within range @test
  • Validator returns false when height is outside acceptable range (e.g., height: 25) @test
  • Settings merger correctly combines default and user settings, with user settings taking precedence @test
  • LoadingBarTracker properly stores and uses the loading bar reference with type-safe method calls @test

@generates

API

// Configuration validator
export function validateLoadingBarConfig(config: any): boolean;

// Settings merger
export function mergeLoadingBarSettings(userSettings?: any): any;

// Progress tracker class
export class LoadingBarTracker {
  constructor(ref: any);
  startLoading(): void;
  finishLoading(): void;
  updateProgress(value: number): void;
}
tessl i tessl/npm-react-top-loading-bar@3.0.0

tile.json