'use client'

import {useLocale} from 'next-intl'

import {Link} from '@/i18n/routing'

export default function TempComponent(data: {data: object[]}) {
	const locale = useLocale()
	/*console.log(data)*/

	const items = data?.data as object[]

	return (
		<>
			<code>{locale}</code>
			{/*<pre>{JSON.stringify(data, null, 2)}</pre>*/}

			<pre>
				{items.map((item: any) => (
					<div key={item.id}>
						<Link
							href={`/category/${item.id}-${item.locales[locale === 'uk' ? 0 : 1].slug}`}
						>
							{item.locales[locale === 'uk' ? 0 : 1].title}
						</Link>
					</div>
				))}
			</pre>
		</>
	)
}
