Skip to content

Commit

Permalink
chore: create notifications page (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptosalomao authored Nov 8, 2024
1 parent 7987ce0 commit 02663d9
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 13 deletions.
17 changes: 17 additions & 0 deletions src/assets/create-bill-illustration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 13 additions & 11 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
Expand All @@ -18,6 +18,8 @@ const buttonVariants = cva(
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
filter:
"bg-transparent max-h-7 !py-1 !px-3 border-[1px] border-divider-100 rounded-[8px] text-text-300 text-xs font-medium hover:bg-transparent",
},
size: {
default: "h-10 px-4 py-2",
Expand All @@ -31,26 +33,26 @@ const buttonVariants = cva(
size: "default",
},
}
)
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
);
}
)
Button.displayName = "Button"
);
Button.displayName = "Button";

export { Button, buttonVariants }
export { Button, buttonVariants };
2 changes: 2 additions & 0 deletions src/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ const RESTORE_WITH_PRIVATE_KEY = "/private-key";
const RESTORE_WITH_SEED_PHRASE = "/seed-phrase";

const HOME = "/home";
const NOTIFICATIONS = "/notifications";

export default {
LOGIN,
UNLOCK,
HOME,
RESTORE_WITH_PRIVATE_KEY,
RESTORE_WITH_SEED_PHRASE,
NOTIFICATIONS,
};
10 changes: 9 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import ProfileInfo from "./pages/onboarding/ProfileInfo";

import Unlock from "./pages/Unlock";
import Login from "./pages/Login";
import RecoverWithPrivateKey from "./pages/RecoverWithPrivateKey";
import RecoverWithSeedPhrase from "./pages/RecoverWithSeedPhrase";
import Home from "./pages/Home";
import { Notifications, NotificationsEmpty } from "./pages/Notifications";
import routes from "./constants/routes";

import "./index.css";
Expand Down Expand Up @@ -52,6 +52,14 @@ const router = createBrowserRouter([
path: "/profile-info",
element: <ProfileInfo />,
},
{
path: routes.NOTIFICATIONS,
element: <Notifications />,
},
{
path: "/notifications-empty",
element: <NotificationsEmpty />,
},
]);

