Skip to content

Commit

Permalink
completed merged conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kihan2518B committed Jul 15, 2024
2 parents b1b94fd + 07a9c53 commit 0109e78
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
37 changes: 11 additions & 26 deletions src/app/CustomerDashboard/MyProfile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
"use client";

import { useEffect, useState } from "react";
import CustomerDashboardBox from "../../../Components/CustomerDashboardBox";
import Button from "@mui/material/Button";
import { usePathname } from "next/navigation";
import { User } from "@/types.index";
import { Button } from "@mui/material";
import Link from "next/link";

const userData = {
Name: "abc abc",

Email: "[email protected]",

Address: "123 Main Street",

Pincode: "123456",

DateOfBirth: "00-00-0000",

City: "Visnagar",

State: "Gujarat",

Country: "India",

phone: "90000 00000",

customer: "true",

seller: "false",
};

const page = () => {
const pathname = usePathname();
const [userData, setUserData] = useState<User>({});

useEffect(() => {
const UserFromLocalStorage = localStorage.getItem("User");
const user = JSON.parse(UserFromLocalStorage)
console.log(user);
setUserData(user)
}, [])

const displayedUserData = Object.fromEntries(
Object.entries(userData).filter(
Expand Down
6 changes: 4 additions & 2 deletions src/components/CustomerDashboardBox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"use client";

import CustomerDashboardPagesAPI from "../API/CustomerDashboardPagesAPI";

import { User } from "@/types.index";
import Link from "next/link";

import { usePathname } from "next/navigation";

const page = () => {
const user = localStorage.getItem("User");
const userObject: User = JSON.parse(user);
const pathname = usePathname();

const activePathClassName = "text-gray-950 font-medium";
Expand All @@ -18,7 +20,7 @@ const page = () => {
<h2 className=" font-bold text-gray-900">Customer Profile</h2>

<img
src="https://via.placeholder.com/150"
src={userObject.photo}
alt="User Avatar"
className="w-24 h-24 rounded-full mx-auto"
/>
Expand Down
14 changes: 14 additions & 0 deletions src/types.index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface User {
address: string,
city: string,
country: string,
dateOfBirth: string,
email: string,
isSeller: boolean,
name: string,
phone: string
photo: string,
pincode: string,
state: string,
uid: string
}
7 changes: 7 additions & 0 deletions src/utils/GetDataFromCollection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { db } from "@/firebase/config";
import { collection, getDocs} from "firebase/firestore";

export const GetDataFromCollection = async (collectionName: string) => {
const querySnapshot = await getDocs(collection(db, collectionName));
return querySnapshot.docs;
}

0 comments on commit 0109e78

Please sign in to comment.