Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
Fixed several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddyLongLegs committed Jul 3, 2023
1 parent dd391fd commit 2b8cc8c
Show file tree
Hide file tree
Showing 18 changed files with 1,548 additions and 1,546 deletions.
11 changes: 3 additions & 8 deletions components/elements/Alert/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import React from 'react';
import React from "react";
function alert(props) {
let [open, setOpen] = React.useState(true);
if (!open) return null;
return (
<div
id="alert-1"
className="flex p-4 bg-yellow-300 dark:bg-yellow-200"
role="alert"
>
<div id="alert-1" className="flex p-4 py-8 bg-yellow-300 dark:bg-yellow-200 fixed z-[1000] w-full" role="alert">
<div className="ml-3 text-sm font-medium text-yellow-700 dark:text-yellow-800">
<strong>Alpha Alert</strong> SaveMyForm is still in alpha phase, things
may break, please handle us with care.
<strong>Alpha Alert</strong> SaveMyForm is still in alpha phase, things may break, please handle us with care.
</div>
<button
type="button"
Expand Down
349 changes: 174 additions & 175 deletions components/elements/Appbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,193 +13,192 @@ import { useRef } from "react";
import { CgProfile } from "react-icons/cg";
import { BiLogOut } from "react-icons/bi";
export default function index() {
const items = [
{
key: "1",
label: (
<Link onClick={() => router.push("/settings")}>
<span className="text-green-700 font-semibold">
{" "}
Profile
</span>
</Link>
),
icon: <CgProfile className="text-green-700" />,
},
{
key: "2",
danger: true,
label: (
<Popconfirm
placement="leftTop"
title="Are you sure you want to Log Out?"
// description="Are you sure? You want to delete this task"
onConfirm={() => {
removeLS("secret");
router.push("/");
setIsLoggedIn(false);
}}
okText="Yes"
cancelText="No"
>
logout
</Popconfirm>
),
icon: <BiLogOut />,
},
];
const { isLoggedIn, setIsLoggedIn } = useContext(UserContext);
const { active, setActive } = useContext(AppbarContext);
const router = useRouter();
const collapseItems = ["Home", "Dashboard", "Documentation", "FAQ"];
const [openCollapse, setOpenCollapse] = useState(false);
const navbarToggleRef = useRef();
const items = [
{
key: "1",
label: (
<Link onClick={() => router.push("/settings")}>
<span className="text-green-700 font-semibold"> Profile</span>
</Link>
),
icon: <CgProfile className="text-green-700" />,
},
{
key: "2",
danger: true,
label: (
<Popconfirm
placement="leftTop"
title="Are you sure you want to Log Out?"
// description="Are you sure? You want to delete this task"
onConfirm={() => {
removeLS("secret");
router.push("/");
setIsLoggedIn(false);
}}
okText="Yes"
cancelText="No"
>
logout
</Popconfirm>
),
icon: <BiLogOut />,
},
];
const { isLoggedIn, setIsLoggedIn } = useContext(UserContext);
const { active, setActive } = useContext(AppbarContext);
const router = useRouter();
const collapseItems = ["Home", "Dashboard", "Documentation", "FAQ"];
const [openCollapse, setOpenCollapse] = useState(false);
const navbarToggleRef = useRef();

return (
<Navbar variant="sticky" className="w-full opacity-100 bg-[#FFFFFF]">
<Navbar.Toggle
showIn={"sm"}
aria-label="toggle navigation"
className="mx-2 fill-[#00FF00]"
onChange={(isSelected) => setOpenCollapse(isSelected)}
ref={navbarToggleRef}
/>
<Navbar.Brand>
<Link onClick={() => router.push("/")}>
<Image src={Logo} className="h-16 w-16 mr-4" alt="Logo" />
</Link>
<Link onClick={() => router.push("/")}>
<Text b color="#001E2B" hideIn="xs" className="text-2xl">
SaveMyForm
</Text>
</Link>
</Navbar.Brand>
<Navbar.Content
activeColor={"success"}
hideIn="sm"
variant={"default"}
return (
<Navbar variant="sticky" className="w-full opacity-100 bg-[#FFFFFF]">
<Navbar.Toggle
showIn={"sm"}
aria-label="toggle navigation"
className="mx-2 fill-[#00FF00]"
onChange={(isSelected) => setOpenCollapse(isSelected)}
ref={navbarToggleRef}
/>
<Navbar.Brand>
<Link onClick={() => router.push("/")}>
<Image src={Logo} className="h-16 w-16 mr-4" alt="Logo" />
</Link>
<Link onClick={() => router.push("/")}>
<Text b color="#001E2B" hideIn="xs" className="text-2xl">
SaveMyForm
</Text>
</Link>
</Navbar.Brand>
<Navbar.Content activeColor={"success"} hideIn="sm" variant={"default"}>
<Navbar.Link
isActive={active.home}
onClick={() => {
router.push("/");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Home
</Navbar.Link>
<Navbar.Link
isActive={active.dashboard}
onClick={() => {
router.push("/dashboard");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Dashboard
</Navbar.Link>
<Navbar.Link
isActive={active.documentation}
onClick={() => {
router.push("/documentation");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Documentation
</Navbar.Link>
<Navbar.Link
isActive={active.faq}
onClick={() => {
router.push("/faq");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
FAQs
</Navbar.Link>
</Navbar.Content>
<Navbar.Content>
{!isLoggedIn ? (
<>
<Button
flat
auto
color="transparent"
className="text-lg font-semibold cursor-pointer hover:text-[#00694B] hover:bg-[#DEF7E5] rounded-md"
onClick={() => router.push("/signin")}
>
<Navbar.Link
isActive={active.home}
onClick={() => {
router.push("/");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Home
</Navbar.Link>
<Navbar.Link
isActive={active.dashboard}
onClick={() => {
router.push("/dashboard");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Dashboard
</Navbar.Link>
<Navbar.Link
isActive={active.documentation}
onClick={() => {
router.push("/documentation");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
Documentation
</Navbar.Link>
<Navbar.Link
isActive={active.faq}
onClick={() => {
router.push("/faq");
}}
className="hover:text-[#116148] text-lg font-semibold"
>
FAQs
</Navbar.Link>
</Navbar.Content>
<Navbar.Content>
{!isLoggedIn ? (
<>
<Button
flat
auto
color="transparent"
className="text-lg font-semibold cursor-pointer hover:text-[#00694B] hover:bg-[#DEF7E5] rounded-md"
onClick={() => router.push("/signin")}
>
Login
</Button>
<Button
auto
flat
bordered
color={"#001E2B"}
className="bg-[#01EC64] border-[#001E2B] text-[#001E2B] hover:bg-[#11FC74] rounded-md text-lg font-bold"
onClick={() => router.push("/signup")}
>
Sign Up
</Button>
</>
) : (
<>
<Dropdown
menu={{
items,
}}
>
<a onClick={(e) => e.preventDefault()}>
<Space className="font-semibold text-lg flex justify-between items-center">
My Account
<DownOutlined className="text-lg mb-1" />
</Space>
</a>
</Dropdown>
{/* <Popconfirm
placement="leftTop"
Login
</Button>
<Button
auto
flat
bordered
color={"#001E2B"}
className="bg-[#01EC64] border-[#001E2B] text-[#001E2B] hover:bg-[#11FC74] rounded-md text-lg font-bold"
onClick={() => router.push("/signup")}
>
Sign Up
</Button>
</>
) : (
<>
<Dropdown
menu={{
items,
}}
className="flex md:hidden"
>
<a onClick={(e) => e.preventDefault()}>
<Space className="font-semibold text-lg flex justify-between items-center">
My Account
<DownOutlined className="text-lg mb-1" />
</Space>
</a>
</Dropdown>
<Link onClick={() => router.push("/settings")} className="hidden md:block">
<Button
flat
auto
color="transparent"
className="text-lg font-semibold cursor-pointer hover:text-[#00694B] hover:bg-[#DEF7E5] rounded-md"
>
My Account
</Button>
</Link>
<Popconfirm
placement="bottomRight"
title="Are you sure you want to Log Out?"
// description="Are you sure? You want to delete this task"
onConfirm={() => {
removeLS('secret');
router.push('/');
removeLS("secret");
router.push("/");
setIsLoggedIn(false);
}}
okText="Yes"
cancelText="No"
className="hidden md:block"
>
<Button
auto
flat
bordered
color={'danger'}
className="border-red-500 text-red-500 hover:bg-red-500 hover:text-[#FFF] rounded-md text-lg"
className="text-lg font-semibold cursor-pointer hover:bg-[#FEEBE5] text-[#960606]"
color={"#970606"}
>
Log Out
Logout
</Button>
</Popconfirm> */}
</>
)}
</Navbar.Content>
<Navbar.Collapse className="text-[#00694B]">
{collapseItems.map((item, index) => (
<Navbar.CollapseItem key={item}>
<div
css={{
minWidth: "100%",
}}
onClick={() => {
router.push(
item.toLowerCase() === "home"
? "/"
: `/${item.toLowerCase()}`
);
openCollapse && navbarToggleRef.current.click();
}}
className="hover:text-[#00694B] duration-75 text-left"
>
{item}
</div>
</Navbar.CollapseItem>
))}
</Navbar.Collapse>
</Navbar>
);
</Popconfirm>
</>
)}
</Navbar.Content>
<Navbar.Collapse className="text-[#00694B]">
{collapseItems.map((item, index) => (
<Navbar.CollapseItem key={item}>
<div
css={{
minWidth: "100%",
}}
onClick={() => {
router.push(item.toLowerCase() === "home" ? "/" : `/${item.toLowerCase()}`);
openCollapse && navbarToggleRef.current.click();
}}
className="hover:text-[#00694B] duration-75 text-left"
>
{item}
</div>
</Navbar.CollapseItem>
))}
</Navbar.Collapse>
</Navbar>
);
}
Loading

1 comment on commit 2b8cc8c

@vercel
Copy link

@vercel vercel bot commented on 2b8cc8c Jul 3, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.