This commit is contained in:
ChuXun
2025-10-25 19:18:43 +08:00
parent 4ce487588a
commit 02a830145e
3971 changed files with 1549956 additions and 2 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: '其他',
};