import { APIClient } from "../api/ApiClient";
import { MatrixSyncApi } from "../api/MatrixSyncApi";
import { AsyncWidget } from "../widgets/AsyncWidget";
import { useUserInfo } from "../widgets/dashboard/BaseAuthenticatedPage";
import { NotLinkedAccountMessage } from "../widgets/NotLinkedAccountMessage";

export function HomeRoute(): React.ReactElement {
  const user = useUserInfo();

  if (!user.info.matrix_user_id) return <NotLinkedAccountMessage />;

  return (
    <p>
      Todo home route{" "}
      <AsyncWidget
        loadKey={1}
        errMsg="Failed to start sync thread!"
        load={MatrixSyncApi.Start}
        build={() => <>sync started</>}
      />
    </p>
  );
}
