Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle account page #858

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/public/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"about": "About",
"account_settings": "Account Settings",
"account_settings": "Account",
"connect": "Connect",
"conversational": "Conversational AI for everyone.",
"dashboard": "Dashboard",
Expand Down
12 changes: 4 additions & 8 deletions website/src/components/Survey/SurveyCard.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { Box, BoxProps, useColorModeValue } from "@chakra-ui/react";
import { PropsWithChildren } from "react";

interface SurveyCardProps {
className?: string;
children: React.ReactNode;
}

export const SurveyCard = (props: SurveyCardProps) => {
export const SurveyCard = (props: PropsWithChildren<{ className?: string }>) => {
const backgroundColor = useColorModeValue("white", "gray.700");

const BoxClasses: BoxProps = {
gap: "2",
borderRadius: "xl",
shadow: "base",
className: "p-4 sm:p-6",
className: "p-4 sm:p-6 " + (props.className ?? ""),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use clsx here to simplify the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of cousre!

};

return (
<Box bg={backgroundColor} {...BoxClasses}>
<Box as="section" bg={backgroundColor} {...BoxClasses}>
{props.children}
</Box>
);
Expand Down
35 changes: 25 additions & 10 deletions website/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Button } from "@chakra-ui/react";
import { Button, Divider, Flex, Grid, Icon, Text } from "@chakra-ui/react";
import Head from "next/head";
import Link from "next/link";
import { useSession } from "next-auth/react";
import React from "react";
export { getDefaultStaticProps as getStaticProps } from "src/lib/default_static_props";
import { MdOutlineEdit } from "react-icons/md";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are trying to use one type of icon. Can you switch to Feather icon here?

Copy link
Collaborator Author

@AbdBarho AbdBarho Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we talked about that.

is Feather icon installed ?

I will leave it to a different PR anyway

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using Font Awesome (react-icons/fa) but they don't don't have an outline edit icon. I think this is okay for now.

import { SurveyCard } from "src/components/Survey/SurveyCard";

export default function Account() {
const { data: session } = useSession();
Expand All @@ -20,15 +22,28 @@ export default function Account() {
content="Conversational AI for everyone. An open source project to create a chat enabled GPT LLM run by LAION and contributors around the world."
/>
</Head>
<div className="oa-basic-theme">
<main className="h-3/4 z-0 flex flex-col items-center justify-center">
<p>{session.user.name || "No username"}</p>
<Button>
<Link href="/account/edit">Edit Username</Link>
</Button>
<p>{session.user.email}</p>
</main>
</div>
<main className="oa-basic-theme p-6">
<Flex m="auto" className="max-w-7xl" alignContent="center">
<SurveyCard className="w-full">
<Text as="b" display="block" fontSize="2xl" py={2}>
Your Account
</Text>
<Divider />
<Grid gridTemplateColumns="repeat(2, max-content)" alignItems="center" gap={6} py={4}>
<Text as="b">Username</Text>
<Flex gap={2}>
{session.user.name ?? "(No username)"}
<Link href="/account/edit">
<Icon boxSize={5} as={MdOutlineEdit} />
</Link>
</Flex>
<Text as="b">Email</Text>
<Text>{session.user.email ?? "(No Email)"}</Text>
</Grid>
<p></p>
</SurveyCard>
</Flex>
</main>
</>
);
}