diff --git a/.gitignore b/.gitignore
index e27c0b5..29d205f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ dist
dist-ssr
*.local
+frontend/.env
+
# Editor directories and files
.vscode/*
!.vscode/extensions.json
diff --git a/backend/target/classes/application.yaml b/backend/target/classes/application.yaml
index 674af39..d376fc1 100644
--- a/backend/target/classes/application.yaml
+++ b/backend/target/classes/application.yaml
@@ -3,6 +3,10 @@ server:
error:
include-message: always
+cors:
+ allowed-origins: "*"
+ allowed-methods: "*"
+
spring:
datasource:
url:
diff --git a/frontend/react/src/App.jsx b/frontend/react/src/App.jsx
index 6640bcb..73d92de 100644
--- a/frontend/react/src/App.jsx
+++ b/frontend/react/src/App.jsx
@@ -1,25 +1,60 @@
-import { useEffect } from 'react'
+import { useEffect, useState } from "react";
-import SidebarWithHeader from './shared/Sidebar'
-import { getCustomers } from './services/client'
+import SidebarWithHeader from "./components/shared/Sidebar";
+import { getCustomers } from "./services/client";
+import { Spinner } from "@chakra-ui/react";
+import { Wrap, WrapItem } from '@chakra-ui/react'
+import SocialProfileWithImage from "./components/shared/CustomerCard";
function App() {
+ const [customers, setCustomers] = useState([]);
+ const [loading, setLoading] = useState(false);
useEffect(() => {
- getCustomers().then((res) => {
- console.log(res)
- })
- .catch((e) => {
- console.log(e)
- })
- }, [])
+ setLoading(true);
+
+ getCustomers()
+ .then((res) => {
+ console.log(res);
+ setCustomers(res.data);
+ })
+ .catch((e) => {
+ console.log(e);
+ })
+ .then(() => {
+ setLoading(false);
+ });
+ }, []);
return (
<>
+ {customers.length === 0 && loading ? (
+
+ ) : (
+ <>
+
+ {customers.map((customer) => (
+
+
+
+ ))}
+
+ >
+ )}
>
- )
+ );
}
-export default App
+export default App;
diff --git a/frontend/react/src/UserProfile.jsx b/frontend/react/src/UserProfile.jsx
new file mode 100644
index 0000000..5b13b48
--- /dev/null
+++ b/frontend/react/src/UserProfile.jsx
@@ -0,0 +1,9 @@
+function UserProfile() {
+ return (
+
+ UserProfile
+
+ )
+}
+
+export default UserProfile
\ No newline at end of file
diff --git a/frontend/react/src/components/shared/CustomerCard.jsx b/frontend/react/src/components/shared/CustomerCard.jsx
new file mode 100644
index 0000000..5a038ae
--- /dev/null
+++ b/frontend/react/src/components/shared/CustomerCard.jsx
@@ -0,0 +1,59 @@
+'use client'
+
+import {
+ Heading,
+ Avatar,
+ Box,
+ Center,
+ Image,
+ Flex,
+ Text,
+ Stack,
+ Button,
+ useColorModeValue,
+} from '@chakra-ui/react'
+
+export default function SocialProfileWithImage({ name, email, age }) {
+ return (
+
+
+
+
+
+
+
+
+
+
+ {name}
+
+ {email}
+ {age}
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/frontend/react/src/components/shared/Sidebar.jsx b/frontend/react/src/components/shared/Sidebar.jsx
new file mode 100644
index 0000000..426fc83
--- /dev/null
+++ b/frontend/react/src/components/shared/Sidebar.jsx
@@ -0,0 +1,212 @@
+'use client'
+
+import {
+ IconButton,
+ Avatar,
+ Box,
+ CloseButton,
+ Flex,
+ HStack,
+ VStack,
+ Icon,
+ useColorModeValue,
+ Text,
+ Drawer,
+ DrawerContent,
+ useDisclosure,
+ Menu,
+ MenuButton,
+ MenuDivider,
+ MenuItem,
+ MenuList,
+} from '@chakra-ui/react'
+import {
+ FiHome,
+ FiTrendingUp,
+ FiCompass,
+ FiStar,
+ FiSettings,
+ FiMenu,
+ FiBell,
+ FiChevronDown,
+} from 'react-icons/fi'
+
+import { Image } from '@chakra-ui/react'
+
+const LinkItems = [
+ { name: 'Home', icon: FiHome },
+ { name: 'Trending', icon: FiTrendingUp },
+ { name: 'Explore', icon: FiCompass },
+ { name: 'Favourites', icon: FiStar },
+ { name: 'Settings', icon: FiSettings },
+]
+
+const SidebarContent = ({ onClose, ...rest }) => {
+ return (
+
+
+
+
+
+ Dashboard
+
+
+
+
+ {LinkItems.map((link) => (
+
+ {link.name}
+
+ ))}
+
+ )
+}
+
+const NavItem = ({ icon, children, ...rest }) => {
+ return (
+
+
+ {icon && (
+
+ )}
+ {children}
+
+
+ )
+}
+
+const MobileNav = ({ onOpen, ...rest }) => {
+ return (
+
+ }
+ />
+
+
+ Logo
+
+
+
+ } />
+
+
+
+
+
+ )
+}
+
+const SidebarWithHeader = ({...props}) => {
+ const { isOpen, onOpen, onClose } = useDisclosure()
+
+ return (
+
+ onClose} display={{ base: 'none', md: 'block' }} />
+
+
+
+
+
+ {/* mobilenav */}
+
+
+ {/* Content */}
+ {props.children}
+
+
+ )
+}
+
+export default SidebarWithHeader
\ No newline at end of file
diff --git a/frontend/react/src/services/client.js b/frontend/react/src/services/client.js
new file mode 100644
index 0000000..384b0b7
--- /dev/null
+++ b/frontend/react/src/services/client.js
@@ -0,0 +1,10 @@
+import axios from "axios";
+
+export const getCustomers = async() => {
+ try {
+ return await axios.get(`${import.meta.env.VITE_API_BASE_URL}/api/v1/customers`)
+ }
+ catch(e) {
+ throw new Error(e);
+ }
+}
\ No newline at end of file