Skip to content

Commit

Permalink
refac:some UI of MY_Account feature
Browse files Browse the repository at this point in the history
  • Loading branch information
anwesha authored and anwesha committed May 14, 2024
1 parent f7c6629 commit 81c1003
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/e-commerce_website.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions src/components/AccountDetails/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import imageBackground from "../../assets/images/slider-1.png"
import pfp from "../../assets/images/pfp.jpg"
import {useEffect, useState} from "react";
import {getDownloadURL, ref, uploadBytes} from "firebase/storage";
import { useNavigate} from "react-router-dom"
import {
addDoc,
collection,
Expand All @@ -22,6 +23,7 @@ import {
import {db, storage} from "../../firebase";
import {nanoid} from "nanoid";
import {useParams} from "react-router-dom";
import {FontAwesomeIcon } from "@fortawesome/react-fontawesome";


export function Account(){
Expand All @@ -36,6 +38,8 @@ export function Account(){





useEffect(()=>{
(async ()=>{
const docref = doc(db,"users", `${user_uid? user_uid : nanoid()}`)
Expand Down Expand Up @@ -89,13 +93,20 @@ export function Account(){
}


const updateUser = async () =>{
const updateUser = async (e) =>{
e.preventDefault()

try {
const imageRef = ref(storage, `AccountImage/${localStorage.getItem("uid")}`);
await uploadBytes(imageRef, file);
const imageUrl = await getDownloadURL(imageRef);


await updateDoc(doc(db,"users", user_uid),{
Name : name,
Email : email,
Address : address,
photo : file
photo : imageUrl
})
}catch (err){
console.log(err)
Expand All @@ -105,7 +116,10 @@ export function Account(){

return(
<>
<div className="container-fluid d-flex justify-content-center align-items-center p-5">
<div className="container-fluid d-flex flex-column justify-content-center align-items-center p-5">
<h3 className="d-flex align-self-start ml-5">
<span className="text-lg-center border border-dark font-weight-bold rounded-circle p-2 m-2 cursor"></span>
My Account</h3>
<Card variant="outlined" className="cardwidth m-5 md:shrink-0 d-flex flex-column justify-content-center align-items-stretch">
<CardHeader className="d-flex flex-column justify-content-center align-items-center">
<div className="position-relative header-background ">
Expand Down

0 comments on commit 81c1003

Please sign in to comment.