Ziya/app/composables/useZiyaConfig.ts
rizary 67fb3a203e
feat: implement CEX analysis cards and real-time token monitoring
- Add TokenCard and CexAnalysisCard components for displaying token data
- Implement real-time Redis event streaming for token updates
- Add environment-based configuration system for dev/prod Redis servers
- Create comprehensive hunting ground dashboard with card management
- Add individual and bulk card removal functionality
- Implement browser integration for token details viewing
- Add timestamp utilities and proper type handling for Redis events
- Create production-ready configuration with 154.38.185.112 Redis server
- Add comprehensive documentation in README.md and CONTRIBUTORS.md
- Restructure project architecture with proper Electron-Vue integration

BREAKING CHANGE: Redis configuration now uses environment-based settings
2025-06-23 09:03:39 +07:00

117 lines
2.4 KiB
TypeScript

/**
* Ziya App Configuration Composable
* Provides centralized configuration values for the entire application
*
* @example
* ```ts
* const { config, getDevServerUrl, isDevelopment } = useZiyaConfig()
* console.log(config.app.name) // 'Ziya'
* ```
*/
interface ZiyaAppConfig {
name: string;
version: string;
description: string;
author: string;
}
interface ZiyaDevelopmentConfig {
nuxtPort: number;
nuxtHost: string;
electronDevTools: boolean;
}
interface ZiyaWindowConfig {
minHeight: number;
minWidth: number;
maxHeight: number;
maxWidth: number;
defaultHeight: number;
defaultWidth: number;
}
interface ZiyaThemeConfig {
defaultPalette: number;
defaultDarkMode: boolean;
availablePalettes: number[];
}
interface ZiyaConfigValues {
app: ZiyaAppConfig;
development: ZiyaDevelopmentConfig;
window: ZiyaWindowConfig;
theme: ZiyaThemeConfig;
}
const ZIYA_CONFIG: ZiyaConfigValues = {
app: {
name: 'Ziya',
version: '1.0.0',
description: 'One stop shop trading solution',
author: 'bismillahDAO',
},
development: {
nuxtPort: 3000,
nuxtHost: 'localhost',
electronDevTools: true,
},
window: {
minHeight: 800,
minWidth: 1080,
maxHeight: 1080,
maxWidth: 1920,
defaultHeight: 1024,
defaultWidth: 1280,
},
theme: {
defaultPalette: 1,
defaultDarkMode: false,
availablePalettes: Array.from({ length: 24 }, (_, i) => i + 1),
},
};
/**
* Get development server URL based on configuration
*/
const getDevServerUrl = (): string => {
const { nuxtHost, nuxtPort } = ZIYA_CONFIG.development;
return `http://${nuxtHost}:${nuxtPort}`;
};
/**
* Environment detection utilities
*/
const isDevelopment = process.env.NODE_ENV === 'development';
const isProduction = process.env.NODE_ENV === 'production';
const isClient = import.meta.client;
/**
* Main composable function that provides Ziya app configuration
*
* @returns Object containing configuration values and helper functions
*/
export const useZiyaConfig = () => {
return {
config: ZIYA_CONFIG,
// Helper functions
getDevServerUrl,
// Environment flags
isDevelopment,
isProduction,
isClient,
};
};
// Default export for convenience
export default useZiyaConfig;
// Export types for external use
export type {
ZiyaAppConfig, ZiyaConfigValues, ZiyaDevelopmentConfig, ZiyaThemeConfig, ZiyaWindowConfig
};