Skip to content

Commit

Permalink
Lint Fixes
Browse files Browse the repository at this point in the history
lint fixes
  • Loading branch information
01YM committed Sep 1, 2024
1 parent 3c0dc1f commit 19a5640
Show file tree
Hide file tree
Showing 49 changed files with 401 additions and 314 deletions.
35 changes: 19 additions & 16 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import './styles/index.css';
import "./styles/index.css";

import { AuthProvider, UIProvider } from './context';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { ROUTES } from './constants';
import { AuthProvider, UIProvider } from "./context";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { ROUTES } from "./constants";

import Footer from './components/layout/Footer/Footer';
import GalleryPage from './pages/GalleryPage';
import HomePage from './pages/HomePage';
import ImageInfoPage from './pages/ImageInfoPage';
import LoginPage from './pages/LoginPage';
import NavBar from './components/layout/NavBar/NavBar';
import NotFoundPage from './pages/NotFoundPage';
import React from 'react';
import RegisterPage from './pages/RegisterPage';
import UploadPage from './pages/UploadPage';
import Footer from "./components/layout/Footer/Footer";
import GalleryPage from "./pages/GalleryPage";
import HomePage from "./pages/HomePage";
import ImageInfoPage from "./pages/ImageInfoPage";
import LoginPage from "./pages/LoginPage";
import NavBar from "./components/layout/NavBar/NavBar";
import NotFoundPage from "./pages/NotFoundPage";
import React from "react";
import RegisterPage from "./pages/RegisterPage";
import UploadPage from "./pages/UploadPage";

