Home.tsx raw

   1  import AppHeader from "src/components/AppHeader";
   2  import Loading from "src/components/Loading";
   3  import { Button } from "src/components/ui/button";
   4  import {
   5    Card,
   6    CardContent,
   7    CardHeader,
   8    CardTitle,
   9  } from "src/components/ui/card";
  10  import { useBalances } from "src/hooks/useBalances";
  11  import { useInfo } from "src/hooks/useInfo";
  12  import OnboardingChecklist from "src/screens/wallet/OnboardingChecklist";
  13  
  14  import React from "react";
  15  import { AppOfTheDayWidget } from "src/components/home/widgets/AppOfTheDayWidget";
  16  import { BlockHeightWidget } from "src/components/home/widgets/BlockHeightWidget";
  17  import { ForwardsWidget } from "src/components/home/widgets/ForwardsWidget";
  18  import { LatestUsedAppsWidget } from "src/components/home/widgets/LatestUsedAppsWidget";
  19  import { LightningMessageboardWidget } from "src/components/home/widgets/LightningMessageboardWidget";
  20  import { NewArrivalsWidget } from "src/components/home/widgets/NewArrivalsWidget";
  21  import { NodeStatusWidget } from "src/components/home/widgets/NodeStatusWidget";
  22  import { OnchainFeesWidget } from "src/components/home/widgets/OnchainFeesWidget";
  23  import { StoriesWidget } from "src/components/home/widgets/StoriesWidget";
  24  import { SupportAlbyWidget } from "src/components/home/widgets/SupportAlbyWidget";
  25  import { WhatsNewWidget } from "src/components/home/widgets/WhatsNewWidget";
  26  import { SearchInput } from "src/components/ui/search-input";
  27  
  28  function Home() {
  29    const { data: info } = useInfo();
  30    const { data: balances } = useBalances();
  31    const [isNerd, setNerd] = React.useState(false);
  32  
  33    if (!info || !balances) {
  34      return <Loading />;
  35    }
  36  
  37    return (
  38      <>
  39        <AppHeader
  40          title="Home"
  41          contentRight={<SearchInput placeholder="Search" />}
  42        />
  43        <div className="columns-1 lg:columns-2 gap-3 *:mb-3 *:break-inside-avoid">
  44          <OnboardingChecklist />
  45          <StoriesWidget />
  46          <WhatsNewWidget />
  47          <LatestUsedAppsWidget />
  48          <NewArrivalsWidget />
  49          <AppOfTheDayWidget />
  50          <SupportAlbyWidget />
  51          <LightningMessageboardWidget />
  52          <Card>
  53            <CardHeader>
  54              <div className="flex justify-between items-center">
  55                <CardTitle>Stats for nerds</CardTitle>
  56                <Button variant="secondary" onClick={() => setNerd(!isNerd)}>
  57                  {isNerd ? "Hide" : "Show"}
  58                </Button>
  59              </div>
  60            </CardHeader>
  61            {isNerd && (
  62              <CardContent>
  63                <div className="grid gap-3">
  64                  <NodeStatusWidget />
  65                  <BlockHeightWidget />
  66                  <OnchainFeesWidget />
  67                  <ForwardsWidget />
  68                </div>
  69              </CardContent>
  70            )}
  71          </Card>
  72        </div>
  73      </>
  74    );
  75  }
  76  
  77  export default Home;
  78