-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete dashboard page design and create site added functionality
- Loading branch information
Showing
9 changed files
with
233 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { createSite } from "@/lib/db"; | ||
import { useRef } from "react"; | ||
import { useForm } from "react-hook-form"; | ||
|
||
const { | ||
Button, | ||
Modal, | ||
ModalOverlay, | ||
ModalContent, | ||
ModalHeader, | ||
ModalCloseButton, | ||
ModalBody, | ||
FormControl, | ||
FormLabel, | ||
Input, | ||
ModalFooter, | ||
useDisclosure, | ||
} = require("@chakra-ui/react"); | ||
|
||
const AddSiteModal = () => { | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
|
||
const initialRef = useRef(null); | ||
// const finalRef = useRef(null); | ||
|
||
const { handleSubmit, register, reset } = useForm(); | ||
const onSubmit = (values) => { | ||
createSite(values); | ||
// onClose(); | ||
reset(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Button fontWeight={600} maxW="200px" onClick={onOpen}> | ||
Add Your First Site | ||
</Button> | ||
|
||
<Modal | ||
initialFocusRef={initialRef} | ||
// finalFocusRef={finalRef} | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
> | ||
<ModalOverlay /> | ||
<ModalContent as="form" onSubmit={handleSubmit(onSubmit)}> | ||
<ModalHeader fontWeight="bold">Add Site</ModalHeader> | ||
<ModalCloseButton /> | ||
<ModalBody pb={6}> | ||
<FormControl> | ||
<FormLabel>Name</FormLabel> | ||
<Input | ||
ref={initialRef} | ||
placeholder="My Site" | ||
{...register("site", { required: true })} | ||
/> | ||
</FormControl> | ||
|
||
<FormControl mt={4}> | ||
<FormLabel>Link</FormLabel> | ||
<Input | ||
placeholder="https://website.com" | ||
{...register("link", { required: true })} | ||
/> | ||
</FormControl> | ||
</ModalBody> | ||
|
||
<ModalFooter> | ||
<Button onClick={onClose} mr={3}> | ||
Cancel | ||
</Button> | ||
<Button backgroundColor="#99FFFE" color="#194D4C" type="submit"> | ||
Create | ||
</Button> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddSiteModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { useAuth } from "@/lib/auth"; | ||
import { | ||
Avatar, | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
Flex, | ||
Heading, | ||
Stack, | ||
} from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
const DashboardShell = ({ children }) => { | ||
const auth = useAuth(); | ||
|
||
return ( | ||
<Flex direction="column"> | ||
<Flex | ||
backgroundColor="white" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
py={4} | ||
px={8} | ||
> | ||
<Stack isInline spacing={4} align="center"> | ||
<Link href="#">Feedback</Link> | ||
<Link href="#">Sites</Link> | ||
</Stack> | ||
<Flex alignItems="center"> | ||
<Link mr={4} href="#"> | ||
Account | ||
</Link> | ||
<Avatar size="sm" src={auth.user.photoURL} /> | ||
</Flex> | ||
</Flex> | ||
<Flex backgroundColor="gray.100" p={8} height="100%"> | ||
<Flex maxWidth="800px" ml="auto" mr="auto" direction="column" w="100%"> | ||
<Breadcrumb> | ||
<BreadcrumbItem isCurrentPage> | ||
<BreadcrumbLink color="gray.700" fontSize="sm"> | ||
Sites | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
</Breadcrumb> | ||
<Heading color="black" mb={4}> | ||
Sites | ||
</Heading> | ||
{children} | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default DashboardShell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Box, Button, Flex, Heading, Text } from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import AddSiteModal from "./AddSiteModal"; | ||
import DashboardShell from "./DashboardShell"; | ||
|
||
const EmptyState = () => { | ||
return ( | ||
<DashboardShell> | ||
<Flex | ||
width="100%" | ||
backgroundColor="white" | ||
p={16} | ||
borderRadius="8px" | ||
direction="column" | ||
alignItems="center" | ||
> | ||
<Heading size="lg" mb={2}> | ||
You haven't added any sites | ||
</Heading> | ||
<Text mb={4}>Welcome. Let's get started</Text> | ||
<AddSiteModal /> | ||
</Flex> | ||
</DashboardShell> | ||
); | ||
}; | ||
|
||
export default EmptyState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Box, Button, Heading, Text } from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import DashboardShell from "./DashboardShell"; | ||
|
||
const FreePlanEmptyState = () => { | ||
return ( | ||
<DashboardShell> | ||
<Box width="100%" backgroundColor="white"> | ||
<Heading size="md">Get feedback on your site instantly.</Heading> | ||
<Text>Start today, then grow with us.</Text> | ||
<Button>Upgrade to Starter</Button> | ||
</Box> | ||
</DashboardShell> | ||
); | ||
}; | ||
|
||
export default FreePlanEmptyState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"next": "13.0.2", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-hook-form": "^7.41.5", | ||
"sass": "^1.57.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import EmptyState from "@/components/EmptyState"; | ||
import Head from "next/head"; | ||
import { useAuth } from "../lib/auth"; | ||
|
||
const Dashboard = () => { | ||
const auth = useAuth(); | ||
|
||
if (!auth.user) { | ||
return "Loading..."; | ||
} | ||
return ( | ||
<> | ||
<Head> | ||
<title>Dashboard</title> | ||
</Head> | ||
<EmptyState />; | ||
</> | ||
); | ||
}; | ||
|
||
export default Dashboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81994c6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rapid-review – ./
rapid-review-git-main-hrshainik.vercel.app
rapid-review-hrshainik.vercel.app
rapid-review.vercel.app