const App: React.FC = () => {
return (
Expand All @@ -26,7 +26,10 @@ const App: React.FC = () => {
<Routes>
<Route path={ROUTES.HOME} element={<HomePage />} />
<Route path={ROUTES.GALLERY} element={<GalleryPage />} />
<Route path={ROUTES.IMAGE_DETAILS} element={<ImageInfoPage />} />
<Route
path={ROUTES.IMAGE_DETAILS}
element={<ImageInfoPage />}
/>
<Route path={ROUTES.UPLOAD} element={<UploadPage />} />
<Route path={ROUTES.LOGIN} element={<LoginPage />} />
<Route path={ROUTES.REGISTER} element={<RegisterPage />} />
Expand All @@ -41,4 +44,4 @@ const App: React.FC = () => {
);
};

export default App;
export default App;
16 changes: 11 additions & 5 deletions src/components/common/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// src/components/common/Button/Button.tsx
import React from 'react';
import React from "react";

interface ButtonProps {
variant: 'primary' | 'secondary';
variant: "primary" | "secondary";
children: React.ReactNode;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
disabled?: boolean;
type?: 'button' | 'submit' | 'reset';
type?: "button" | "submit" | "reset";
}

const Button: React.FC<ButtonProps> = ({ variant, children, onClick, disabled = false, type = 'button' }) => {
const Button: React.FC<ButtonProps> = ({
variant,
children,
onClick,
disabled = false,
type = "button",
}) => {
return (
<button
className={`button button-${variant}`}
Expand All @@ -22,4 +28,4 @@ const Button: React.FC<ButtonProps> = ({ variant, children, onClick, disabled =
);
};

export default Button;
export default Button;
6 changes: 3 additions & 3 deletions src/components/common/ErrorMessage/ErrorMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/components/common/ErrorMessage/ErrorMessage.tsx
import './ErrorMessage.css';
import React from 'react';
import "./ErrorMessage.css";
import React from "react";

interface ErrorMessageProps {
message: string;
Expand All @@ -14,4 +14,4 @@ const ErrorMessage: React.FC<ErrorMessageProps> = ({ message }) => {
);
};

export default ErrorMessage;
export default ErrorMessage;
6 changes: 3 additions & 3 deletions src/components/common/ImageTile/ImageTile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/components/common/ImageTile/ImageTile.tsx
import { Image } from '../../../types/image';
import React from 'react';
import { Image } from "../../../types/image";
import React from "react";

interface ImageTileProps {
image: Image;
Expand All @@ -15,4 +15,4 @@ const ImageTile: React.FC<ImageTileProps> = ({ image }) => {
);
};

export default ImageTile;
export default ImageTile;
13 changes: 8 additions & 5 deletions src/components/common/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/components/common/Input/Input.tsx
import React from 'react';
import React from "react";

interface InputProps {
type: 'text' | 'number' | 'email' | 'password' | 'date';
type: "text" | "number" | "email" | "password" | "date";
label: string;
value: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
Expand All @@ -20,11 +20,14 @@ const Input: React.FC<InputProps> = ({
name,
placeholder,
required = false,
error
error,
}) => {
return (
<div className="input-group">
<label htmlFor={name}>{label}{required && <span className="required">*</span>}</label>
<label htmlFor={name}>
{label}
{required && <span className="required">*</span>}
</label>
<input
type={type}
id={name}
Expand All @@ -39,4 +42,4 @@ const Input: React.FC<InputProps> = ({
);
};

export default Input;
export default Input;
4 changes: 2 additions & 2 deletions src/components/common/LoadingMessage/LoadingMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/components/common/LoadingMessage/LoadingMessage.tsx
import React from 'react';
import React from "react";

const LoadingMessage: React.FC = () => {
return <div className="loading-message">Loading...</div>;
};

export default LoadingMessage;
export default LoadingMessage;
14 changes: 7 additions & 7 deletions src/components/common/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/components/common/Modal/Modal.tsx
import React from 'react';
import './Modal.css';
import React from "react";
import "./Modal.css";

interface ModalProps {
isOpen: boolean;
Expand All @@ -14,14 +14,14 @@ const Modal: React.FC<ModalProps> = ({ isOpen, onClose, title, children }) => {

return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal" onClick={e => e.stopPropagation()}>
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>{title}</h2>
<button onClick={onClose} className="modal-close">&times;</button>
</div>
<div className="modal-content">
{children}
<button onClick={onClose} className="modal-close">
&times;
</button>
</div>
<div className="modal-content">{children}</div>
</div>
</div>
);
Expand Down
11 changes: 7 additions & 4 deletions src/components/features/Gallery/GalleryHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@

import React from 'react';
import React from "react";

const GalleryHeader: React.FC = () => {
return (
<div className="gallery-header">
<h1 className="gallery-title">Gallery Search</h1>
<div className="search-container">
<input type="text" className="search-bar" placeholder="Search" />
<img src="/assets/icons/search-icon.png" alt="Search Icon" className="search-icon" />
<img
src="/assets/icons/search-icon.png"
alt="Search Icon"
className="search-icon"
/>
</div>
</div>
);
};

export default GalleryHeader;
export default GalleryHeader;
17 changes: 10 additions & 7 deletions src/components/features/Gallery/GalleryList.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// src/components/features/Gallery/GalleryList.tsx
import ErrorMessage from '../../common/ErrorMessage/ErrorMessage';
import ImageTile from '../../common/ImageTile/ImageTile';
import LoadingMessage from '../../common/LoadingMessage/LoadingMessage';
import React from 'react';
import useFetchImageList from '../../../hooks/useFetchImageList';
import ErrorMessage from "../../common/ErrorMessage/ErrorMessage";
import ImageTile from "../../common/ImageTile/ImageTile";
import LoadingMessage from "../../common/LoadingMessage/LoadingMessage";
import React from "react";
import useFetchImageList from "../../../hooks/useFetchImageList";

const GalleryList: React.FC = () => {
const { isLoading, isError, data, error } = useFetchImageList();

if (isLoading) return <LoadingMessage />;
if (isError) return <ErrorMessage message={`Error fetching images: ${error?.message}`} />;
if (isError)
return (
<ErrorMessage message={`Error fetching images: ${error?.message}`} />
);
if (!data) return <ErrorMessage message="No images available." />;

return (
Expand All @@ -21,4 +24,4 @@ const GalleryList: React.FC = () => {
);
};

export default GalleryList;
export default GalleryList;
21 changes: 14 additions & 7 deletions src/components/features/Home/HomeHero.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@

import { Link } from 'react-router-dom';
import React from 'react';
import { Link } from "react-router-dom";
import React from "react";

const HomeHero: React.FC = () => {
return (
<div className="homepage">
<div className="background-img"></div>
<div className="content">
<h1>Send us your<br />Satellite Streak</h1>
<Link to="/about" className="learn-more-btn">Learn more</Link>
<h1>
Send us your
<br />
Satellite Streak
</h1>
<Link to="/about" className="learn-more-btn">
Learn more
</Link>
<div className="Home-Line"></div>
<Link to="/gallery" className="gallery-link">View Gallery &#8250;</Link>
<Link to="/gallery" className="gallery-link">
View Gallery &#8250;
</Link>
</div>
</div>
);
};

export default HomeHero;
export default HomeHero;
23 changes: 14 additions & 9 deletions src/components/features/Home/HomeImageList.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// src/components/features/Home/HomeImageList.tsx
import ErrorMessage from '../../common/ErrorMessage/ErrorMessage';
import ImageTile from '../../common/ImageTile/ImageTile';
import { Link } from 'react-router-dom';
import LoadingMessage from '../../common/LoadingMessage/LoadingMessage';
import React from 'react';
import useFetchImageList from '../../../hooks/useFetchImageList';
import ErrorMessage from "../../common/ErrorMessage/ErrorMessage";
import ImageTile from "../../common/ImageTile/ImageTile";
import { Link } from "react-router-dom";
import LoadingMessage from "../../common/LoadingMessage/LoadingMessage";
import React from "react";
import useFetchImageList from "../../../hooks/useFetchImageList";

const HomeImageList: React.FC = () => {
const { isLoading, isError, data, error } = useFetchImageList();

if (isLoading) return <LoadingMessage />;
if (isError) return <ErrorMessage message={`Error fetching images: ${error?.message}`} />;
if (isError)
return (
<ErrorMessage message={`Error fetching images: ${error?.message}`} />
);
if (!data) return <ErrorMessage message="No images available." />;

const firstRowImages = data.slice(0, 6);
Expand All @@ -22,9 +25,11 @@ const HomeImageList: React.FC = () => {
<ImageTile key={image.name} image={image} />
))}
</div>
<Link to="/gallery" className="view-gallery-link">View Gallery &#8250;</Link>
<Link to="/gallery" className="view-gallery-link">
View Gallery &#8250;
</Link>
</div>
);
};

export default HomeImageList;
export default HomeImageList;
10 changes: 6 additions & 4 deletions src/components/features/ImageInfo/ImageDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/components/features/ImageInfo/ImageDetails.tsx
import { Image } from '../../../types/image';
import React from 'react';
import { Image } from "../../../types/image";
import React from "react";

interface ImageDetailsProps {
image: Image;
Expand All @@ -16,12 +16,14 @@ const ImageDetails: React.FC<ImageDetailsProps> = ({ image }) => {
<p>Upload Date: {new Date(image.uploadDate).toLocaleDateString()}</p>
<div className="image-tags">
{image.tags.map((tag, index) => (
<span key={index} className="tag">{tag}</span>
<span key={index} className="tag">
{tag}
</span>
))}
</div>
</div>
</div>
);
};

export default ImageDetails;
export default ImageDetails;
10 changes: 7 additions & 3 deletions src/components/features/Upload/DragAndDrop.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// src/components/features/Upload/DragAndDrop.tsx
import React from 'react';
import React from "react";

const DragAndDrop: React.FC = () => {
return (
<div className="drag-and-drop">
<img src="/src/assets/icons/upload-icon.png" alt="Upload" className="upload-icon" />
<img
src="/src/assets/icons/upload-icon.png"
alt="Upload"
className="upload-icon"
/>
<p>Drag and drop your files here</p>
<p>or</p>
<label htmlFor="file-upload" className="custom-file-upload">
Expand All @@ -15,4 +19,4 @@ const DragAndDrop: React.FC = () => {
);
};

export default DragAndDrop;
export default DragAndDrop;
Loading

0 comments on commit 19a5640

Please sign in to comment.