import React from "react"; import { useDispatch } from "react-redux"; import { useTranslation } from "react-i18next"; import posthog from "posthog-js"; import { I18nKey } from "#/i18n/declaration"; import { setImportedProjectZip } from "#/state/initial-query-slice"; import { convertZipToBase64 } from "#/utils/convert-zip-to-base64"; import { useGitHubUser } from "#/hooks/query/use-github-user"; import { useGitHubAuthUrl } from "#/hooks/use-github-auth-url"; import { useConfig } from "#/hooks/query/use-config"; import { useAuth } from "#/context/auth-context"; import { ImportProjectSuggestionBox } from "../../components/features/suggestions/import-project-suggestion-box"; import { GitHubRepositoriesSuggestionBox } from "#/components/features/github/github-repositories-suggestion-box"; import { HeroHeading } from "#/components/shared/hero-heading"; import { TaskForm } from "#/components/shared/task-form"; function Home() { const { t } = useTranslation(); const { gitHubToken } = useAuth(); const dispatch = useDispatch(); const formRef = React.useRef(null); const { data: config } = useConfig(); const { data: user } = useGitHubUser(); const gitHubAuthUrl = useGitHubAuthUrl({ gitHubToken, appMode: config?.APP_MODE || null, gitHubClientId: config?.GITHUB_CLIENT_ID || null, }); const latestConversation = localStorage.getItem("latest_conversation_id"); return (
formRef.current?.requestSubmit()} gitHubAuthUrl={gitHubAuthUrl} user={user || null} /> { if (event.target.files) { const zip = event.target.files[0]; dispatch(setImportedProjectZip(await convertZipToBase64(zip))); posthog.capture("zip_file_uploaded"); formRef.current?.requestSubmit(); } else { // TODO: handle error } }} />
{latestConversation && (

{t(I18nKey.LANDING$OR)}  {t(I18nKey.LANDING$RECENT_CONVERSATION)}

)}
); } export default Home;