diff --git a/cubeseed_login/.env.example b/cubeseed_login/.env.example new file mode 100644 index 0000000..799f378 --- /dev/null +++ b/cubeseed_login/.env.example @@ -0,0 +1,2 @@ +API_USER= +API_PASSWORD= \ No newline at end of file diff --git a/cubeseed_login/.eslintrc.json b/cubeseed_login/.eslintrc.json new file mode 100644 index 0000000..2e1ef1d --- /dev/null +++ b/cubeseed_login/.eslintrc.json @@ -0,0 +1,21 @@ +{ + "extends": [ + "next/core-web-vitals", + "prettier", + "plugin:tailwindcss/recommended" + ], + "plugins": ["tailwindcss"], + "rules": { + "tailwindcss/no-custom-classname": "off", + "tailwindcss/classnames-order": "warn" + }, + "settings": { + "tailwindcss": { + "callees": ["cn"], + "config": "tailwind.config.js" + }, + "next": { + "rootDir": true + } + } +} diff --git a/cubeseed_login/.husky/pre-commit b/cubeseed_login/.husky/pre-commit new file mode 100755 index 0000000..e38d2f1 --- /dev/null +++ b/cubeseed_login/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +cd cubeseed_login +npx pretty-quick --staged +npm run pre-commit diff --git a/cubeseed_login/.prettierignore b/cubeseed_login/.prettierignore new file mode 100644 index 0000000..3aea320 --- /dev/null +++ b/cubeseed_login/.prettierignore @@ -0,0 +1,5 @@ +dist +node_modules +.next +build +.contentlayer \ No newline at end of file diff --git a/cubeseed_login/.prettierrc.json b/cubeseed_login/.prettierrc.json new file mode 100644 index 0000000..aff23b9 --- /dev/null +++ b/cubeseed_login/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "endOfLine": "lf", + "semi": false, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5", + "plugins": ["prettier-plugin-tailwindcss"] +} diff --git a/cubeseed_login/app/(processor)/dashboard/invoice/page.tsx b/cubeseed_login/app/(farmer)/dashboard/invoice/page.tsx similarity index 100% rename from cubeseed_login/app/(processor)/dashboard/invoice/page.tsx rename to cubeseed_login/app/(farmer)/dashboard/invoice/page.tsx diff --git a/cubeseed_login/app/(processor)/dashboard/layout.tsx b/cubeseed_login/app/(farmer)/dashboard/layout.tsx similarity index 63% rename from cubeseed_login/app/(processor)/dashboard/layout.tsx rename to cubeseed_login/app/(farmer)/dashboard/layout.tsx index 6e9421a..ef360f2 100644 --- a/cubeseed_login/app/(processor)/dashboard/layout.tsx +++ b/cubeseed_login/app/(farmer)/dashboard/layout.tsx @@ -1,15 +1,16 @@ -import Navbar from "@/component/navbar/Navbar"; -import DashboardNavbar from "@/component/dashboard/DashboardNavbar/DashboardNavbar"; +import Navbar from "@/component/navbar/Navbar" +import DashboardNavbar from "@/component/dashboard/DashboardNavbar/DashboardNavbar" +import DashboardSidePannel from "@/component/dashboard/DashboardSidePannel" export const metadata = { title: "Next.js", description: "Generated by Next.js", -}; +} export default function DashboardLayout({ children, }: { - children: React.ReactNode; + children: React.ReactNode }) { return (
@@ -17,11 +18,11 @@ export default function DashboardLayout({
-
- ); + ) } diff --git a/cubeseed_login/app/(processor)/dashboard/page.tsx b/cubeseed_login/app/(farmer)/dashboard/page.tsx similarity index 100% rename from cubeseed_login/app/(processor)/dashboard/page.tsx rename to cubeseed_login/app/(farmer)/dashboard/page.tsx diff --git a/cubeseed_login/app/(farmer)/dashboard/profiles/page.tsx b/cubeseed_login/app/(farmer)/dashboard/profiles/page.tsx new file mode 100644 index 0000000..9f734b7 --- /dev/null +++ b/cubeseed_login/app/(farmer)/dashboard/profiles/page.tsx @@ -0,0 +1,32 @@ +import UserProfile from '@cs/components/profile' +import React from 'react' +const base64 = require("base-64") + + +async function getUserProfile() { + const login = process.env.API_USER + const password = process.env.API_PASSWORD + + const response = await fetch( + "http://ec2-16-171-43-115.eu-north-1.compute.amazonaws.com:8000/api/userprofile/1", + { + headers: new Headers({ + "Authorization": `Basic ${base64.encode(`${login}:${password}`)}` + }), + cache: 'no-store' + } + ); + return await response.json(); +} + +async function ProfilePage() { + const profile = await getUserProfile() + + return ( +
+ +
+ ) +} + +export default ProfilePage \ No newline at end of file diff --git a/cubeseed_login/assets/svg/place_24px.svg b/cubeseed_login/assets/svg/place_24px.svg new file mode 100644 index 0000000..f6ee572 --- /dev/null +++ b/cubeseed_login/assets/svg/place_24px.svg @@ -0,0 +1,3 @@ + + + diff --git a/cubeseed_login/components/create-invoice.tsx b/cubeseed_login/components/create-invoice.tsx index 4cced00..8282b75 100644 --- a/cubeseed_login/components/create-invoice.tsx +++ b/cubeseed_login/components/create-invoice.tsx @@ -1,15 +1,15 @@ -"use client"; +"use client" -import Image from "next/image"; -import { useState } from "react"; -import billto from "@cs/public/bill-to.png"; -import payto from "@cs/public/pay-to.png"; -import Input from "./pieces/input"; -import Textarea from "./pieces/textarea"; -import Table from "./pieces/table"; -import CreateSucess from "./create-success"; -import { BillType, OrderType, SummaryType } from "@cs/types"; -import { DashboardHeading } from "./header"; +import Image from "next/image" +import { useState } from "react" +import billto from "@cs/public/bill-to.png" +import payto from "@cs/public/pay-to.png" +import Input from "./pieces/input" +import Textarea from "./pieces/textarea" +import Table from "./pieces/table" +import CreateSucess from "./create-success" +import { BillType, OrderType, SummaryType } from "@cs/types" +import { DashboardHeading } from "./header" export default function CreateInvoice() { const [shouldOpen, setOpen] = useState(false) @@ -26,14 +26,14 @@ export default function CreateInvoice() { name: "Address", value: "Building, Street Address City, State/Province, Country", }, - ]; + ] const renderBiller = (item: BillType) => ( {item.name} {item.value} - ); + ) const orderHeaders = [ "Service", @@ -41,7 +41,7 @@ export default function CreateInvoice() { "kg/ml", "Unit Price", "Total Price", - ]; + ] const orderData = [ { @@ -58,7 +58,7 @@ export default function CreateInvoice() { price: "#5.00", total: "₦250", }, - ]; + ] const renderOrder = (item: OrderType) => ( <> @@ -79,34 +79,34 @@ export default function CreateInvoice() { - ); + ) const summmaryData = [ { name: "Total Quantity:", value: "150kg" }, { name: "Subtotal:", value: "₦ 750.00" }, { name: "Total Tax:", value: "₦ 00.00" }, - ]; + ] const renderSummary = (item: SummaryType) => ( {item.name}: - {item.value} + {item.value} - ); + ) return ( -
+
{shouldOpen && ( -
-
+
+
setOpen(false)} > X @@ -123,25 +123,25 @@ export default function CreateInvoice() {

Add Information

-
+