createRoot(document.getElementById("root")!).render(
Expand Down
214 changes: 214 additions & 0 deletions src/pages/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
import { FormattedMessage } from "react-intl";
import { XIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import createBillIllustration from "@/assets/create-bill-illustration.svg";

export function Notifications() {
return (
<div className="flex flex-col min-h-fit h-screen gap-6 py-12 px-6 w-full">
<div className="flex w-full">
<button className="flex items-center justify-center w-8 h-8 bg-[#1B0F00]/20 rounded-full border-[1px] border-[#1B0F00]/6">
<XIcon width={16} strokeWidth={1} color="#1B0F00" />
</button>
</div>

<div className="flex flex-col gap-3">
<div className="flex gap-1 items-center">
<h2 className="text-xl font-medium text-text-300">
<FormattedMessage
id="pages.notifications.title"
defaultMessage="Notifications"
description="Title for Notifications page"
/>
</h2>
<span className="text-xs font-medium text-text-200">(3)</span>
</div>

<div className="flex gap-2">
<Button variant="filter">
<FormattedMessage
id="pages.notifications.all"
defaultMessage="All"
description="Filter to view All notifications"
/>
</Button>
<Button variant="filter">
<FormattedMessage
id="pages.notifications.pay"
defaultMessage="Pay"
description="Filter to view pending Pay notifications"
/>
</Button>
<Button variant="filter">
<FormattedMessage
id="pages.notifications.accept"
defaultMessage="Accept"
description="Filter to view pending Accept notifications"
/>
</Button>
</div>
</div>

<div className="flex flex-col gap-3">
<h3 className="text-base font-medium text-text-300">Today</h3>

<div className="flex flex-col gap-2">
<div className="flex flex-col gap-2 bg-elevation-200 p-3 border-[1px] border-divider-75 rounded-[12px]">
<div className="px-3">
<span className="text-xs font-semibold text-[#816E57]">
Gooogle inc. has requested you to pay
</span>
</div>
<div className="flex flex-col p-4 gap-0.5 bg-elevation-50 border-[1px] border-divider-75 rounded-[12px]">
<span className="text-base font-medium text-text-300">
Hayek Ltd.
</span>

<div className="flex justify-between">
<span className="text-sm text-text-200">12-Nov-24</span>
<div className="flex gap-1 items-baseline">
<span className="text-sm text-signal-success">+12.49002</span>
<span className="text-xs text-text-300">USD</span>
</div>
</div>
</div>
</div>

<div className="flex flex-col gap-2 bg-elevation-200 p-3 border-[1px] border-divider-75 rounded-[12px]">
<div className="px-3">
<span className="text-xs font-semibold text-[#816E57]">
Gooogle inc. has requested you to pay
</span>
</div>
<div className="flex flex-col p-4 gap-0.5 bg-elevation-50 border-[1px] border-divider-75 rounded-[12px]">
<span className="text-base font-medium text-text-300">
Hayek Ltd.
</span>

<div className="flex justify-between">
<span className="text-sm text-text-200">12-Nov-24</span>
<div className="flex gap-1 items-baseline">
<span className="text-sm text-signal-success">+12.49002</span>
<span className="text-xs text-text-300">USD</span>
</div>
</div>
</div>
</div>

<div className="flex flex-col gap-2 bg-elevation-200 p-3 border-[1px] border-divider-75 rounded-[12px]">
<div className="px-3">
<span className="text-xs font-semibold text-[#816E57]">
Gooogle inc. has requested you to pay
</span>
</div>
<div className="flex flex-col p-4 gap-0.5 bg-elevation-50 border-[1px] border-divider-75 rounded-[12px]">
<span className="text-base font-medium text-text-300">
Hayek Ltd.
</span>

<div className="flex justify-between">
<span className="text-sm text-text-200">12-Nov-24</span>
<div className="flex gap-1 items-baseline">
<span className="text-sm text-signal-success">+12.49002</span>
<span className="text-xs text-text-300">USD</span>
</div>
</div>
</div>
</div>
</div>

<Button variant="link" className="text-text-200 font-medium text-sm">
<FormattedMessage
id="pages.notifications.history"
defaultMessage="See history"
description="Link to view notification history"
/>
</Button>
</div>
</div>
);
}

export function NotificationsEmpty() {
return (
<div className="flex flex-col min-h-fit h-screen gap-6 py-12 px-6 w-full">
<div className="flex w-full">
<button className="flex items-center justify-center w-8 h-8 bg-[#1B0F00]/20 rounded-full border-[1px] border-[#1B0F00]/6">
<XIcon width={16} strokeWidth={1} color="#1B0F00" />
</button>
</div>

<div className="flex flex-col gap-3">
<div className="flex gap-1 items-center">
<h2 className="text-xl font-medium text-text-300">
<FormattedMessage
id="pages.notifications.title"
defaultMessage="Notifications"
description="Title for Notifications page"
/>
</h2>
<span className="text-xs font-medium text-text-200">(0)</span>
</div>

<div className="flex gap-2">
<Button variant="filter">
<FormattedMessage
id="pages.notifications.all"
defaultMessage="All"
description="Filter to view All notifications"
/>
</Button>
<Button variant="filter">
<FormattedMessage
id="pages.notifications.pay"
defaultMessage="Pay"
description="Filter to view pending Pay notifications"
/>
</Button>
<Button variant="filter">
<FormattedMessage
id="pages.notifications.accept"
defaultMessage="Accept"
description="Filter to view pending Accept notifications"
/>
</Button>
</div>
</div>

<div className="flex flex-col gap-3 flex-1 items-center justify-center">
<div className="flex flex-col items-center gap-4 px-12">
<img src={createBillIllustration} className="mb-1" />

<div className="flex flex-col items-center gap-2">
<h3 className="text-xl font-medium text-text-300">
<FormattedMessage
id="pages.notifications.empty"
defaultMessage="No notifications"
description="Empty notifications message"
/>
</h3>

<span className="text-base text-text-200 text-center">
<FormattedMessage
id="pages.notifications.startCreating"
defaultMessage="Start creating a bill and distribute it to your contacts"
description="Description to start creating a bill"
/>
</span>
</div>

<Button
className="text-text-300 bg-transparent font-medium border-text-300 rounded-[8px] py-3 px-6 hover:bg-transparent"
variant="outline"
>
<FormattedMessage
id="pages.notifications.issueBill"
defaultMessage="Issue a bill"
description="Action to start creating a bill"
/>
</Button>
</div>
</div>
</div>
);
}
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ export default {
// Bitcredit Design System colors
divider: {
50: '#ECE8DE',
75: '#D9D5CC',
100: '#D1CCC1',
200: '#BAB4A9',
300: '#A39D91',
},
elevation: {
50: '#FEFBF1',
100: '#FAF7EF',
200: '#EEEBE3',
200: '#F6F2E7',
300: '#D1CCC1',
},
text: {
Expand Down

0 comments on commit 02663d9

Please sign in to comment.