import React from 'react'; import { FileText, Globe, Hash, Link, Shield, Zap } from '~/components/shared/FeatherIcons'; import s0 from './Rule.module.scss'; const colorMap = { _default: 'var(--color-focus-blue)', DIRECT: '#f5bc41', REJECT: '#cb3166', }; function getStyleFor({ proxy }) { let color = colorMap._default; if (colorMap[proxy]) { color = colorMap[proxy]; } return { color }; } function getIconFor(type: string) { switch (type) { case 'Domain': case 'DomainSuffix': case 'DomainKeyword': return ; case 'IPCIDR': case 'IPCIDR6': return ; case 'GeoSite': case 'GeoIP': return ; case 'REJECT': return ; case 'DIRECT': return ; default: return ; } } type Props = { id?: number; type?: string; payload?: string; proxy?: string; size?: number; }; function Rule({ type, payload, proxy, id, size }: Props) { const styleProxy = getStyleFor({ proxy }); return (
{id}
{payload}
{(type === 'GeoSite' || type === 'GeoIP') &&
size: {size}
}
{getIconFor(type)} {type}
{proxy}
); } export default Rule;