Skip to content

Commit

Permalink
refactor: cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
p6te committed Dec 27, 2023
1 parent 1ed06c6 commit 73d173d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/components/Chat/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const ChatMissing = styled.div`

export const TopSection = styled.div`
min-height: 50px;
margin: 8px 0;
box-shadow: 0px 10px 16px -16px rgba(66, 68, 90, 0.434);
div {
margin: 0 2rem;
Expand Down
6 changes: 3 additions & 3 deletions src/components/SearchNewUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ export default function Search({
{ merge: true }
);
}
setUser(null);
setUsername("");
setIsSearchOpen(false);
} catch (err) {
const error = ensureError(err);
setErrorMessage(error.message);
}

setUser(null);
setUsername("");
};
return (
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar/Footer/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const FooterContainer = styled("div")`
flex-grow: 0;
border-top: 1px solid ${({ theme }) => theme.tertiary};
padding-top: 1rem;
margin-bottom: 0.5rem;
& div {
margin: 0 1rem;
Expand Down
10 changes: 3 additions & 7 deletions src/context/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createContext, useEffect, useState } from "react";
import { User, onAuthStateChanged } from "firebase/auth";
import { User } from "firebase/auth";
import { auth } from "../firebaseConfig";
import { useNavigate } from "react-router-dom";

interface AuthContextType {
loggedUser: User | null;
Expand All @@ -19,23 +18,20 @@ type Props = {

export const AuthContextProvider = ({ children }: Props) => {
const [loggedUser, setLoggedUser] = useState<User | null>(null);
// const [isReady, setIsReady] = useState(false);

useEffect(() => {
if (loggedUser) {
return;
}
const unsub = auth.onAuthStateChanged((user) => {
console.log(user);
console.log(user?.displayName);
if (user) {
setLoggedUser(user);
}
});

return () => unsub();
}, []);
console.log(loggedUser);
}, [loggedUser]);

return (
<AuthContext.Provider value={{ loggedUser, setLoggedUser }}>
{children}
Expand Down
1 change: 0 additions & 1 deletion src/pages/Register/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ function Register() {
setIsLoading(true);
const response = await FirebaseAuthService.loginWithGoogle();
if (response.user.photoURL) {
console.log(response.user.displayName);
updateUserProfile(response.user, response.user.photoURL);
} else {
getDownloadURL(ref(storage, "avatarIcon.png")).then(
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const THEMES: Record<ThemeType, Theme> = {
textPrimary: "#292929",
textSecondary: "#ffffff",
backgroundGradient:
"linear-gradient(90deg, rgba(191,187,255,1) 0%, rgba(192,245,255,1) 100%)",
"linear-gradient(30deg, rgba(191,187,255,1) 0%, rgba(192,245,255,1) 100%)",
error: "#b50000",
},
dark: {
Expand Down

0 comments on commit 73d173d

Please sign in to comment.