✨ feat(locales): Replace 'nodeGroupId' with 'groupId' in multiple language files for consistency
This commit is contained in:
@@ -4,7 +4,7 @@ import useGlobalStore from '@/config/use-global';
|
||||
import { formatBytes, unitConversion } from '@workspace/ui/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
type DisplayType = 'currency' | 'traffic' | 'number';
|
||||
type DisplayType = 'currency' | 'traffic' | 'number' | 'trafficSpeed';
|
||||
|
||||
interface DisplayProps<T> {
|
||||
value?: T;
|
||||
@@ -26,12 +26,16 @@ export function Display<T extends number | undefined | null>({
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
if (['traffic', 'number'].includes(type) && unlimited && !value) {
|
||||
if (['traffic', 'trafficSpeed', 'number'].includes(type) && unlimited && !value) {
|
||||
return t('unlimited');
|
||||
}
|
||||
|
||||
if (type === 'traffic') {
|
||||
return value ? formatBytes(value as number) : '0';
|
||||
return value ? formatBytes(value) : '0';
|
||||
}
|
||||
|
||||
if (type === 'trafficSpeed') {
|
||||
return value ? formatBytes(value).replace('B', 'b') + 'ps' : '0';
|
||||
}
|
||||
|
||||
if (type === 'number') {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { Display } from '@/components/display';
|
||||
import { unitConversion } from '@workspace/ui/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
interface SubscribeDetailProps {
|
||||
@@ -37,11 +36,7 @@ export function SubscribeDetail({ subscribe }: Readonly<SubscribeDetailProps>) {
|
||||
<li>
|
||||
<span className='text-muted-foreground'>{t('connectionSpeed')}</span>
|
||||
<span>
|
||||
{subscribe?.speed_limit ? (
|
||||
`${unitConversion('bitsToMb', subscribe?.speed_limit)} Mbps`
|
||||
) : (
|
||||
<Display type='traffic' value={subscribe?.speed_limit} unlimited />
|
||||
)}
|
||||
<Display type='trafficSpeed' value={subscribe?.speed_limit} unlimited />
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user