@@ -16,6 +16,9 @@ export default function ModelOption({ option }) {
1616 const { t } = useTranslation ( ) ;
1717 const [ userInfo ] = useUserInfo ( ) ;
1818 const { category } = userInfo ;
19+ const hasKnownPrice = typeof option . price === 'number' ;
20+ const hasInputOutputPrice =
21+ typeof option . priceIn === 'number' && typeof option . priceOut === 'number' ;
1922
2023 return (
2124 < div className = "flex flex-col" >
@@ -63,27 +66,40 @@ export default function ModelOption({ option }) {
6366 TPM: { fmtNumber ( option . levels [ category ] . TPM ) }
6467 </ Tag >
6568 ) }
66- { option . price > 0 ? (
69+ { ! ! option . supportsGift && (
6770 < Tag
6871 className = "ml-2 inline-flex items-center justify-center"
6972 variant = "outline"
7073 size = "small"
71- theme = { option . noGift ? 'danger' : 'success' }
74+ theme = "success"
75+ icon = { < i className = "iconify i-mingcute-gift-card-fill" > </ i > }
76+ >
77+ < span className = "pl-1" > { t ( 'common.gift' , 'Gift' ) } </ span >
78+ </ Tag >
79+ ) }
80+ { hasKnownPrice && option . price > 0 ? (
81+ < Tag
82+ className = "ml-2 inline-flex items-center justify-center"
83+ variant = "outline"
84+ size = "small"
85+ theme = "warning"
7286 icon = { < i className = "iconify i-mingcute-currency-dollar-fill" > </ i > }
7387 >
7488 < div className = "pl-1" >
75- { option . priceIn === option . priceOut ? (
89+ { hasInputOutputPrice && option . priceIn === option . priceOut ? (
7690 < span > { option . priceIn } </ span >
77- ) : (
91+ ) : hasInputOutputPrice ? (
7892 < >
7993 < span > { option . priceIn } </ span >
8094 < span className = "mx-0.5" > /</ span >
8195 < span > { option . priceOut } </ span >
8296 </ >
97+ ) : (
98+ < span > { option . price } </ span >
8399 ) }
84100 </ div >
85101 </ Tag >
86- ) : (
102+ ) : hasKnownPrice && option . price === 0 ? (
87103 < Tag
88104 className = "ml-2 inline-flex items-center justify-center"
89105 variant = "outline"
@@ -92,7 +108,7 @@ export default function ModelOption({ option }) {
92108 >
93109 { t ( 'common.free' ) }
94110 </ Tag >
95- ) }
111+ ) : null }
96112
97113 { /* {option.isVendorA && (
98114 <Tag size="small" variant="outline" theme="success" className="ml-2">
0 commit comments