export function SkillHunterDashboardPage()

in web/src/pages/SH-Dashboard/sh-dashboard.tsx [9:49]


export function SkillHunterDashboardPage() {
    const { path } = useRouteMatch();
    const history = useHistory();
    const [filesIds, setFilesId] = useState<unknown>();

    useEffect(() => {
        setFilesId(history.location.state);
        history.location.state = undefined;
    }, [history.location.state]);

    const onJobWorkEnded = () => {
        setFilesId(null);
    };

    const handleTaskClick = (id: number) => {
        history.push(`dashboard/${id}`);
    };

    const handleUploadButtonClick = useCallback(() => {
        history.push(`${path}/upload`);
    }, []);

    return (
        <Switch>
            <Route exact path={path}>
                <div className={styles['main-container']}>
                    <FlexRow cx={styles['main-container-header']}>
                        <h1>My documents</h1>
                        <Button caption="Upload" onClick={handleUploadButtonClick} />
                    </FlexRow>
                    <SHDashboardTableConnector
                        onJobAdded={onJobWorkEnded}
                        filesIds={filesIds}
                        onRowClick={handleTaskClick}
                    />
                </div>
            </Route>
            <Redirect to={path} />
        </Switch>
    );
}