Projects STRLCPY gradejs Commits 58b3f1cb
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    packages/web/src/components/pages/Home.tsx
    1  -import React, { useCallback, useEffect } from 'react';
    2  -import { Error, Home } from 'components/layouts';
    3  -import { trackCustomEvent } from '../../services/analytics';
    4  -import {
    5  - useAppDispatch,
    6  - parseWebsite,
    7  - resetError,
    8  - useAppSelector,
    9  - homeDefaultSelector,
    10  -} from '../../store';
    11  -import { useNavigate } from 'react-router-dom';
     1 +import React from 'react';
     2 +import { Home } from 'components/layouts';
    12 3   
     4 +// TODO: add proper logic here when API integration will take place
    13 5  export function HomePage() {
    14  - const navigate = useNavigate();
    15  - const dispatch = useAppDispatch();
    16  - const state = useAppSelector(homeDefaultSelector);
    17  - 
    18  - const handleDetectStart = useCallback(async (data: { address: string }) => {
    19  - trackCustomEvent('HomePage', 'WebsiteSubmitted');
    20  - await dispatch(parseWebsite(data.address));
    21  - }, []);
    22  - 
    23  - if (state.isFailed) {
    24  - return (
    25  - <Error
    26  - host={state.hostname}
    27  - onReportClick={() => {
    28  - trackCustomEvent('HomePage', 'ClickReport');
    29  - }}
    30  - onRetryClick={() => {
    31  - trackCustomEvent('HomePage', 'ClickRetry');
    32  - dispatch(resetError());
    33  - }}
    34  - />
    35  - );
    36  - }
    37  - 
    38  - // TODO: properly handle history/routing
    39  - useEffect(() => {
    40  - if (!state.isLoading && !state.isFailed && state.hostname) {
    41  - navigate(`/w/${state.hostname}`, { replace: true });
    42  - }
    43  - });
    44  - 
    45  - return (
    46  - // TODO: pass proper props when API integration will take place
    47  - <Home />
    48  - );
     6 + return <Home />;
    49 7  }
    50 8   
Please wait...
Page is in error, reload to recover