mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 15:27:54 +01:00
refactor(config): remove dead exports across 16 config files (-433 lines)
Un-export or delete functions, types, and constants with zero external callers: notification-config helpers (7 dead), model-registry functions (3 dead + ModelMetadata un-exported), group-features helper functions (4 dead), contract-types helpers (3 dead), tasks.ts dead status groups (TASK_PROJECT_STATUS_LABELS/CONFIG, REQUEST_STATUS_*, TASK_TYPE_DESCRIPTIONS, getCategoryLabel, requiresAttention, TASK_NOTIFICATION_TYPES), research.ts RESOURCE_NEED/IMPACT_AREAS groups, categories.ts dead interfaces and CATEGORY_LABELS, landing-page interfaces, and various un-exported internal interfaces (GovernancePresetConfig, StatusInfo, NavItem, GroupLabelConfig). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
353e134d2c
commit
cc07902d86
16 files changed
+101
-516
No files matched your search
@@ -16,14 +16,7 @@
|
||||
export const MODEL_TIERS = ['free', 'economy', 'standard', 'premium'] as const;
|
||||
export type ModelTier = (typeof MODEL_TIERS)[number];
|
||||
|
||||
export const MODEL_CAPABILITIES = [
|
||||
'text',
|
||||
'vision',
|
||||
'function_calling',
|
||||
'json_mode',
|
||||
'streaming',
|
||||
] as const;
|
||||
export type ModelCapability = (typeof MODEL_CAPABILITIES)[number];
|
||||
type ModelCapability = 'text' | 'vision' | 'function_calling' | 'json_mode' | 'streaming';
|
||||
|
||||
export interface AIModelMetadata {
|
||||
/** OpenRouter model ID (e.g., 'anthropic/claude-3-opus') */
|
||||
|
||||
+77
-81
@@ -1,20 +1,20 @@
|
||||
export interface Category {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
icon: string // Lucide icon name
|
||||
interface Category {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string; // Lucide icon name
|
||||
groups: {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
}[]
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface SimpleCategory {
|
||||
value: string
|
||||
label: string
|
||||
icon: string
|
||||
description: string
|
||||
interface SimpleCategory {
|
||||
value: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const categories: Category[] = [
|
||||
@@ -27,19 +27,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'medical',
|
||||
name: 'Medical Expenses',
|
||||
description: 'Medical treatments, procedures, and healthcare costs'
|
||||
description: 'Medical treatments, procedures, and healthcare costs',
|
||||
},
|
||||
{
|
||||
id: 'life-events',
|
||||
name: 'Life Events',
|
||||
description: 'Birth of a child, weddings, funerals, and other significant life moments'
|
||||
description: 'Birth of a child, weddings, funerals, and other significant life moments',
|
||||
},
|
||||
{
|
||||
id: 'personal',
|
||||
name: 'Personal Needs',
|
||||
description: 'Personal emergencies, family support, and individual assistance'
|
||||
}
|
||||
]
|
||||
description: 'Personal emergencies, family support, and individual assistance',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'creators',
|
||||
@@ -50,19 +50,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'content-creators',
|
||||
name: 'Content Creators',
|
||||
description: 'Bloggers, YouTubers, podcasters, and social media creators'
|
||||
description: 'Bloggers, YouTubers, podcasters, and social media creators',
|
||||
},
|
||||
{
|
||||
id: 'artists',
|
||||
name: 'Artists',
|
||||
description: 'Visual artists, musicians, DJs, and digital artists'
|
||||
description: 'Visual artists, musicians, DJs, and digital artists',
|
||||
},
|
||||
{
|
||||
id: 'writers',
|
||||
name: 'Writers',
|
||||
description: 'Authors, journalists, and independent writers'
|
||||
}
|
||||
]
|
||||
description: 'Authors, journalists, and independent writers',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'builders',
|
||||
@@ -73,19 +73,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'open-source',
|
||||
name: 'Open Source Developers',
|
||||
description: 'Maintainers and contributors to open source projects'
|
||||
description: 'Maintainers and contributors to open source projects',
|
||||
},
|
||||
{
|
||||
id: 'founders',
|
||||
name: 'Solo Founders',
|
||||
description: 'Independent entrepreneurs and startup founders'
|
||||
description: 'Independent entrepreneurs and startup founders',
|
||||
},
|
||||
{
|
||||
id: 'vibe-coders',
|
||||
name: 'Vibe Coders',
|
||||
description: 'Creative developers and experimental projects'
|
||||
}
|
||||
]
|
||||
description: 'Creative developers and experimental projects',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'education',
|
||||
@@ -96,19 +96,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'students',
|
||||
name: 'Students',
|
||||
description: 'Individual students and student projects'
|
||||
description: 'Individual students and student projects',
|
||||
},
|
||||
{
|
||||
id: 'classes',
|
||||
name: 'Classes & Courses',
|
||||
description: 'Educational programs and course creators'
|
||||
description: 'Educational programs and course creators',
|
||||
},
|
||||
{
|
||||
id: 'educational-research',
|
||||
name: 'Educational Research',
|
||||
description: 'Academic research and educational initiatives'
|
||||
}
|
||||
]
|
||||
description: 'Academic research and educational initiatives',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'research',
|
||||
@@ -119,19 +119,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'desci',
|
||||
name: 'Decentralized Science',
|
||||
description: 'DeSci projects and blockchain-based research initiatives'
|
||||
description: 'DeSci projects and blockchain-based research initiatives',
|
||||
},
|
||||
{
|
||||
id: 'independent-research',
|
||||
name: 'Independent Researchers',
|
||||
description: 'Individual researchers and scientific investigations'
|
||||
description: 'Individual researchers and scientific investigations',
|
||||
},
|
||||
{
|
||||
id: 'scientific-studies',
|
||||
name: 'Scientific Studies',
|
||||
description: 'Research projects, experiments, and academic studies'
|
||||
}
|
||||
]
|
||||
description: 'Research projects, experiments, and academic studies',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'infrastructure',
|
||||
@@ -142,19 +142,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'public-works',
|
||||
name: 'Public Works',
|
||||
description: 'Parks, bike lanes, roads, and public facilities'
|
||||
description: 'Parks, bike lanes, roads, and public facilities',
|
||||
},
|
||||
{
|
||||
id: 'community-facilities',
|
||||
name: 'Community Facilities',
|
||||
description: 'Playgrounds, community centers, and shared spaces'
|
||||
description: 'Playgrounds, community centers, and shared spaces',
|
||||
},
|
||||
{
|
||||
id: 'urban-improvement',
|
||||
name: 'Urban Improvement',
|
||||
description: 'Pothole repairs, lighting, and city infrastructure upgrades'
|
||||
}
|
||||
]
|
||||
description: 'Pothole repairs, lighting, and city infrastructure upgrades',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'environment',
|
||||
@@ -165,19 +165,19 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'cleanup-efforts',
|
||||
name: 'Cleanup Efforts',
|
||||
description: 'Beach cleanups, waste removal, and environmental restoration'
|
||||
description: 'Beach cleanups, waste removal, and environmental restoration',
|
||||
},
|
||||
{
|
||||
id: 'conservation',
|
||||
name: 'Conservation',
|
||||
description: 'Wildlife protection, habitat preservation, and biodiversity projects'
|
||||
description: 'Wildlife protection, habitat preservation, and biodiversity projects',
|
||||
},
|
||||
{
|
||||
id: 'sustainability',
|
||||
name: 'Sustainability',
|
||||
description: 'Renewable energy, green technologies, and sustainable practices'
|
||||
}
|
||||
]
|
||||
description: 'Renewable energy, green technologies, and sustainable practices',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'organizations',
|
||||
@@ -188,58 +188,54 @@ export const categories: Category[] = [
|
||||
{
|
||||
id: 'non-profits',
|
||||
name: 'Non-Profits',
|
||||
description: 'Registered non-profit organizations'
|
||||
description: 'Registered non-profit organizations',
|
||||
},
|
||||
{
|
||||
id: 'charities',
|
||||
name: 'Charities',
|
||||
description: 'Charitable organizations and initiatives'
|
||||
description: 'Charitable organizations and initiatives',
|
||||
},
|
||||
{
|
||||
id: 'communities',
|
||||
name: 'Communities',
|
||||
description: 'Community projects and initiatives'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
description: 'Community projects and initiatives',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
// Helper exports for different use cases - SINGLE SOURCE OF TRUTH
|
||||
|
||||
// Simple categories for form dropdowns and UI components
|
||||
export const simpleCategories: SimpleCategory[] = [
|
||||
{ value: 'health', label: 'Health', icon: '🏥', description: 'Medical expenses, treatments, procedures' },
|
||||
{
|
||||
value: 'health',
|
||||
label: 'Health',
|
||||
icon: '🏥',
|
||||
description: 'Medical expenses, treatments, procedures',
|
||||
},
|
||||
{ value: 'creative', label: 'Creative', icon: '🎨', description: 'Art, music, writing' },
|
||||
{ value: 'technology', label: 'Technology', icon: '💻', description: 'Apps, websites, tech' },
|
||||
{ value: 'community', label: 'Community', icon: '🏘️', description: 'Local initiatives' },
|
||||
{ value: 'education', label: 'Education', icon: '📚', description: 'Learning, courses' },
|
||||
{ value: 'research', label: 'Research', icon: '🔬', description: 'DeSci, independent research' },
|
||||
{ value: 'infrastructure', label: 'Infrastructure', icon: '🏗️', description: 'Parks, bike lanes, public works' },
|
||||
{ value: 'environment', label: 'Environment', icon: '🌱', description: 'Cleanup, conservation, sustainability' },
|
||||
{
|
||||
value: 'infrastructure',
|
||||
label: 'Infrastructure',
|
||||
icon: '🏗️',
|
||||
description: 'Parks, bike lanes, public works',
|
||||
},
|
||||
{
|
||||
value: 'environment',
|
||||
label: 'Environment',
|
||||
icon: '🌱',
|
||||
description: 'Cleanup, conservation, sustainability',
|
||||
},
|
||||
{ value: 'charity', label: 'Charity', icon: '❤️', description: 'Helping others' },
|
||||
{ value: 'business', label: 'Business', icon: '🚀', description: 'Startups, ventures' },
|
||||
{ value: 'personal', label: 'Personal', icon: '🌟', description: 'Personal goals' },
|
||||
{ value: 'other', label: 'Other', icon: '✨', description: 'Everything else' }
|
||||
]
|
||||
|
||||
// Category values only (for filters, validation, etc.)
|
||||
export const categoryValues = simpleCategories.map(cat => cat.value)
|
||||
{ value: 'other', label: 'Other', icon: '✨', description: 'Everything else' },
|
||||
];
|
||||
|
||||
// TypeScript union type for categories
|
||||
export type CategoryValue = typeof categoryValues[number]
|
||||
|
||||
// Legacy mapping for backwards compatibility
|
||||
export const CATEGORY_LABELS: Record<string, string> = {
|
||||
health: 'Health',
|
||||
creative: 'Creative',
|
||||
technology: 'Technology',
|
||||
community: 'Community',
|
||||
education: 'Education',
|
||||
research: 'Research',
|
||||
infrastructure: 'Infrastructure',
|
||||
environment: 'Environment',
|
||||
charity: 'Charity',
|
||||
business: 'Business',
|
||||
personal: 'Personal',
|
||||
other: 'Other'
|
||||
}
|
||||
export type CategoryValue = (typeof simpleCategories)[number]['value'];
|
||||
@@ -20,7 +20,11 @@ export const CONTRACT_TYPES = {
|
||||
},
|
||||
term_fields: [
|
||||
{ name: 'job_title', type: 'text', required: true },
|
||||
{ name: 'employment_type', type: 'select', options: ['full_time', 'part_time', 'contractor', 'temporary'] },
|
||||
{
|
||||
name: 'employment_type',
|
||||
type: 'select',
|
||||
options: ['full_time', 'part_time', 'contractor', 'temporary'],
|
||||
},
|
||||
{ name: 'salary', type: 'number', required: true },
|
||||
{ name: 'payment_frequency', type: 'select', options: ['monthly', 'weekly', 'one_time'] },
|
||||
{ name: 'start_date', type: 'date' },
|
||||
@@ -81,14 +85,3 @@ export const CONTRACT_TYPES = {
|
||||
],
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type ContractType = keyof typeof CONTRACT_TYPES;
|
||||
|
||||
export function getContractTypeConfig(type: ContractType) {
|
||||
return CONTRACT_TYPES[type];
|
||||
}
|
||||
|
||||
export function getAllContractTypes() {
|
||||
return Object.values(CONTRACT_TYPES);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface RolePermissions {
|
||||
delete_group: ActionPermission;
|
||||
}
|
||||
|
||||
export interface GovernancePresetConfig {
|
||||
interface GovernancePresetConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
@@ -167,10 +167,7 @@ export type GroupRole = 'founder' | 'admin' | 'member';
|
||||
/**
|
||||
* Get role permissions from a governance preset
|
||||
*/
|
||||
export function getRolePermissions(
|
||||
preset: GovernancePreset,
|
||||
role: GroupRole
|
||||
): RolePermissions {
|
||||
export function getRolePermissions(preset: GovernancePreset, role: GroupRole): RolePermissions {
|
||||
return GOVERNANCE_PRESETS[preset].roles[role];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Adding a new feature = adding an entry here. No code changes needed.
|
||||
*/
|
||||
|
||||
export interface GroupFeatureConfig {
|
||||
interface GroupFeatureConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
@@ -68,47 +68,3 @@ export const GROUP_FEATURES = {
|
||||
} as const satisfies Record<string, GroupFeatureConfig>;
|
||||
|
||||
export type GroupFeature = keyof typeof GROUP_FEATURES;
|
||||
|
||||
/**
|
||||
* Get all features as array for UI rendering
|
||||
*/
|
||||
export function getGroupFeaturesArray() {
|
||||
return Object.entries(GROUP_FEATURES).map(([key, config]) => ({
|
||||
key: key as GroupFeature,
|
||||
...config,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a feature has unmet dependencies
|
||||
*/
|
||||
export function getUnmetDependencies(
|
||||
feature: GroupFeature,
|
||||
enabledFeatures: GroupFeature[]
|
||||
): GroupFeature[] {
|
||||
const config = GROUP_FEATURES[feature];
|
||||
const dependencies = config.dependencies ?? [];
|
||||
return dependencies.filter(
|
||||
(dep) => !enabledFeatures.includes(dep as GroupFeature)
|
||||
) as GroupFeature[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a feature can be enabled given current enabled features
|
||||
*/
|
||||
export function canEnableFeature(
|
||||
feature: GroupFeature,
|
||||
enabledFeatures: GroupFeature[]
|
||||
): boolean {
|
||||
return getUnmetDependencies(feature, enabledFeatures).length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get features that would be disabled if a feature is disabled
|
||||
* (features that depend on this one)
|
||||
*/
|
||||
export function getDependentFeatures(feature: GroupFeature): GroupFeature[] {
|
||||
return Object.entries(GROUP_FEATURES)
|
||||
.filter(([, config]) => (config.dependencies as readonly string[])?.includes(feature))
|
||||
.map(([key]) => key as GroupFeature);
|
||||
}
|
||||
@@ -8,22 +8,14 @@
|
||||
* Adding a new label = adding an entry here. No code changes needed.
|
||||
*/
|
||||
|
||||
import {
|
||||
Users,
|
||||
Building2,
|
||||
Heart,
|
||||
Briefcase,
|
||||
Globe,
|
||||
Home,
|
||||
Handshake,
|
||||
} from 'lucide-react';
|
||||
import { Users, Building2, Heart, Briefcase, Globe, Home, Handshake } from 'lucide-react';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import type { GovernancePreset } from './governance-presets';
|
||||
import type { GroupFeature } from './group-features';
|
||||
|
||||
export type GroupVisibility = 'public' | 'members_only' | 'private';
|
||||
|
||||
export interface GroupLabelConfig {
|
||||
interface GroupLabelConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
* Main categories shown on landing page
|
||||
* Reflects the full economic spectrum: exchange → funding → governance → AI agent
|
||||
*/
|
||||
export interface SuperAppCategory {
|
||||
interface SuperAppCategory {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
@@ -119,7 +119,7 @@ export const SUPER_APP_CATEGORIES: SuperAppCategory[] = [
|
||||
/**
|
||||
* Unified 4-step process — Cat-centric flow
|
||||
*/
|
||||
export interface HowItWorksStep {
|
||||
interface HowItWorksStep {
|
||||
number: string;
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
@@ -172,7 +172,7 @@ export const HOW_IT_WORKS_STEPS: HowItWorksStep[] = [
|
||||
* Comparison between traditional platforms and OrangeCat
|
||||
* Used in TrustSection
|
||||
*/
|
||||
export interface ComparisonRow {
|
||||
interface ComparisonRow {
|
||||
feature: string;
|
||||
traditional: string;
|
||||
orangecat: string;
|
||||
@@ -208,7 +208,7 @@ export const PLATFORM_COMPARISON: ComparisonRow[] = [
|
||||
/**
|
||||
* Key benefits of using OrangeCat
|
||||
*/
|
||||
export interface PlatformBenefit {
|
||||
interface PlatformBenefit {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
description: string;
|
||||
@@ -246,7 +246,7 @@ export const PLATFORM_BENEFITS: PlatformBenefit[] = [
|
||||
/**
|
||||
* Example use cases — clearly labeled as examples, not real testimonials
|
||||
*/
|
||||
export interface ExampleUseCase {
|
||||
interface ExampleUseCase {
|
||||
emoji: string;
|
||||
category: string;
|
||||
title: string;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* It enables users to choose between free, paid, open source, and proprietary models.
|
||||
*/
|
||||
|
||||
export interface ModelMetadata {
|
||||
interface ModelMetadata {
|
||||
id: string;
|
||||
name: string;
|
||||
provider: string;
|
||||
@@ -450,89 +450,3 @@ export const MODEL_REGISTRY: Record<string, ModelMetadata> = {
|
||||
description: 'Access 200+ models with one API key. Automatic fallbacks and best pricing.',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all models matching criteria
|
||||
*/
|
||||
export function getModels(filters?: {
|
||||
tier?: 'free' | 'freemium' | 'paid';
|
||||
type?: 'open' | 'proprietary';
|
||||
availability?: 'cloud' | 'local' | 'both';
|
||||
}): ModelMetadata[] {
|
||||
const models = Object.values(MODEL_REGISTRY);
|
||||
|
||||
if (!filters) {
|
||||
return models;
|
||||
}
|
||||
|
||||
return models.filter(model => {
|
||||
if (filters.tier && model.tier !== filters.tier) {
|
||||
return false;
|
||||
}
|
||||
if (filters.type && model.type !== filters.type) {
|
||||
return false;
|
||||
}
|
||||
if (filters.availability) {
|
||||
if (
|
||||
filters.availability !== 'both' &&
|
||||
model.availability !== filters.availability &&
|
||||
model.availability !== 'both'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recommended models based on user context
|
||||
*/
|
||||
export function getRecommendedModels(context?: {
|
||||
budget?: 'free' | 'low' | 'medium' | 'high';
|
||||
privacy?: 'public' | 'private' | 'paranoid';
|
||||
hardware?: {
|
||||
ram: number;
|
||||
vram?: number;
|
||||
};
|
||||
}): ModelMetadata[] {
|
||||
const recommendations: ModelMetadata[] = [];
|
||||
|
||||
// Always recommend free tier first
|
||||
recommendations.push(MODEL_REGISTRY['groq/mixtral-8x7b']);
|
||||
|
||||
// Privacy-conscious users
|
||||
if (context?.privacy === 'paranoid') {
|
||||
if (context?.hardware?.ram && context.hardware.ram >= 16) {
|
||||
recommendations.push(MODEL_REGISTRY['local/llama-3.1-8b']);
|
||||
}
|
||||
if (context?.hardware?.ram && context.hardware.ram >= 64) {
|
||||
recommendations.push(MODEL_REGISTRY['local/llama-3.1-70b']);
|
||||
}
|
||||
return recommendations;
|
||||
}
|
||||
|
||||
// Budget users
|
||||
if (!context?.budget || context.budget === 'free') {
|
||||
recommendations.push(MODEL_REGISTRY['google/gemini-2.0-flash']);
|
||||
if (context?.hardware?.ram && context.hardware.ram >= 16) {
|
||||
recommendations.push(MODEL_REGISTRY['local/llama-3.1-8b']);
|
||||
}
|
||||
}
|
||||
|
||||
// Quality seekers
|
||||
if (context?.budget === 'medium' || context?.budget === 'high') {
|
||||
recommendations.push(MODEL_REGISTRY['anthropic/claude-3.5-sonnet']);
|
||||
recommendations.push(MODEL_REGISTRY['openai/gpt-4o']);
|
||||
recommendations.push(MODEL_REGISTRY['openrouter/auto']);
|
||||
}
|
||||
|
||||
return recommendations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default model for free tier
|
||||
*/
|
||||
export function getDefaultModel(): ModelMetadata {
|
||||
return MODEL_REGISTRY['groq/mixtral-8x7b'];
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export interface NavSection {
|
||||
items: NavigationItem[];
|
||||
}
|
||||
|
||||
export interface NavItem {
|
||||
interface NavItem {
|
||||
name: string;
|
||||
href: string;
|
||||
icon: ComponentType<SVGProps<SVGSVGElement>>;
|
||||
|
||||
@@ -555,59 +555,8 @@ export const NOTIFICATION_CONFIG: Record<string, NotificationTypeConfig> = {
|
||||
},
|
||||
};
|
||||
|
||||
// =====================================================================
|
||||
// HELPER FUNCTIONS
|
||||
// =====================================================================
|
||||
|
||||
/** All notification types that can trigger an email */
|
||||
export function getEmailableTypes(): string[] {
|
||||
return Object.values(NOTIFICATION_CONFIG)
|
||||
.filter(config => config.emailEnabled)
|
||||
.map(config => config.type);
|
||||
}
|
||||
|
||||
/** Types that have email enabled by default for new users */
|
||||
export function getDefaultEnabledTypes(): string[] {
|
||||
return Object.values(NOTIFICATION_CONFIG)
|
||||
.filter(config => config.emailEnabled && config.emailDefaultOn)
|
||||
.map(config => config.type);
|
||||
}
|
||||
|
||||
/** Get all notification types in a given category */
|
||||
export function getCategoryTypes(category: NotificationCategory): NotificationTypeConfig[] {
|
||||
return Object.values(NOTIFICATION_CONFIG).filter(config => config.category === category);
|
||||
}
|
||||
|
||||
/** Check if a notification type is transactional (can't opt out) */
|
||||
export function isTransactional(type: string): boolean {
|
||||
const config = NOTIFICATION_CONFIG[type];
|
||||
return config?.category === 'transactional' || config?.canOptOut === false;
|
||||
}
|
||||
|
||||
/** Get a notification config by type, or undefined if not found */
|
||||
export function getNotificationConfig(type: string): NotificationTypeConfig | undefined {
|
||||
return NOTIFICATION_CONFIG[type];
|
||||
}
|
||||
|
||||
/** All known notification type keys */
|
||||
export const NOTIFICATION_TYPES = Object.keys(NOTIFICATION_CONFIG) as string[];
|
||||
|
||||
/** All notification categories in display order */
|
||||
export const NOTIFICATION_CATEGORIES: NotificationCategory[] = [
|
||||
'transactional',
|
||||
'economic',
|
||||
'social',
|
||||
'group',
|
||||
'progress',
|
||||
'reengagement',
|
||||
];
|
||||
|
||||
/** Human-readable category labels for preferences UI */
|
||||
export const NOTIFICATION_CATEGORY_LABELS: Record<NotificationCategory, string> = {
|
||||
transactional: 'Security & Account',
|
||||
economic: 'Payments & Orders',
|
||||
social: 'Social Activity',
|
||||
group: 'Groups & Governance',
|
||||
progress: 'Progress & Milestones',
|
||||
reengagement: 'Check-ins',
|
||||
};
|
||||
@@ -18,9 +18,9 @@ export const PROPOSAL_STATUSES = {
|
||||
CANCELLED: 'cancelled',
|
||||
} as const;
|
||||
|
||||
export type ProposalStatus = typeof PROPOSAL_STATUSES[keyof typeof PROPOSAL_STATUSES];
|
||||
export type ProposalStatus = (typeof PROPOSAL_STATUSES)[keyof typeof PROPOSAL_STATUSES];
|
||||
|
||||
export const PROPOSAL_TYPES = {
|
||||
const PROPOSAL_TYPES = {
|
||||
GENERAL: 'general',
|
||||
TREASURY: 'treasury',
|
||||
MEMBERSHIP: 'membership',
|
||||
@@ -28,7 +28,7 @@ export const PROPOSAL_TYPES = {
|
||||
EMPLOYMENT: 'employment',
|
||||
} as const;
|
||||
|
||||
export type ProposalType = typeof PROPOSAL_TYPES[keyof typeof PROPOSAL_TYPES];
|
||||
export type ProposalType = (typeof PROPOSAL_TYPES)[keyof typeof PROPOSAL_TYPES];
|
||||
|
||||
export const PROPOSAL_TYPE_LABELS: Record<ProposalType, string> = {
|
||||
[PROPOSAL_TYPES.GENERAL]: 'General',
|
||||
@@ -73,4 +73,3 @@ export const PROPOSAL_STATUS_CONFIG: Record<
|
||||
className: '',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -91,44 +91,3 @@ export const TRANSPARENCY_LEVELS = [
|
||||
] as const;
|
||||
|
||||
export type TransparencyLevel = (typeof TRANSPARENCY_LEVELS)[number]['value'];
|
||||
|
||||
// ==================== RESOURCE NEEDS ====================
|
||||
|
||||
export const RESOURCE_NEED_TYPES = [
|
||||
{ value: 'compute', label: 'Compute' },
|
||||
{ value: 'data', label: 'Data' },
|
||||
{ value: 'equipment', label: 'Equipment' },
|
||||
{ value: 'collaboration', label: 'Collaboration' },
|
||||
{ value: 'publication', label: 'Publication' },
|
||||
{ value: 'travel', label: 'Travel' },
|
||||
{ value: 'software', label: 'Software' },
|
||||
{ value: 'other', label: 'Other' },
|
||||
] as const;
|
||||
|
||||
export type ResourceNeedType = (typeof RESOURCE_NEED_TYPES)[number]['value'];
|
||||
|
||||
export const RESOURCE_NEED_PRIORITIES = [
|
||||
{ value: 'low', label: 'Low' },
|
||||
{ value: 'medium', label: 'Medium' },
|
||||
{ value: 'high', label: 'High' },
|
||||
{ value: 'critical', label: 'Critical' },
|
||||
] as const;
|
||||
|
||||
export type ResourceNeedPriority = (typeof RESOURCE_NEED_PRIORITIES)[number]['value'];
|
||||
|
||||
// ==================== IMPACT AREAS ====================
|
||||
|
||||
export const IMPACT_AREAS = [
|
||||
{ value: 'scientific_understanding', label: 'Scientific Understanding' },
|
||||
{ value: 'technological_innovation', label: 'Technological Innovation' },
|
||||
{ value: 'medical_advancement', label: 'Medical Advancement' },
|
||||
{ value: 'environmental_protection', label: 'Environmental Protection' },
|
||||
{ value: 'social_progress', label: 'Social Progress' },
|
||||
{ value: 'economic_development', label: 'Economic Development' },
|
||||
{ value: 'education', label: 'Education' },
|
||||
{ value: 'policy_making', label: 'Policy Making' },
|
||||
{ value: 'philosophical_insight', label: 'Philosophical Insight' },
|
||||
{ value: 'other', label: 'Other' },
|
||||
] as const;
|
||||
|
||||
export type ImpactArea = (typeof IMPACT_AREAS)[number]['value'];
|
||||
@@ -21,7 +21,7 @@ export type EntityStatus = 'draft' | 'active' | 'paused' | 'completed' | 'cancel
|
||||
|
||||
// ==================== STATUS CONFIG ====================
|
||||
|
||||
export interface StatusInfo {
|
||||
interface StatusInfo {
|
||||
label: string;
|
||||
className: string;
|
||||
description?: string;
|
||||
|
||||
@@ -47,40 +47,3 @@ export const STORAGE_KEYS = {
|
||||
CHAT_HISTORY: 'chat_history',
|
||||
CHAT_DRAFT: 'chat_draft',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Helper to safely get/set localStorage with JSON parsing
|
||||
*/
|
||||
export const storage = {
|
||||
get: <T>(key: string, defaultValue: T): T => {
|
||||
if (typeof window === 'undefined') {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
const item = localStorage.getItem(key);
|
||||
return item ? JSON.parse(item) : defaultValue;
|
||||
} catch {
|
||||
return defaultValue;
|
||||
}
|
||||
},
|
||||
set: (key: string, value: unknown): void => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
} catch {
|
||||
// Ignore storage errors (quota exceeded, etc.)
|
||||
}
|
||||
},
|
||||
remove: (key: string): void => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
} catch {
|
||||
// Ignore errors
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -51,12 +51,6 @@ export const TASK_TYPE_LABELS: Record<TaskType, string> = {
|
||||
recurring_as_needed: 'Recurring (as needed)',
|
||||
};
|
||||
|
||||
export const TASK_TYPE_DESCRIPTIONS: Record<TaskType, string> = {
|
||||
one_time: 'A one-time task that is done once completed',
|
||||
recurring_scheduled: 'Recurring task on a fixed schedule (e.g., weekly cleaning)',
|
||||
recurring_as_needed: 'Recurring task without a fixed schedule (e.g., restocking)',
|
||||
};
|
||||
|
||||
// ==================== TASK STATUSES ====================
|
||||
|
||||
/**
|
||||
@@ -220,15 +214,6 @@ export const PRIORITY_CONFIG: Record<Priority, PriorityInfo> = {
|
||||
},
|
||||
};
|
||||
|
||||
// ==================== TASK PROJECT STATUSES ====================
|
||||
|
||||
/**
|
||||
* Statuses for task-management project groupings.
|
||||
*
|
||||
* NOTE: These are NOT the same as the fundraising-project entity statuses
|
||||
* in `src/config/project-statuses.ts`. These describe how a workspace
|
||||
* project (used to group tasks in the tasks dashboard) is progressing.
|
||||
*/
|
||||
export const TASK_PROJECT_STATUSES = {
|
||||
PLANNING: 'planning',
|
||||
ACTIVE: 'active',
|
||||
@@ -237,49 +222,8 @@ export const TASK_PROJECT_STATUSES = {
|
||||
CANCELLED: 'cancelled',
|
||||
} as const;
|
||||
|
||||
export type TaskProjectStatus = (typeof TASK_PROJECT_STATUSES)[keyof typeof TASK_PROJECT_STATUSES];
|
||||
|
||||
export const TASK_PROJECT_STATUS_OPTIONS = Object.values(TASK_PROJECT_STATUSES);
|
||||
|
||||
export const TASK_PROJECT_STATUS_LABELS: Record<TaskProjectStatus, string> = {
|
||||
planning: 'Planning',
|
||||
active: 'Active',
|
||||
on_hold: 'On Hold',
|
||||
completed: 'Completed',
|
||||
cancelled: 'Cancelled',
|
||||
};
|
||||
|
||||
export const TASK_PROJECT_STATUS_CONFIG: Record<
|
||||
TaskProjectStatus,
|
||||
{ label: string; className: string }
|
||||
> = {
|
||||
planning: {
|
||||
label: 'Planning',
|
||||
className: 'bg-gray-100 text-gray-700',
|
||||
},
|
||||
active: {
|
||||
label: 'Active',
|
||||
className: 'bg-green-100 text-green-700',
|
||||
},
|
||||
on_hold: {
|
||||
label: 'On Hold',
|
||||
className: 'bg-yellow-100 text-yellow-700',
|
||||
},
|
||||
completed: {
|
||||
label: 'Completed',
|
||||
className: 'bg-blue-100 text-blue-700',
|
||||
},
|
||||
cancelled: {
|
||||
label: 'Cancelled',
|
||||
className: 'bg-red-100 text-red-700',
|
||||
},
|
||||
};
|
||||
|
||||
// ==================== REQUEST STATUSES ====================
|
||||
|
||||
/**
|
||||
* Request statuses for task requests
|
||||
*/
|
||||
export const REQUEST_STATUSES = {
|
||||
PENDING: 'pending',
|
||||
ACCEPTED: 'accepted',
|
||||
@@ -287,51 +231,6 @@ export const REQUEST_STATUSES = {
|
||||
COMPLETED: 'completed',
|
||||
} as const;
|
||||
|
||||
export type RequestStatus = (typeof REQUEST_STATUSES)[keyof typeof REQUEST_STATUSES];
|
||||
|
||||
export const REQUEST_STATUS_OPTIONS = Object.values(REQUEST_STATUSES);
|
||||
|
||||
export const REQUEST_STATUS_LABELS: Record<RequestStatus, string> = {
|
||||
pending: 'Pending',
|
||||
accepted: 'Accepted',
|
||||
declined: 'Declined',
|
||||
completed: 'Completed',
|
||||
};
|
||||
|
||||
export const REQUEST_STATUS_CONFIG: Record<RequestStatus, { label: string; className: string }> = {
|
||||
pending: {
|
||||
label: 'Pending',
|
||||
className: 'bg-yellow-100 text-yellow-700',
|
||||
},
|
||||
accepted: {
|
||||
label: 'Accepted',
|
||||
className: 'bg-blue-100 text-blue-700',
|
||||
},
|
||||
declined: {
|
||||
label: 'Declined',
|
||||
className: 'bg-red-100 text-red-700',
|
||||
},
|
||||
completed: {
|
||||
label: 'Completed',
|
||||
className: 'bg-green-100 text-green-700',
|
||||
},
|
||||
};
|
||||
|
||||
// ==================== NOTIFICATION TYPES ====================
|
||||
|
||||
/**
|
||||
* Task-related notification types
|
||||
*/
|
||||
export const TASK_NOTIFICATION_TYPES = {
|
||||
ATTENTION: 'task_attention',
|
||||
REQUEST: 'task_request',
|
||||
COMPLETED: 'task_completed',
|
||||
BROADCAST: 'task_broadcast',
|
||||
} as const;
|
||||
|
||||
export type TaskNotificationType =
|
||||
(typeof TASK_NOTIFICATION_TYPES)[keyof typeof TASK_NOTIFICATION_TYPES];
|
||||
|
||||
// ==================== UTILITY FUNCTIONS ====================
|
||||
|
||||
/**
|
||||
@@ -368,16 +267,6 @@ export function getPriorityInfo(priority: string | null | undefined): PriorityIn
|
||||
return PRIORITY_CONFIG[normalized] || PRIORITY_CONFIG.normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category label
|
||||
*/
|
||||
export function getCategoryLabel(category: string | null | undefined): string {
|
||||
if (!category) {
|
||||
return 'Unknown';
|
||||
}
|
||||
return TASK_CATEGORY_LABELS[category as TaskCategory] || category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category icon (emoji)
|
||||
*/
|
||||
@@ -388,17 +277,6 @@ export function getCategoryIcon(category: string | null | undefined): string {
|
||||
return TASK_CATEGORY_ICONS[category as TaskCategory] || '📌';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a task requires immediate attention
|
||||
*/
|
||||
export function requiresAttention(status: TaskStatus, priority: Priority): boolean {
|
||||
return (
|
||||
status === TASK_STATUSES.NEEDS_ATTENTION ||
|
||||
priority === PRIORITIES.URGENT ||
|
||||
(status === TASK_STATUSES.REQUESTED && priority === PRIORITIES.HIGH)
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== DEFAULT VALUES ====================
|
||||
|
||||
export const TASK_DEFAULTS = {
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Used by src/services/transparency.ts for weighted scoring.
|
||||
*/
|
||||
|
||||
export interface TransparencyCriterion {
|
||||
interface TransparencyCriterion {
|
||||
key: string;
|
||||
label: string;
|
||||
description: string;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
export interface TransparencyCategory {
|
||||
interface TransparencyCategory {
|
||||
label: string;
|
||||
weight: number;
|
||||
criteria: TransparencyCriterion[];
|
||||
@@ -113,10 +113,6 @@ export const TRANSPARENCY_CONFIG = {
|
||||
},
|
||||
} as const satisfies Record<string, Record<string, TransparencyCategory>>;
|
||||
|
||||
/** All criterion keys for type safety */
|
||||
export type TransparencyCriterionKey =
|
||||
(typeof TRANSPARENCY_CONFIG.categories)[keyof typeof TRANSPARENCY_CONFIG.categories]['criteria'][number]['key'];
|
||||
|
||||
/** Helper to get a flat list of all criteria with their effective weight */
|
||||
export function getTransparencyCriteria(): Array<
|
||||
TransparencyCriterion & { category: string; effectiveWeight: number }
|
||||
|
||||
Reference in new issue
Block a user