refactored monorepo for more projects
This commit is contained in:
parent
4632c174dc
commit
9492f1b15e
180 changed files with 1438 additions and 424 deletions
17
apps/stock/web-app/src/lib/constants.ts
Normal file
17
apps/stock/web-app/src/lib/constants.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import {
|
||||
BuildingLibraryIcon,
|
||||
ChartBarIcon,
|
||||
CogIcon,
|
||||
DocumentTextIcon,
|
||||
HomeIcon,
|
||||
PresentationChartLineIcon,
|
||||
} from '@heroicons/react/24/outline';
|
||||
|
||||
export const navigation = [
|
||||
{ name: 'Dashboard', href: '/dashboard', icon: HomeIcon },
|
||||
{ name: 'Exchanges', href: '/exchanges', icon: BuildingLibraryIcon },
|
||||
{ name: 'Portfolio', href: '/portfolio', icon: ChartBarIcon },
|
||||
{ name: 'Strategies', href: '/strategies', icon: DocumentTextIcon },
|
||||
{ name: 'Analytics', href: '/analytics', icon: PresentationChartLineIcon },
|
||||
{ name: 'Settings', href: '/settings', icon: CogIcon },
|
||||
];
|
||||
1
apps/stock/web-app/src/lib/constants/index.ts
Normal file
1
apps/stock/web-app/src/lib/constants/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './navigation';
|
||||
47
apps/stock/web-app/src/lib/constants/navigation.ts
Normal file
47
apps/stock/web-app/src/lib/constants/navigation.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import {
|
||||
BuildingOfficeIcon,
|
||||
ChartBarIcon,
|
||||
CogIcon,
|
||||
CurrencyDollarIcon,
|
||||
DocumentTextIcon,
|
||||
HomeIcon,
|
||||
} from '@heroicons/react/24/outline';
|
||||
|
||||
export const navigation = [
|
||||
{
|
||||
name: 'Dashboard',
|
||||
href: '/',
|
||||
icon: HomeIcon,
|
||||
current: true,
|
||||
},
|
||||
{
|
||||
name: 'Portfolio',
|
||||
href: '/portfolio',
|
||||
icon: CurrencyDollarIcon,
|
||||
current: false,
|
||||
},
|
||||
{
|
||||
name: 'Analytics',
|
||||
href: '/analytics',
|
||||
icon: ChartBarIcon,
|
||||
current: false,
|
||||
},
|
||||
{
|
||||
name: 'Exchanges',
|
||||
href: '/exchanges',
|
||||
icon: BuildingOfficeIcon,
|
||||
current: false,
|
||||
},
|
||||
{
|
||||
name: 'Reports',
|
||||
href: '/reports',
|
||||
icon: DocumentTextIcon,
|
||||
current: false,
|
||||
},
|
||||
{
|
||||
name: 'Settings',
|
||||
href: '/settings',
|
||||
icon: CogIcon,
|
||||
current: false,
|
||||
},
|
||||
];
|
||||
29
apps/stock/web-app/src/lib/utils.ts
Normal file
29
apps/stock/web-app/src/lib/utils.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
// Utility functions for financial data formatting
|
||||
export function formatCurrency(value: number): string {
|
||||
return new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: 'USD',
|
||||
minimumFractionDigits: 2,
|
||||
}).format(value);
|
||||
}
|
||||
|
||||
export function formatPercentage(value: number): string {
|
||||
return `${value >= 0 ? '+' : ''}${value.toFixed(2)}%`;
|
||||
}
|
||||
|
||||
export function getValueColor(value: number): string {
|
||||
if (value > 0) {
|
||||
return 'text-success';
|
||||
}
|
||||
if (value < 0) {
|
||||
return 'text-danger';
|
||||
}
|
||||
return 'text-text-secondary';
|
||||
}
|
||||
6
apps/stock/web-app/src/lib/utils/cn.ts
Normal file
6
apps/stock/web-app/src/lib/utils/cn.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
59
apps/stock/web-app/src/lib/utils/index.ts
Normal file
59
apps/stock/web-app/src/lib/utils/index.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
export * from './cn';
|
||||
|
||||
/**
|
||||
* Format currency values
|
||||
*/
|
||||
export function formatCurrency(value: number, currency = 'USD'): string {
|
||||
return new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency,
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
}).format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format percentage values
|
||||
*/
|
||||
export function formatPercentage(value: number, decimals = 2): string {
|
||||
return `${value >= 0 ? '+' : ''}${value.toFixed(decimals)}%`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format large numbers with K, M, B suffixes
|
||||
*/
|
||||
export function formatNumber(num: number): string {
|
||||
if (num >= 1e9) {
|
||||
return (num / 1e9).toFixed(1) + 'B';
|
||||
}
|
||||
if (num >= 1e6) {
|
||||
return (num / 1e6).toFixed(1) + 'M';
|
||||
}
|
||||
if (num >= 1e3) {
|
||||
return (num / 1e3).toFixed(1) + 'K';
|
||||
}
|
||||
return num.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color class based on numeric value (profit/loss)
|
||||
*/
|
||||
export function getValueColor(value: number): string {
|
||||
if (value > 0) {
|
||||
return 'text-success';
|
||||
}
|
||||
if (value < 0) {
|
||||
return 'text-danger';
|
||||
}
|
||||
return 'text-text-secondary';
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate text to specified length
|
||||
*/
|
||||
export function truncateText(text: string, length: number): string {
|
||||
if (text.length <= length) {
|
||||
return text;
|
||||
}
|
||||
return text.slice(0, length) + '...';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue