Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions apps/web/app/[locale]/components/GameTime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { useContext, useMemo } from 'react';
import { RoundsContext } from '../../../../context/RoundsContext';
import { useMassacre } from '../../../../hooks/useMassacre';
import { useFormatter } from '@lawallet/react';
import { useLocale } from 'next-intl';
import { useLocale, useTranslations } from 'next-intl';
import type { AvailableLanguages } from '@lawallet/utils/types';

export function GameTime() {
const t = useTranslations();
const { currentBlock, status } = useMassacre();
const { currentRound } = useContext(RoundsContext);
const locale = useLocale() as AvailableLanguages;
Expand Down Expand Up @@ -42,19 +43,23 @@ export function GameTime() {
<Flex flex={1} justify="space-between" align="center" gap={16}>
<Flex direction="column">
<Heading as="h4" color={appTheme.colors.warning}>
Ronda {round! + 1}
{t('ROUND')} {round! + 1}
{status === 'FREEZE' && ' - Freezado'}
</Heading>
<Flex align="center" gap={4}>
{currentRound && <Text size="small">Massacre en #{formatAmount(currentRound!.height)}</Text>}
{currentRound && (
<Text size="small">
{t('MASSACRE_AT')} #{formatAmount(currentRound!.height)}
</Text>
)}
</Flex>
</Flex>
{time && (
<Flex direction="column" align="end">
<Text>Próxima en:</Text>
<Text>{t('NEXT_ROUND')}:</Text>
<Flex align="center" justify="end" gap={4}>
<Heading as="h4" color={appTheme.colors.warning}>
~ {formatTime(time!)}
~ {formatTime(time!, t('HOURS_LONG'), t('MINUTES_LONG'))}
</Heading>
</Flex>
</Flex>
Expand All @@ -66,6 +71,6 @@ export function GameTime() {
);
}

function formatTime(min: number): string {
return min > 120 ? `${(min / 60).toFixed(0)} horas` : `${min} minutos`;
function formatTime(min: number, hours: string, minutes: string): string {
return min > 120 ? `${(min / 60).toFixed(0)} ${hours}` : `${min} ${minutes}`;
}
7 changes: 6 additions & 1 deletion apps/web/translations/en/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,10 @@
"POWER": "Power",
"TICKET": "Ticket",
"AND": "and",
"INSCRIPTION_CLOSED_TEXT": "Players inscription closed. Waiting for rounds schedule."
"INSCRIPTION_CLOSED_TEXT": "Players inscription closed. Waiting for rounds schedule.",
"MASSACRE_AT": "Massacre at",
"NEXT_ROUND": "Next in",
"HOURS_LONG": "hours",
"MINUTES_LONG": "minutes",
"ROUND": "Round"
}
7 changes: 6 additions & 1 deletion apps/web/translations/es/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,10 @@
"POWER": "Poder",
"TICKET": "Ticket",
"AND": "y",
"INSCRIPTION_CLOSED_TEXT": "Lista de participantes cerrada. Esperando calendario de rondas."
"INSCRIPTION_CLOSED_TEXT": "Lista de participantes cerrada. Esperando calendario de rondas.",
"MASSACRE_AT": "Massacre en",
"NEXT_ROUND": "Próxima en",
"HOURS_LONG": "horas",
"MINUTES_LONG": "minutos",
"ROUND": "Ronda"
}