This commit is contained in:
ChuXun
2026-01-29 03:53:39 +08:00
parent 670b7adba2
commit 8a87c3ebbc
3939 changed files with 3906 additions and 1528639 deletions

View File

@@ -0,0 +1,27 @@
/**
* @file Pollution related constants, aligned with backend enums.
*/
/**
* Represents the types of pollution, consistent with the `PollutionType` enum in the backend.
* This ensures that frontend displays and data submissions are aligned with backend expectations.
*/
export const POLLUTION_TYPES = ['PM25', 'O3', 'NO2', 'SO2', 'OTHER'] as const;
/**
* Type definition for a single pollution type.
* Ensures type safety when working with pollution constants.
*/
export type PollutionType = typeof POLLUTION_TYPES[number];
/**
* A map to provide human-readable names for pollution types.
* Useful for displaying in UI components like chart legends or labels.
*/
export const POLLUTION_TYPE_MAP: Record<PollutionType, string> = {
PM25: 'PM2.5',
O3: 'O₃',
NO2: 'NO₂',
SO2: 'SO₂',
OTHER: '其他',
};