Skip to content

urbo-feature-waste 1.0.0-16342

Install from the command line:
Learn more about npm packages
$ npm install @sw-code/urbo-feature-waste@1.0.0-16342
Install via package.json:
"@sw-code/urbo-feature-waste": "1.0.0-16342"

About this version

feature-waste

This library provides waste management functionality for the Urbo application. It displays waste collection schedules, allows users to set reminders, and provides information about waste types.

Features

  • Display waste collection schedules
  • Set reminders for waste collection
  • Customize waste type representations (colors and icons)
  • Configurable UI components

Configuration

The waste module is configured via FeatureWasteModule.forRoot(config) in main.ts.

Basic Usage

import { FeatureWasteModule } from '@sw-code/urbo-feature-waste';

FeatureWasteModule.forRoot({
  sourceCategoriesIds: [
    'c8a223a7-2c59-4c5e-8745-4533ea3397da',
  ],
  wasteCategoryIds: ['26bad60f-445b-40f4-b5da-addc877247d8'],
}),

Configuration Options

The following options can be passed to FeatureWasteModule.forRoot():

Option Type Required Description
sourceCategoriesIds string[] Yes IDs of the source categories used to fetch waste schedule data
wasteCategoryIds string[] Yes IDs of the waste categories to display
infoCardComponent Type<unknown> No Custom Angular component rendered as the info card
bannerComponent Type<unknown> No Custom Angular component rendered as the banner
individualAgreement IndividualAgreementConfig No Enables the individual agreement feature for 4-weekly residual waste
logo HeaderLogoSrc No Custom logo displayed in the module header
yellowWasteIcon 'YELLOW_BAG' | 'YELLOW_BIN' No Icon style for the yellow waste type. Defaults to 'YELLOW_BAG'

Yellow Waste Icon

By default the yellow waste type is rendered with a yellow bag icon (YELLOW_BAG). If the municipality uses yellow bins (wheelie bins) instead of bags, set yellowWasteIcon to 'YELLOW_BIN':

FeatureWasteModule.forRoot({
  sourceCategoriesIds: [...],
  wasteCategoryIds: [...],
  yellowWasteIcon: 'YELLOW_BIN',
}),
Value Description
'YELLOW_BAG' Yellow bag icon (default)
'YELLOW_BIN' Yellow wheelie bin icon

Individual Agreement Feature

The individual agreement feature is specifically designed for the RESIDUAL_WASTE_4WEEKLY waste type. When enabled, it allows users to opt for the 4-weekly residual waste collection schedule instead of the default residual waste schedule.

This feature cannot be customized with a different component as it's specifically tied to this waste type, but it can be configured through the individualAgreement object:

  • You can enable or disable the feature using the enabled property
  • You can customize the company/city name displayed in the agreement text using the companyName property

By default, if the feature is enabled but no company name is provided, "ESG Soest" will be used as the default company name.

FeatureWasteModule.forRoot({
  sourceCategoriesIds: [...],
  wasteCategoryIds: [...],
  individualAgreement: {
    enabled: true,
    companyName: 'ESG Soest',
  },
}),
Property Type Description
enabled boolean Enables or disables the individual agreement feature
companyName string Company/city name shown in the agreement text

Custom Components

infoCardComponent and bannerComponent accept any Angular standalone component:

import { MyInfoCardComponent } from './my-info-card.component';
import { MyBannerComponent } from './my-banner.component';

FeatureWasteModule.forRoot({
  sourceCategoriesIds: [...],
  wasteCategoryIds: [...],
  infoCardComponent: MyInfoCardComponent,
  bannerComponent: MyBannerComponent,
}),

Full Example

FeatureWasteModule.forRoot({
  sourceCategoriesIds: [
    'c8a223a7-2c59-4c5e-8745-4533ea3397da',
    'd72ecd36-324c-4573-b15a-39d1cbb34a6d',
    'd4bea671-9898-4a12-afe8-25c2cd01b39a',
  ],
  wasteCategoryIds: ['26bad60f-445b-40f4-b5da-addc877247d8'],
  yellowWasteIcon: 'YELLOW_BIN',
  infoCardComponent: EsgInfoCardComponent,
  bannerComponent: EsgBannerComponent,
  individualAgreement: {
    enabled: true,
    companyName: 'ESG Soest',
  },
}),

Icons

The module uses inline SVG definitions for all waste type icons, eliminating the need to provide external SVG files. This makes the library easier to use and more self-contained. The SVG icons are colored dynamically based on the color mappings provided in the configuration.

The module applies different colors based on the current theme (light or dark mode), providing theme-specific visual cues while using the same SVG structure.

Running unit tests

Run nx test feature-waste to execute the unit tests.

Details


Assets

  • urbo-feature-waste-1.0.0-16342.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0