index.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Match, Switch } from "solid-js"
  2. import { useAccount } from "../components/context-account"
  3. import { Navigate } from "@solidjs/router"
  4. import { IconLogo } from "../ui/svg"
  5. import styles from "./lander.module.css"
  6. import { useOpenAuth } from "../components/context-openauth"
  7. export default function Index() {
  8. const auth = useOpenAuth()
  9. const account = useAccount()
  10. return (
  11. <Switch>
  12. <Match when={account.current}>
  13. <Navigate href={`/${account.current!.workspaces[0].id}`} />
  14. </Match>
  15. <Match when={!account.current}>
  16. <div class={styles.lander}>
  17. <div data-slot="hero">
  18. <section data-slot="top">
  19. <div data-slot="logo">
  20. <IconLogo />
  21. </div>
  22. <h1>opencode Gateway Console</h1>
  23. </section>
  24. <section data-slot="cta">
  25. <div>
  26. <span onClick={() => auth.authorize({ provider: "github" })}>Sign in with GitHub</span>
  27. </div>
  28. <div>
  29. <span onClick={() => auth.authorize({ provider: "google" })}>Sign in with Google</span>
  30. </div>
  31. </section>
  32. </div>
  33. </div>
  34. </Match>
  35. </Switch>
  36. )
  37. }