turash/bugulma/frontend/components/map/HistoricalContextAI.tsx
Damir Mukimov 6347f42e20
Consolidate repositories: Remove nested frontend .git and merge into main repository
- Remove nested git repository from bugulma/frontend/.git
- Add all frontend files to main repository tracking
- Convert from separate frontend/backend repos to unified monorepo
- Preserve all frontend code and development history as tracked files
- Eliminate nested repository complexity for simpler development workflow

This creates a proper monorepo structure with frontend and backend
coexisting in the same repository for easier development and deployment.
2025-11-25 06:02:57 +01:00

47 lines
1.5 KiB
TypeScript

import React, { useCallback } from 'react';
import { HistoricalLandmark } from '@/types.ts';
import Button from '@/components/ui/Button.tsx';
import Spinner from '@/components/ui/Spinner.tsx';
import ErrorMessage from '@/components/ui/ErrorMessage.tsx';
import { useTranslation } from '@/hooks/useI18n.tsx';
import { useGenerateHistoricalContext } from '@/hooks/useGemini.ts';
interface HistoricalContextAIProps {
landmark: HistoricalLandmark;
}
const HistoricalContextAI = ({ landmark }: HistoricalContextAIProps) => {
const { t } = useTranslation();
const { data, error, isPending, refetch } = useGenerateHistoricalContext(landmark, t);
const handleGenerate = useCallback(() => {
refetch();
}, [refetch]);
return (
<div>
{!data && (
<div className="text-center">
<p className="mb-2 text-sm text-muted-foreground">{t('historicalContext.prompt')}</p>
<Button onClick={handleGenerate} disabled={isPending} size="sm">
{isPending ? <Spinner className="h-4 w-4" /> : t('historicalContext.generateButton')}
</Button>
</div>
)}
{error && <ErrorMessage message={error.message} />}
{data && (
<div>
<h4 className="mb-2 text-base font-semibold">{t('historicalContext.title')}</h4>
<blockquote className="border-l-4 border-primary pl-4 italic text-muted-foreground">
{data}
</blockquote>
</div>
)}
</div>
);
};
export default React.memo(HistoricalContextAI);