Skip to content

Commit

Permalink
add all missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomzy2223 committed Jan 10, 2025
1 parent b44bb60 commit b6a4184
Show file tree
Hide file tree
Showing 20 changed files with 234 additions and 92 deletions.
6 changes: 3 additions & 3 deletions src/components/client/HIIQHolders.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client'

import React, { useState, useCallback } from 'react'
import { columns } from '../dashboard/hiiq-table/columns'
import { DataTable } from '../dashboard/hiiq-table/data-table'
import {
useGetHIIQHoldersCountQuery,
Expand Down Expand Up @@ -83,13 +82,14 @@ export default function HIIQHolders() {
return (
<div className="flex flex-col gap-6 mt-6 lg:mt-0">
<div className="space-y-1">
<h1 className="text-base lg:text-2xl font-semibold">{t('title')}</h1>
<h1 className="text-base lg:text-2xl font-semibold">
{`HiIQ ${t('tokenHolders')}`}
</h1>
<p className="text-sm lg:text-base font-medium text-[#475569] dark:text-[#D2D2D2]">
{t('description')}
</p>
</div>
<DataTable
columns={columns}
data={displayData}
totalPages={totalPages}
currentPage={page}
Expand Down
6 changes: 3 additions & 3 deletions src/components/client/StakePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ const StakePage = () => {
}

const tabs = {
'Stake more IQ': {
stakeMore: {
label: 'stakeMore',
borderLeftRadius: '5',
borderRightColor: 'transparent',
},
'Increase Stake time': {
increaseTime: {
label: 'increaseTime',
borderRightRadius: '5',
borderLeftColor: 'transparent',
Expand Down Expand Up @@ -219,7 +219,7 @@ const StakePage = () => {
_selected={{ color: 'white', bg: 'brandText' }}
{...tabProps}
>
{t(label)}
{t(`tabs.${label}`)}
</Tab>
))}
</TabList>
Expand Down
6 changes: 4 additions & 2 deletions src/components/client/VotingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type VotingItemProps = {
active?: boolean
}
const VotingItem = (props: VotingItemProps) => {
const t = useTranslations('voting.votingItem')

const { item, active } = props
const date = new Date(item.end * 1000)

Expand Down Expand Up @@ -95,7 +97,7 @@ const VotingItem = (props: VotingItemProps) => {
<Flex alignItems="center" fontSize="sm" gap="1">
<IQLogo width={6} height={6} />
<Text ml="1" fontWeight="medium">
Created by{' '}
{t('createdBy')}
</Text>{' '}
<Link
href={`https://snapshot.org/#/profile/${item.author}`}
Expand All @@ -112,7 +114,7 @@ const VotingItem = (props: VotingItemProps) => {
ml="auto"
fontWeight="medium"
>
<b>{active ? 'Ends' : 'Ended'}:</b> {formattedDate}
<b>{active ? t('ends') : t('ended')}:</b> {formattedDate}
</Text>
</Flex>
<LinkOverlay
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/Exchanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ExchangeLink: React.FC<IconButtonProps> = ({
}

const Exchanges = () => {
const t = useTranslations('tokenData')
const t = useTranslations('dashboard.tokenData')

return (
<Flex
Expand Down
7 changes: 5 additions & 2 deletions src/components/dashboard/GraphComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import GraphLine from './GraphLine'
import GraphPeriodWrapper from './GraphPeriodWrapper'
import type { Dict } from '@chakra-ui/utils'
import { Link } from '@/i18n/routing'
import { useTranslations } from 'next-intl'

const GraphComponent = ({
graphTitle,
Expand Down Expand Up @@ -37,6 +38,8 @@ const GraphComponent = ({
isHolderGraph?: boolean
iqPrice?: number
}) => {
const t = useTranslations('treasury')

return (
<Box
rounded="lg"
Expand Down Expand Up @@ -214,7 +217,7 @@ const GraphComponent = ({
size={{ xl: 'xl', base: 'md' }}
/>
<Text mt="5" color="tooltipColor">
Fetching chart data
{t('fetchingChartData')}
</Text>
</Flex>
)}
Expand Down Expand Up @@ -273,7 +276,7 @@ const GraphComponent = ({
size={{ xl: 'xl', base: 'md' }}
/>
<Text mt="5" color="tooltipColor">
Fetching chart data
{t('fetchingChartData')}
</Text>
</Flex>
)}
Expand Down
15 changes: 9 additions & 6 deletions src/components/dashboard/TreasuryGraphTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
useGetGraphDataQuery,
} from '@/services/treasury/restApi'
import { getCurrentTreasuryValue } from '@/utils/getTreasuryValue'
import { useTranslations } from 'next-intl'

export const TreasuryGraphTable = ({
setTreasuryValue,
Expand All @@ -56,6 +57,8 @@ export const TreasuryGraphTable = ({
const { colorMode } = useColorMode()
const isTokenFetched = useRef(false)

const t = useTranslations('treasury.graphTable')

const onPieEnter = useCallback<OnPieEnter>(
(_, index) => {
setActiveIndex(index)
Expand Down Expand Up @@ -118,19 +121,19 @@ export const TreasuryGraphTable = ({
return (
<>
<PageHeader
header={`Tokens ($${formatValue(accountValue)})`}
header={`${t('tokens')} ($${formatValue(accountValue)})`}
portfolios={[
{
label: 'ETH Treasury',
label: t('label1'),
externalLink:
'https://debank.com/profile/0x56398b89d53e8731bca8c1b06886cfb14bd6b654',
tooltipLabel: 'Debank- ETH Treasury',
tooltipLabel: t('tooltipLabel1'),
},
{
label: 'FXTL Treasury',
label: t('label2'),
externalLink:
'https://debank.com/profile/0x5493F3dbE06aCCd1F51568213de839498a2A3b83',
tooltipLabel: 'Debank- FXTL Treasury',
tooltipLabel: t('tooltipLabel2'),
},
]}
/>
Expand Down Expand Up @@ -172,7 +175,7 @@ export const TreasuryGraphTable = ({
textAlign={i === arr.length - 1 ? 'center' : 'initial'}
fontSize={{ base: '10' }}
>
{key}
{t(key)}
</Th>
))}
</Tr>
Expand Down
12 changes: 7 additions & 5 deletions src/components/dashboard/hiiq-table/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export type HIIQHoldersProps = {
updated: number
}

export const columns: ColumnDef<HIIQHoldersProps>[] = [
export const getColumns = (
t: (key: string) => string,
): ColumnDef<HIIQHoldersProps>[] => [
{
accessorKey: 'rank',
header: 'Rank',
header: t('holders.hiiqTableHeader1'),
cell: ({ row }) => {
const ITEMS_PER_PAGE = 10
const page = Math.max(
Expand All @@ -30,7 +32,7 @@ export const columns: ColumnDef<HIIQHoldersProps>[] = [
},
{
accessorKey: 'address',
header: 'Address',
header: t('holders.hiiqTableHeader2'),
cell: ({ row }) => {
const [isCopied, setIsCopied] = useState(false)

Expand Down Expand Up @@ -81,7 +83,7 @@ export const columns: ColumnDef<HIIQHoldersProps>[] = [
className="p-0"
onClick={() => column.toggleSorting()}
>
HiIQ Balance
{t('holders.hiiqTableHeader3')}
<RiArrowDownSFill className="ml-2 h-4 w-4" />
</Button>
)
Expand All @@ -99,7 +101,7 @@ export const columns: ColumnDef<HIIQHoldersProps>[] = [
},
{
accessorKey: 'updated',
header: 'Date Updated',
header: t('holders.hiiqTableHeader4'),
cell: ({ row }) => {
return (
<div className="flex flex-row items-center gap-1 font-medium">
Expand Down
43 changes: 21 additions & 22 deletions src/components/dashboard/hiiq-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import {
getSortedRowModel,
useReactTable,
} from '@tanstack/react-table'

import { Input } from '@/components/ui/input'

import {
Table,
TableBody,
Expand All @@ -25,9 +23,10 @@ import { RiLoaderLine } from 'react-icons/ri'
import { Badge } from '@/components/ui/badge'
import { useGetHIIQHoldersCountQuery } from '@/services/holders'
import { TablePagination } from './pagination'
import { useTranslations } from 'next-intl'
import { getColumns } from './columns'

interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[]
data: TData[]
totalPages: number
currentPage: number
Expand All @@ -37,7 +36,6 @@ interface DataTableProps<TData, TValue> {
}

export function DataTable<TData, TValue>({
columns,
data,
totalPages,
currentPage,
Expand All @@ -46,10 +44,12 @@ export function DataTable<TData, TValue>({
isSearching,
}: DataTableProps<TData, TValue>) {
const [sorting, setSorting] = React.useState<SortingState>([])
const t = useTranslations('hiiq')
const columns = getColumns(t)

const table = useReactTable({
data,
columns,
columns: columns as ColumnDef<TData, TValue>[],
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
onSortingChange: setSorting,
Expand All @@ -60,10 +60,11 @@ export function DataTable<TData, TValue>({
})

const { data: count, isLoading } = useGetHIIQHoldersCountQuery()

return (
<div className="rounded-xl border mb-20">
<div className="border-b p-4 flex flex-row gap-4 items-center">
<h1>HiIQ Holders</h1>
<h1>{t('tabs.hiiqHoldersLabel')}</h1>
<Badge
className="bg-brand-50 text-brand-500 dark:text-brand-800 border-0 py-1 px-1.5"
variant="outline"
Expand All @@ -73,12 +74,12 @@ export function DataTable<TData, TValue>({
) : (
count ?? 0
)}{' '}
Token Holders
{t('holders.tokenHolders')}
</Badge>
</div>
<div className="flex items-center justify-end p-4">
<Input
placeholder="Search by address..."
placeholder={t('holders.searchPlaceholder')}
value={searchTerm}
onChange={(event) => onSearch(event.target.value)}
className="max-w-sm bg-transparent"
Expand All @@ -88,18 +89,16 @@ export function DataTable<TData, TValue>({
<TableHeader className="bg-gray-50 dark:bg-gray-800 border-t">
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
return (
<TableHead key={header.id}>
{header.isPlaceholder
? null
: flexRender(
header.column.columnDef.header,
header.getContext(),
)}
</TableHead>
)
})}
{headerGroup.headers.map((header) => (
<TableHead key={header.id}>
{header.isPlaceholder
? null
: flexRender(
header.column.columnDef.header,
header.getContext(),
)}
</TableHead>
))}
</TableRow>
))}
</TableHeader>
Expand All @@ -109,7 +108,7 @@ export function DataTable<TData, TValue>({
<TableCell colSpan={columns.length} className="h-24 text-center">
<div className="flex items-center justify-center">
<RiLoaderLine className="animate-spin mr-2" size={18} />
Searching...
{t('holders.hiiqTableStatus.searching')}
</div>
</TableCell>
</TableRow>
Expand All @@ -129,7 +128,7 @@ export function DataTable<TData, TValue>({
) : (
<TableRow>
<TableCell colSpan={columns.length} className="h-24 text-center">
No results.
{t('holders.hiiqTableStatus.noResults')}
</TableCell>
</TableRow>
)}
Expand Down
5 changes: 4 additions & 1 deletion src/components/dashboard/hiiq-table/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useSearchParams, useRouter } from 'next/navigation'
import { Button } from '@/components/ui/button'
import { Table } from '@tanstack/react-table'
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react'
import { useTranslations } from 'next-intl'

interface PaginationProps<T> {
table: Table<T>
Expand All @@ -16,6 +17,8 @@ export function TablePagination<T>({
currentPage,
totalPages,
}: PaginationProps<T>) {
const t = useTranslations('hiiq.holders')

const router = useRouter()
const searchParams = useSearchParams()

Expand Down Expand Up @@ -91,7 +94,7 @@ export function TablePagination<T>({

<div className="lg:hidden flex items-center">
<span className="text-sm">
Page {currentPage} of {totalPages}
{t('page')} {currentPage} {t('of')} {totalPages}
</span>
</div>

Expand Down
5 changes: 4 additions & 1 deletion src/components/elements/PieChart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ChartConstantNonTreasury,
} from '@/types/chartType'
import RenderActiveShape from './RenderActiveShape'
import { useTranslations } from 'next-intl'

const Chart = ({
chartData,
Expand All @@ -18,6 +19,8 @@ const Chart = ({
CHART_COLORS,
isTreasuryPage = false,
}: ChartType) => {
const t = useTranslations('treasury')

return (
<Box>
{chartData.length > 0 ? (
Expand Down Expand Up @@ -75,7 +78,7 @@ const Chart = ({
>
<VStack>
<CircularProgress isIndeterminate color="brandText" />
<Text color="tooltipColor">Fetching chart data</Text>
<Text color="tooltipColor">{t('fetchingChartData')}</Text>
</VStack>
</Box>
)}
Expand Down
Loading

0 comments on commit b6a4184

Please sign in to comment.