Skip to content

Commit

Permalink
add button
Browse files Browse the repository at this point in the history
  • Loading branch information
Vika-Koval authored and Vika-Koval committed Jun 6, 2024
1 parent ec8e794 commit 63a85bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ function DashboardPage() {

<br />
<Button onClick={signOut} class ='sign-outt'>Sign out</Button>
<p> </p>
<Button onClick={() => navigate('/matches')} class = 'gotopage'>Check matches</Button>
<Button onClick={() => navigate('/edit-profile')} class = 'gotopage'>Edit your profile</Button>
</Box>
);
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/EditProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Box, Spinner, Input, Select, Stack, Button, useToast, Text, FormControl
import { getAuth } from 'firebase/auth';
import { doc, updateDoc } from 'firebase/firestore';
import { FormEvent, ChangeEvent, useEffect, useState } from 'react';
import { useAuthState } from 'react-firebase-hooks/auth';
import { useAuthState, useSignOut } from 'react-firebase-hooks/auth';
import { useDocument } from 'react-firebase-hooks/firestore';
import { Navigate } from 'react-router-dom';

import { Navigate,useNavigate } from 'react-router-dom';
// import { Navigate, useNavigate } from 'react-router-dom';
import { db } from '../../firebase.config';
import countries from '../components/countries.json';

Expand All @@ -14,6 +14,8 @@ const auth = getAuth();
function EditProfilePage() {
const [user, userLoading] = useAuthState(auth);
const toast = useToast();
const [signOut] = useSignOut(auth);
const navigate = useNavigate();

// Get the current user from Firebase
const [currentUser, currentUserLoading] = useDocument(doc(db, 'users', user?.uid || 'asd'));
Expand Down Expand Up @@ -185,6 +187,9 @@ function EditProfilePage() {
<Button type="submit">Update</Button>
</Stack>
</form>
<Button onClick={signOut} class ='sign-outt'>Sign out</Button>
<Button onClick={() => navigate('/matches')} class = 'gotopage'>Check matches</Button>
<Button onClick={() => navigate('/dashboard')} class ='gotopage' >Back to main page</Button>
</Box>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/MatchesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { collection, doc, query, where, documentId } from 'firebase/firestore';
import { useAuthState, useSignOut } from 'react-firebase-hooks/auth';
import { useCollection, useDocument } from 'react-firebase-hooks/firestore';
import { Navigate, useNavigate } from 'react-router-dom';
// import { useAuthState, useSignOut } from 'react-firebase-hooks/auth';

import { db } from '../../firebase.config';
import logo from '../logo.png';
Expand Down Expand Up @@ -67,6 +68,7 @@ function MatchesPage() {
<br />
<Button onClick={signOut} class ='sign-outt'>Sign out</Button>
<Button onClick={() => navigate('/dashboard')} class ='gotopage' >Back to main page</Button>
<Button onClick={() => navigate('/edit-profile')} class = 'gotopage'>Edit your profile</Button>
</Box>
);
}
Expand Down

0 comments on commit 63a85bb

Please sign in to comment.