Skip to content

Commit

Permalink
feat: add create post page
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadxgani committed Feb 28, 2023
1 parent 95abde5 commit f6ec209
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
27 changes: 0 additions & 27 deletions pages/[username]/[post].tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { GetServerSidePropsContext } from "next";
import { Heading } from "@chakra-ui/react";
import MainLayout from "components/layout/main.layout";
import { Query } from "generated-types";
import { addApolloState, initializeApollo } from "lib/GraphQL/apollo";
import { CURRENT_USER } from "lib/GraphQL/Queries";
import { useRouter } from "next/router";
import { withWrapper } from "src/hooks/withWrapper";

const Profile = () => {
const router = useRouter();
Expand All @@ -18,26 +13,4 @@ const Profile = () => {
);
};

// export const getServerSideProps = async (context: GetServerSidePropsContext) => {
// const client = initializeApollo({ headers: context?.req?.headers });

// try {
// await client.query<Query>({
// query: CURRENT_USER,
// });

// return addApolloState(client, {
// props: {},
// });
// } catch {
// return {
// props: {},
// redirect: {
// destination: "/login",
// permanent: false,
// },
// };
// }
// };

export default Profile;
12 changes: 12 additions & 0 deletions pages/new.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Heading } from "@chakra-ui/react";
import MainLayout from "components/layout/main.layout";

const NewPost = () => {
return (
<MainLayout title={"New Post"}>
<Heading>Create Post Page</Heading>
</MainLayout>
);
};

export default NewPost;
10 changes: 5 additions & 5 deletions src/components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export const Navbar = () => {
<HStack spacing={5}>
{data?.loggedInAuthor ? (
<>
<Tabs>
<TabList>
<Tab>New Post</Tab>
</TabList>
</Tabs>
<NextLink href="/new" passHref legacyBehavior>
<Button as="a" colorScheme="teal" variant="outline">
New Post
</Button>
</NextLink>
<Menu placement="bottom-end">
<MenuButton>
<Avatar src={"/images/profile.jpg"} size={"md"} />
Expand Down

0 comments on commit f6ec209

Please sign in to comment.