diff --git a/website/src/components/Dashboard/WelcomeCard.tsx b/website/src/components/Dashboard/WelcomeCard.tsx new file mode 100644 index 00000000..8c7d687f --- /dev/null +++ b/website/src/components/Dashboard/WelcomeCard.tsx @@ -0,0 +1,43 @@ +import { Box, Divider, Text, useColorMode } from "@chakra-ui/react"; +import { useSession } from "next-auth/react"; + +export function WelcomeCard() { + const { colorMode } = useColorMode(); + const backgroundColor = colorMode === "light" ? "white" : "gray.700"; + const titleColor = colorMode === "light" ? "blue.500" : "blue.300"; + + const { data: session } = useSession(); + + if (!session) { + return <>; + } + if (session && session.user && session.user.isNew) + return ( + <> + + + + + Welcome, {session.user.name || "Contributor"}! + + + + + + Open Assistant is an open-source AI assistant that uses and trains advanced language models to + understand and respond to humans. + + + Complete tasks to help train the model and earn points. + + + + + ); +} diff --git a/website/src/components/Dashboard/index.ts b/website/src/components/Dashboard/index.ts index 6e110534..84a93850 100644 --- a/website/src/components/Dashboard/index.ts +++ b/website/src/components/Dashboard/index.ts @@ -1,2 +1,3 @@ export { LeaderboardTable } from "./LeaderboardTable"; export { TaskOption } from "./TaskOption"; +export { WelcomeCard } from "./WelcomeCard"; diff --git a/website/src/pages/dashboard.tsx b/website/src/pages/dashboard.tsx index 3971e125..78a47fd4 100644 --- a/website/src/pages/dashboard.tsx +++ b/website/src/pages/dashboard.tsx @@ -1,16 +1,10 @@ import { Flex } from "@chakra-ui/react"; import Head from "next/head"; -import { useSession } from "next-auth/react"; -import { LeaderboardTable, TaskOption } from "src/components/Dashboard"; +import { LeaderboardTable, TaskOption, WelcomeCard } from "src/components/Dashboard"; import { getDashboardLayout } from "src/components/Layout"; import { TaskCategory } from "src/components/Tasks/TaskTypes"; const Dashboard = () => { - const { data: session } = useSession(); - - // TODO(#670): Do something more meaningful when the user is new. - console.log(session?.user?.isNew); - return ( <> @@ -18,6 +12,7 @@ const Dashboard = () => { +