-
Notifications
You must be signed in to change notification settings - Fork 105
Refactor Docusaurus module declarations by removing unnecessary export statements for improved type clarity #654
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
Open
smirk-dev
wants to merge
19
commits into
recodehive:main
Choose a base branch
from
smirk-dev:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
449666a
Refactor OurProjects component to use JSON data for projects and enha…
smirk-dev d5cc6e5
Refactor getWebsiteUrl function to utilize project URLs from JSON dat…
smirk-dev d0b1e59
Refactor SelectComponent to use ProjectItem type for items and improv…
smirk-dev 52b170d
Refactor SelectComponent to use getWebsiteUrl for improved URL handling
smirk-dev 4e804e5
Refactor SelectComponent to use item.id for key assignment to improve…
smirk-dev c16ffed
Remove unused projectsData import from index.tsx to clean up code
smirk-dev 9e10812
Remove unused OurProjectsData prop from OurProjects component to clea…
smirk-dev cab1eb7
Refactor OurProjects component to use JSON data for improved maintain…
smirk-dev 5cd3f73
Refactor OurProjects component to use a data-driven architecture with…
smirk-dev 0f30999
Refactor OurProjects component to convert legacy data format to new s…
smirk-dev 18ed131
Add type declarations for CSS and Docusaurus modules to improve type …
smirk-dev af05895
Update tsconfig.json to change moduleResolution to 'bundler' and incl…
smirk-dev 58afd9d
Update global.d.ts to enhance type declarations for CSS modules and D…
smirk-dev 57a4e93
Update tsconfig.json to extend Docusaurus configuration and improve t…
smirk-dev d77989d
Implement feature X to enhance user experience and fix bug Y in module Z
smirk-dev 83f33e4
Remove deprecated option from tsconfig.json to streamline configuration
smirk-dev cb99a23
Enhance global type declarations in global.d.ts for improved TypeScri…
smirk-dev 3e57837
Refactor Docusaurus module declarations by removing unnecessary expor…
smirk-dev b57a364
Delete PR_DESCRIPTION.md
smirk-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# OurProjects Component Refactoring | ||
|
||
## Overview | ||
This document describes the refactoring of the `OurProjects` component from a prop-based to a data-driven architecture, improving maintainability and scalability. | ||
|
||
## Changes Made | ||
|
||
### 1. Data Structure Migration | ||
- **Before**: Data was passed as props from `src/database/projects/projects.tsx` | ||
- **After**: Data is loaded directly from `src/data/projects.json` | ||
|
||
### 2. Enhanced Data Schema | ||
The new JSON structure includes additional fields for better project information: | ||
|
||
```json | ||
{ | ||
"id": 1, | ||
"title": "Project Name", | ||
"description": "Detailed project description", | ||
"image": "/img/blogs/project-image.png", | ||
"projectUrl": "https://live-site-url.com", | ||
"githubUrl": "https://github.com/recodehive/repo", | ||
"tags": ["tag1", "tag2", "tag3"] | ||
} | ||
``` | ||
|
||
### 3. Type Safety Improvements | ||
- Added TypeScript interfaces in `src/data/types.ts` | ||
- Maintained backward compatibility with legacy interfaces | ||
- Enhanced type checking for project data | ||
|
||
### 4. Component Enhancements | ||
- **Self-contained**: Component now imports its own data | ||
- **Backward Compatible**: Still accepts legacy props if needed | ||
- **Better Error Handling**: Fallbacks for missing data | ||
- **Enhanced URLs**: Dynamic URL resolution from JSON data | ||
|
||
## Files Changed | ||
|
||
### New Files | ||
1. `src/data/projects.json` - Project data in JSON format | ||
2. `src/data/types.ts` - TypeScript interfaces | ||
|
||
### Modified Files | ||
1. `src/components/ourProjects.tsx` - Refactored to use JSON data | ||
2. `src/pages/index.tsx` - Removed dependency on old data file | ||
|
||
### Legacy Files (can be removed) | ||
1. `src/database/projects/projects.tsx` - No longer needed | ||
|
||
## Benefits | ||
|
||
### 1. Improved Maintainability | ||
- Easy to add/remove projects without touching code | ||
- JSON format is more accessible for non-developers | ||
- Clear separation of data and presentation | ||
|
||
### 2. Enhanced Scalability | ||
- Support for additional project metadata | ||
- Easy to extend with new fields | ||
- Better structure for future features | ||
|
||
### 3. Better Developer Experience | ||
- Strong TypeScript typing | ||
- Comprehensive documentation | ||
- Backward compatibility for migration | ||
|
||
## Usage | ||
|
||
### Simple Usage (Recommended) | ||
```tsx | ||
import OurProjects from "../components/ourProjects"; | ||
|
||
// Component loads data automatically from JSON | ||
<OurProjects /> | ||
``` | ||
|
||
### Legacy Usage (Still Supported) | ||
```tsx | ||
import OurProjects from "../components/ourProjects"; | ||
import legacyData from "../database/projects/projects"; | ||
|
||
// Backward compatible | ||
<OurProjects OurProjectsData={legacyData} /> | ||
``` | ||
|
||
## Adding New Projects | ||
|
||
To add a new project, simply edit `src/data/projects.json`: | ||
|
||
```json | ||
{ | ||
"id": 6, | ||
"title": "New Awesome Project", | ||
"description": "Description of the new project", | ||
"image": "/img/blogs/new-project.png", | ||
"projectUrl": "https://new-project.com", | ||
"githubUrl": "https://github.com/recodehive/new-project", | ||
"tags": ["react", "typescript", "new"] | ||
} | ||
``` | ||
|
||
## Migration Notes | ||
|
||
1. **Immediate**: The component works with both old and new data formats | ||
2. **Recommended**: Remove `src/database/projects/projects.tsx` after testing | ||
3. **Future**: The legacy props interface will be removed in a future version | ||
|
||
## Testing | ||
|
||
The refactoring maintains identical UI/UX behavior: | ||
- ✅ All existing projects display correctly | ||
- ✅ Interactive features work as before | ||
- ✅ Responsive design is preserved | ||
- ✅ Dark/light theme support maintained | ||
- ✅ Live website previews function properly | ||
- ✅ Hover effects and animations intact | ||
|
||
## Performance Impact | ||
|
||
- **Minimal**: JSON parsing is negligible | ||
- **Improved**: Reduced bundle size (no longer importing React component for data) | ||
- **Better**: Faster builds due to simpler dependency tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"tag": "Our Projects", | ||
"title": "Explore Our Latest Projects and Innovations", | ||
"description": "Discover our diverse projects showcasing all the beginner friendly opensource contributions, innovative applications. Each project represents our commitment to excellence and continuous learning.", | ||
"items": [ | ||
{ | ||
"id": 1, | ||
"title": "Awesome GitHub Profile", | ||
"description": "A comprehensive collection of amazing GitHub profile READMEs that inspire developers to create beautiful and functional profile pages with interactive elements and stunning designs.", | ||
"image": "/img/blogs/awesome-project.png", | ||
"projectUrl": "https://recodehive.github.io/awesome-github-profiles/", | ||
"githubUrl": "https://github.com/recodehive/awesome-github-profiles", | ||
"tags": ["github", "profile", "readme", "showcase"] | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "Machine Learning Repository", | ||
"description": "An extensive collection of machine learning algorithms, tutorials, and projects designed to help developers learn and implement ML solutions in real-world scenarios.", | ||
"image": "/img/blogs/machine-learning-project.png", | ||
"projectUrl": "https://machine-learning-repos.vercel.app/", | ||
"githubUrl": "https://github.com/recodehive/machine-learning-repos", | ||
"tags": ["machine-learning", "algorithms", "python", "tutorials"] | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "Stack Overflow Analysis", | ||
"description": "A comprehensive data analysis project that examines Stack Overflow trends, popular technologies, and developer insights using advanced data science techniques.", | ||
"image": "/img/blogs/Stackoverflow-analysis.png", | ||
"projectUrl": "https://github.com/recodehive/Stackoverflow-Analysis", | ||
"githubUrl": "https://github.com/recodehive/Stackoverflow-Analysis", | ||
"tags": ["data-analysis", "python", "visualization", "statistics"] | ||
}, | ||
{ | ||
"id": 4, | ||
"title": "Scrape ML Project", | ||
"description": "An intelligent web scraping framework combined with machine learning capabilities for automated data extraction and analysis from various web sources.", | ||
"image": "/img/blogs/Scrape-ml-project.png", | ||
"projectUrl": "https://github.com/recodehive/Scrape-ML-Project", | ||
"githubUrl": "https://github.com/recodehive/Scrape-ML-Project", | ||
"tags": ["web-scraping", "machine-learning", "automation", "data-extraction"] | ||
}, | ||
{ | ||
"id": 5, | ||
"title": "Open Source Project", | ||
"description": "A collaborative platform showcasing various open source contributions and projects that demonstrate best practices in community-driven development.", | ||
"image": "/img/blogs/opesource-project.png", | ||
"projectUrl": "https://github.com/recodehive", | ||
"githubUrl": "https://github.com/recodehive", | ||
"tags": ["open-source", "community", "collaboration", "development"] | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Type definitions for the Projects data structure | ||
* Used for dynamic project rendering in the OurProjects component | ||
*/ | ||
|
||
export interface ProjectItem { | ||
/** Unique identifier for the project */ | ||
id: number; | ||
/** Display title of the project */ | ||
title: string; | ||
/** Detailed description of the project */ | ||
description: string; | ||
/** Path to the project's preview image */ | ||
image: string; | ||
/** Live project URL (website/demo) */ | ||
projectUrl: string; | ||
/** GitHub repository URL */ | ||
githubUrl: string; | ||
/** Array of technology/category tags */ | ||
tags: string[]; | ||
} | ||
|
||
export interface ProjectsData { | ||
/** Section tag/badge text */ | ||
tag: string; | ||
/** Main section title */ | ||
title: string; | ||
/** Section description */ | ||
description: string; | ||
/** Array of project items */ | ||
items: ProjectItem[]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing hyphen in 'beginner friendly' - should be 'beginner-friendly'. Also, 'opensource' should be 'open source' (two words).
Copilot uses AI. Check for mistakes.