Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed eslint errors #53

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion frontend/src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Metadata } from "next";
import Image from "next/image";

export const metadata: Metadata = {
title:
Expand Down Expand Up @@ -36,9 +37,11 @@ export default function About() {
id="right-col"
className="flex h-full flex-col items-center justify-center rounded-2xl md:col-span-6"
>
<img
<Image
src="/images/logo/woman-holding-grlobe.svg"
alt="RATTM CO2 Calculator"
width={100} // These are placeholders, overriden by className
height={100}
className="w-full"
/>
</div>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/components/AboutYourScore.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";

import React from "react";
import dynamic from "next/dynamic";

const AboutYourScore: React.FC = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/TransactionMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TransactionMap: React.FC = () => {
useEffect(() => {
// Initialize the Mapbox map
const map = new mapboxgl.Map({
container: mapContainer.current,
container: mapContainer.current || "",
style: "mapbox://styles/mapbox/streets-v11", // Map style
center: [-74.5, 40], // Initial position [lng, lat]
zoom: 9, // Initial zoom level
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/charts/CompaniesPieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const CompaniesPieChart: React.FC = () => {

<div className="-mx-8 flex flex-wrap items-center justify-center gap-y-3">
{(options.colors || []).map((color, index) => (
<div className="w-full px-8 sm:w-1/2">
<div className="w-full px-8 sm:w-1/2" key={index}>
<div className="flex w-full items-center">
<span
className={`mr-2 block h-3 w-full max-w-3 rounded-full bg-[${color}]`}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/charts/FootprintLineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const FootprintLineGraph: React.FC = () => {
<br />
<div className="flex flex-wrap items-start justify-between gap-3 sm:flex-nowrap">
<div className="flex w-full flex-wrap gap-3 sm:gap-5">
{series.map(({ name, data, color }) => (
{series.map(({ name, color }) => (
<div className="flex min-w-47.5" key={name}>
<span
className="mr-2 mt-1 flex h-4 w-full max-w-4 items-center justify-center rounded-full border"
Expand Down
13 changes: 2 additions & 11 deletions frontend/src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const CompaniesPieChart = dynamic(
);

const Dashboard: React.FC = () => {
const [displayName, setDisplayName] = useState<string | null>(null);
// const [displayName, setDisplayName] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
const router = useRouter();

useEffect(() => {
const unsubscribe = auth.onAuthStateChanged((user) => {
if (user) {
setDisplayName(user.displayName || "User");
// setDisplayName(user.displayName || "User");
setLoading(false);
} else {
router.replace("/main-site/auth/SignInWithGoogle"); // Use replace instead of push
Expand All @@ -36,15 +36,6 @@ const Dashboard: React.FC = () => {
return () => unsubscribe();
}, [router]);

const handleSignOut = async () => {
try {
await auth.signOut();
router.replace("/"); // Use replace instead of push
} catch (error) {
console.error("Sign out error:", error);
}
};

if (loading) {
return (
<div className="flex items-center justify-center h-screen">
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import "jsvectormap/dist/jsvectormap.css";
import "flatpickr/dist/flatpickr.min.css";
import "@/css/satoshi.css";
import "@/css/style.css";
import React, { useEffect, useState } from "react";
import React from "react";
import Navbar from "@/app/components/Navbar";

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const [sidebarOpen, setSidebarOpen] = useState(false);

return (
<html lang="en">
<body suppressHydrationWarning={true}>
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
"use client";
import Image from "next/image";
import React, { useEffect, useState } from "react";
import Link from "next/link";
import Image from "next/image";
import { auth } from "@/app/firebase/firebaseConfig";
import { useRouter } from "next/navigation";
import { User } from "firebase/auth";
import { Metadata } from "next";

export default function Home() {
const [menuOpen, setMenuOpen] = useState(false);
const [user, setUser] = useState<User | null>(null);
const [loading, setLoading] = useState(true);
const router = useRouter();

useEffect(() => {
const unsubscribe = auth.onAuthStateChanged((currentUser) => {
Expand All @@ -27,9 +23,11 @@ export default function Home() {
return (
<div className="ml-20 mr-20 mt-4 grid grid-cols-1 gap-4 md:mt-6 md:grid-cols-12 md:gap-6 2xl:mt-7.5 2xl:gap-7.5">
<div id="left-col" className="rounded-2xl md:col-span-6">
<img
<Image
src="/images/logo/rootpage-logo.png"
alt="RATTM CO2 Calculator"
width={100} // These are placeholders, overriden by className
height={100}
className="w-full"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/transactions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Transactions() {
<h1 className="mb-5 mt-5 text-center text-3xl font-extrabold text-black dark:text-white">
All recent transactions
</h1>
<p className="text-center">I'll put stuff here later</p>
<p className="text-center">I&apos;ll put stuff here later</p>
</div>
);
}
Loading