Skip to content

Commit

Permalink
fix lint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
SakinduRansindu committed Nov 15, 2024
1 parent 4ead353 commit 4f7fb93
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 42 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is used to store environment variables that are specific to your local development environment.
NEXT_PUBLIC_API_KEY=<firebase_api_key>
NEXT_PUBLIC_AUTH_DOMAIN=<firebase_auth_domain>
NEXT_PUBLIC_PROJECT_ID=<firebase_project_id>
NEXT_PUBLIC_STORAGE_BUCKET=<firebase_storage_bucket>
NEXT_PUBLIC_MESSAGING_SENDER_ID=<firebase_messaging_sender_id>
NEXT_PUBLIC_APP_ID=<firebase_app_id>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ yarn-error.log*

# env files (can opt-in for committing if needed)
.env*
!.env.example

# vercel
.vercel
Expand Down
4 changes: 2 additions & 2 deletions src/app/admin/admin-dashboard-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import React, { ReactNode, useContext, useState } from "react";
import { cn } from "@/lib/utils";
import Footer from "@/components/blocks/footer";
import { HoveredLink, Menu, MenuItem, ProductItem } from "../../components/ui/navbar-menu"
import { Menu, MenuItem } from "../../components/ui/navbar-menu"
import Image from "next/image";
import RootLayout, { ThemeContext } from "@/app/layout";
import { MoonIcon, SunIcon } from "@heroicons/react/24/solid";
import LOGO_SMALL from "../../../public/Images/logo/RUR20_small.png";
import { useAuth, AuthProvider } from "@/context/auth-provider";
import { useAuth } from "@/context/auth-provider";
import { useRouter } from "next/navigation";

