-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Welcome to the AcademiaDrive Explorer project! This wiki serves as a guide for understanding the project, setting it up, and contributing. AcademiaDrive Explorer is a Next.js-based app that allows users to browse, explore, and download academic PDFs stored in a directory structure.
-
[Overview](#overview)
-
[Features](#features)
-
[Installation](#installation)
-
[Project Structure](#project-structure)
-
[Key Components](#key-components)
- [ExplorerPage Component](#explorerpage-component)
- [getStaticPaths and getStaticProps](#getstaticpaths-and-getstaticprops)
- [HomePage Component](#homepage-component)
-
[How It Works](#how-it-works)
-
[Development Setup](#development-setup)
-
[Contributing](#contributing)
- [Branching Strategy](#branching-strategy)
- [Steps to Contribute](#steps-to-contribute)
-
[License](#license)
AcademiaDrive Explorer is a Next.js application designed to help users navigate and download academic PDFs stored in a nested directory structure. The app automatically generates paths based on the folder contents and enables easy browsing of directories and PDF files.
-
Dynamic Path Generation: Automatically generates paths based on the folder structure in the
public/academiadrivedirectory. - Recursive Directory Navigation: Users can browse nested directories and view their contents.
- PDF Download Links: Displays PDF files with direct download links.
- Error Handling: If no directories or PDFs are found, it shows a message indicating the lack of content in that section.
- Responsive UI: The design is simple, clean, and works well across devices.
To set up and run the project locally, follow these steps:
-
Clone the Repository:
git clone https://github.com/yourusername/academiadrive-explorer.git
-
Install Dependencies: Navigate into the project directory and install the necessary dependencies:
cd academiadrive-explorer npm install -
Run the Development Server: Start the Next.js development server:
npm run dev
-
Open the App: Visit http://localhost:3000/ in your browser to see the app in action.
Here’s an overview of the project structure:
/academiadrive-explorer
├── /public/academiadrive # Folder containing academic PDFs and directories
├── /pages # Next.js pages
│ ├── /explorer/[...slug].tsx # Explorer page for browsing directories and PDFs
│ ├── /index.tsx # Homepage displaying top-level directories
├── /styles # CSS styling
│ └── Explorer.module.css # CSS module for the Explorer page
├── /node_modules # Node.js dependencies
├── package.json # Project metadata, dependencies, and scripts
├── tsconfig.json # TypeScript configuration
├── tailwind.config.js # Tailwind CSS configuration
└── next.config.js # Next.js configuration
The ExplorerPage component is responsible for displaying the content of a directory. It shows subdirectories and PDFs, as well as a breadcrumb-style path.
-
params: Contains the
slug(current path) for the directory being viewed. - directories: List of subdirectories to navigate through.
- pdfs: List of available PDFs in the current directory.
It renders:
- A breadcrumb trail showing the current path.
- Links to navigate to subdirectories.
- Links to download PDFs.
-
getStaticPaths: This function recursively gathers all directories in
public/academiadriveand generates dynamic paths for each directory. - getStaticProps: Fetches the directories and PDFs for the current path. If the path is invalid (e.g., a non-existent directory), it returns a 404 error.
The HomePage component shows the top-level directories in public/academiadrive. It passes this data to the ExplorerPage as props.
-
Dynamic Routing: The app uses dynamic routing to generate paths like
/explorer/category/subcategory. These paths correspond to the directories on the file system. -
Directory Listing: The app reads the contents of
public/academiadriveusing thefsmodule, identifying directories and PDFs. - Displaying Content: The app renders a list of directories and PDFs on the page, allowing users to navigate or download them.
- Downloading PDFs: PDFs are displayed as links that users can click to download the files.
This project uses the following key technologies:
- Next.js: For building the app and handling server-side rendering.
- TypeScript: For static type checking and better developer experience.
- Tailwind CSS: For styling the app with a utility-first approach.
- Jest: For testing the application and ensuring correctness.
Development Dependencies:
"devDependencies": {
"@tailwindcss/postcss": "^4.1.11",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@types/jest": "^30.0.0",
"@types/node": "^20.19.4",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/testing-library__react": "^10.0.1",
"autoprefixer": "^10.4.21",
"jest": "^29.7.0",
"postcss": "^8.5.6",
"tailwindcss": "^4.1.11",
"ts-jest": "^29.4.0",
"typescript": "^5"
}We welcome contributions to the project! If you would like to contribute, follow the steps below:
All development happens in the dev branch. Feature branches should be created from dev and merged back into it.
-
Fork the Repository: Click the “Fork” button on GitHub to create a copy of the repo.
-
Clone Your Fork: Clone the forked repository to your local machine.
git clone https://github.com/yourusername/academiadrive-explorer.git cd academiadrive-explorer -
Create a New Branch: Always create a new branch for the feature or fix you’re working on.
git checkout -b feature/your-feature-name
-
Make Your Changes: Implement your changes or new features.
-
Test Locally: Run the app locally to make sure everything works as expected.
-
Commit Your Changes: Commit your changes with a descriptive message.
git commit -am "Add feature X" -
Push to Your Fork: Push the branch to your GitHub fork.
git push origin feature/your-feature-name
-
Create a Pull Request: Go to the original repository and create a pull request from your feature branch to the
devbranch.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for more details.