Skip to content

Commit

Permalink
backup commit
Browse files Browse the repository at this point in the history
  • Loading branch information
qwrtsdev committed Sep 17, 2024
1 parent 5ddeb4f commit 5445f19
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/routes/MainPage/MainPage.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
// eslint-disable-next-line no-unused-vars
import React, { useEffect, useState } from 'react';
import './MainPage.css';
import { useNavigate } from "react-router-dom"

import Card from '../../components/card/Card';
import axios from 'axios';
import TinderCard from 'react-tinder-card';
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { initializeApp } from "firebase/app";
import { getAuth, onAuthStateChanged } from "firebase/auth";

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faTriangleExclamation, faArrowsRotate, faSpinner, faBackward, faHeart, faHeartCrack, faHeadphonesSimple } from '@fortawesome/free-solid-svg-icons'

// NOTE: Firebase configuration & initialize
const firebaseConfig = {
apiKey: `${import.meta.env.VITE_FB_APIKEY}`,
authDomain: `${import.meta.env.VITE_FB_AUTHDOMAIN}`,
projectId: `${import.meta.env.VITE_FB_PROJECTID}`,
storageBucket: `${import.meta.env.VITE_FB_STORAGE}`,
messagingSenderId: `${import.meta.env.VITE_FB_MESSAGE}`,
appId: `${import.meta.env.VITE_FB_APPID}`,
measurementId: `${import.meta.env.VITE_FB_MID}`,
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);

function MainPage() {
const [track, setTrack] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [user, setUser] = useState(null);

useEffect(() => {
const authUser = onAuthStateChanged(auth, (user) => {
setUser(user);
});
return () => authUser(); // Cleanup subscription on unmount
}, []);

const navigate = useNavigate();

const trackSearch = async () => {
const queryName = 'abcdefghijklmnopqrstuvwxyz'.split('');
Expand Down Expand Up @@ -90,9 +116,15 @@ function MainPage() {
)
}



// snippets for implementations
const onSwipe = (direction) => {
console.log('swiped: ' + direction);
if (!user) {
navigate('/login');
} else {
if ()
}
}
const onCardLeftScreen = (myIdentifier) => {
console.log(myIdentifier + ' left the screen');
Expand Down

0 comments on commit 5445f19

Please sign in to comment.