interface AdminDashboardLayoutProps {
Expand Down
10 changes: 0 additions & 10 deletions src/app/admin/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@

import React, { useEffect } from 'react';
import { AdminDashboardLayout } from '@/app/admin/admin-dashboard-layout';
import { useAuth } from '@/context/auth-provider';
import { useRouter } from 'next/navigation';

const AdminDashboard: React.FC = () => {

const { user } = useAuth();

// useEffect(() => {
// if(!user) {
// // setTimeout(()=>{redirectToLogin(); console.log("redirected to login")},5000);
// }
// }, [user]);



return (
Expand Down
7 changes: 0 additions & 7 deletions src/app/admin/dashboard/sponsors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ export default function ManageSponsors() {
const [sponsors, setSponsors] = useState([] as ISponsor[]);
const [refresh, setRefresh] = useState(false); // State to trigger re-fetch

const { user , logOut } = useAuth();

const router = useRouter();

// useEffect(() => {

// }, [user]);

useEffect(() => {
getSponsors("All").then((data) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/logout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useAuth } from "@/context/auth-provider";
import { useEffect } from "react";
import { AdminDashboardLayout } from "../admin-dashboard-layout";

export default function logoutPage() {
export default function LogoutPage() {

const { logOut } = useAuth();
useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect } from "react";
import { AdminDashboardLayout } from "@/app/admin/admin-dashboard-layout";
import { useRouter } from "next/navigation";

export default function redirectToDashboard() {
export default function RedirectToDashboard() {

const router = useRouter();
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { HeroParallax } from "@/components/ui/hero-parallax";
import RootLayout from "./layout";
import { FloatingNav } from "@/components/ui/floating-navbar";
import React, { Suspense, useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import RUR_IMG1 from "../../public/Images/RUR (1).jpg"
import RUR_IMG2 from "../../public/Images/RUR (2).jpg"
import RUR_IMG3 from "../../public/Images/RUR (3).jpg"
Expand Down Expand Up @@ -34,7 +34,7 @@ import { getSponsors } from "@/services/sponsors.service";
import { getTimeLineEvents } from "@/services/timeline.service";
import { ITimelineData } from "@/interfaces/ITimeline";
import { MultiStepLoader } from "@/components/ui/multi-step-loader";
import { HeroHighlight, Highlight } from "@/components/ui/hero-highlight";
import { HeroHighlight } from "@/components/ui/hero-highlight";
import { Highlighter } from "@/components/blocks/hilight";
import { HomeIcon, ClockIcon , MegaphoneIcon , PhoneArrowUpRightIcon } from "@heroicons/react/24/solid";
import { TextGenerateEffect } from "@/components/ui/text-generate-effect";
Expand Down
3 changes: 2 additions & 1 deletion src/components/blocks/modals/sponsor-add-update-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { addSponsor } from '@/services/sponsors.service';
import { SponsorLevel } from '@/interfaces/ISponsors';
import { addFile } from '@/services/firebaseStorage.service';
import { getDownloadURL } from 'firebase/storage';
import Image from 'next/image';

function SponsorAddUpdateModal({onAddSponsor}: {onAddSponsor: () => void}) {

Expand Down Expand Up @@ -169,7 +170,7 @@ function SponsorAddUpdateModal({onAddSponsor}: {onAddSponsor: () => void}) {
>
{sponsorImageFile ? (
<div className="relative w-full h-full">
<img
<Image
src={URL.createObjectURL(sponsorImageFile)}
alt="Uploaded Image"
className="w-full h-full object-cover rounded-lg"
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/floating-navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React, { use, useContext, useEffect, useState } from "react";
import React, { useContext, useState } from "react";
import {
motion,
AnimatePresence,
Expand Down Expand Up @@ -47,7 +47,7 @@ export const FloatingNav = ({
}
});

const [setTheme,tougleTheme,currentTheme] = useContext<any>(ThemeContext);
const [tougleTheme,currentTheme] = useContext<any>(ThemeContext);

return (
<AnimatePresence mode="wait">
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/hero-highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export const HeroHighlight = ({
className?: string;
containerClassName?: string;
}) => {
let mouseX = useMotionValue(0);
let mouseY = useMotionValue(0);
const mouseX = useMotionValue(0);
const mouseY = useMotionValue(0);

function handleMouseMove({
currentTarget,
clientX,
clientY,
}: React.MouseEvent<HTMLDivElement>) {
if (!currentTarget) return;
let { left, top } = currentTarget.getBoundingClientRect();
const { left, top } = currentTarget.getBoundingClientRect();

mouseX.set(clientX - left);
mouseY.set(clientY - top);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/hero-parallax.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import React from "react";
import {
motion,
useScroll,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/hover-border-gradient.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import React, { useState, useEffect, useRef } from "react";
import React, { useState, useEffect } from "react";

import { motion } from "framer-motion";
import { cn } from "@/lib/utils";
Expand Down
11 changes: 7 additions & 4 deletions src/components/ui/multi-step-loader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use client";
import { cn } from "@/lib/utils";
import { AnimatePresence, motion } from "framer-motion";
import { exit } from "process";
import { useState, useEffect, useCallback } from "react";
import { useState, useEffect } from "react";

const CheckIcon = ({ className }: { className?: string }) => {
return (
Expand Down Expand Up @@ -50,7 +49,9 @@ const LoaderCore = ({
exitCallback?: () => void;
}) => {
if (loadingStates.length === value) {
exitCallback && exitCallback();
if(exitCallback) {
exitCallback();
}
}
return (
<div className="flex relative justify-start max-w-xl mx-auto flex-col mt-40">
Expand Down Expand Up @@ -131,7 +132,9 @@ export const MultiStepLoader = ({
}, [currentState, loading, loop, loadingStates.length, duration]);

const exitLoader = () => {
exitCallback && exitCallback();
if(exitCallback) {
exitCallback();
}
};


Expand Down
3 changes: 1 addition & 2 deletions src/components/ui/text-generate-effect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";
import { useEffect } from "react";
import { motion, stagger, useAnimate } from "framer-motion";
import { cn } from "@/lib/utils";

export const TextGenerateEffect = ({
words,
Expand All @@ -15,7 +14,7 @@ export const TextGenerateEffect = ({
duration?: number;
}) => {
const [scope, animate] = useAnimate();
let wordsArray = words.split(" ");
const wordsArray = words.split(" ");
useEffect(() => {
animate(
"span",
Expand Down
4 changes: 2 additions & 2 deletions src/context/auth-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';
import React, { createContext, useContext, useEffect, useState } from 'react';
import { auth } from '@/services/firebaseConfig';
import { GoogleAuthProvider, onAuthStateChanged, signInWithPopup, signOut, User} from 'firebase/auth';
import { useRouter } from 'next/navigation';
Expand All @@ -9,7 +9,7 @@ const AuthContext = createContext<{ user: User | null, googleSignIn: ()=>void, l

export const AuthProvider = ({children}:{children:any}) => {

const protectedRoutes = ['/admin','/test' , '/config'];
const protectedRoutes = ['/admin'];
const router = useRouter();
const [user, setUser] = useState<User|null>(null);

Expand Down
2 changes: 1 addition & 1 deletion src/services/firebaseStorage.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getStorage, ref, uploadBytes,getDownloadURL, StorageReference ,deleteObject} from "firebase/storage";
import { getStorage, ref, uploadBytes, StorageReference ,deleteObject} from "firebase/storage";
import { getApp } from "firebase/app";

const firebaseApp = getApp();
Expand Down
2 changes: 1 addition & 1 deletion src/services/sponsors.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFirestore, collection, getDocs, limit, where, query , DocumentData, QueryDocumentSnapshot, Query, startAfter, orderBy, addDoc, DocumentReference, deleteDoc, getDoc, doc } from "firebase/firestore";
import { getFirestore, collection, getDocs, limit, where, query , DocumentData, QueryDocumentSnapshot, Query, startAfter, orderBy, addDoc, DocumentReference, deleteDoc, doc } from "firebase/firestore";
import {app} from './firebaseConfig';
import { ISponsor ,SponsorLevel } from "@/interfaces/ISponsors";

Expand Down
2 changes: 1 addition & 1 deletion src/services/timeline.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFirestore, collection, getDocs, limit, where, query, DocumentData, QueryDocumentSnapshot, Query, startAfter, orderBy, addDoc, DocumentReference, deleteDoc, getDoc, doc } from "firebase/firestore";
import { getFirestore, collection, getDocs, limit, query, DocumentData, QueryDocumentSnapshot, Query, startAfter, orderBy, addDoc, DocumentReference, deleteDoc, doc } from "firebase/firestore";
import {app} from './firebaseConfig';
import { ITimelineData } from "@/interfaces/ITimeline";

Expand Down

0 comments on commit 4f7fb93

Please sign in to comment.