-
Notifications
You must be signed in to change notification settings - Fork 1
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
Tweaks #41
Merged
Merged
Tweaks #41
Changes from 16 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
4430403
Use higher quality mountain image
itexpert120 1436216
Remove search modal trigger at the end of each page, and improve imag…
itexpert120 4bf473f
Use higher quality mountain image
itexpert120 a3629f8
Remove search modal trigger at the end of each page, and improve imag…
itexpert120 0d1f4d5
Merge branch '6-aug-issues' of https://github.com/NEARBuilders/near-d…
itexpert120 85bb3fc
Add blur placeholder to static images
itexpert120 ad1c4c1
Add static imports and remove unused suspense
itexpert120 c8223d8
Fix accessibility error
itexpert120 3f015a6
Improve project page performance
itexpert120 ec761a5
Improve category page performance
itexpert120 8c74c8d
Improve bookmarks page
itexpert120 c4c671b
Improve site.url handling
itexpert120 403775a
Fix base URL
itexpert120 f977dca
Fix tests
itexpert120 5eb16d7
Add background to project card image
itexpert120 b3b7f63
Select search input on modal open
itexpert120 51ed49b
Update hot projects scrolling logic
itexpert120 76d1b03
Improve bookmarks
itexpert120 c91969a
Improve auto focus logic
itexpert120 0574d9e
Revert project list back
itexpert120 9e63b8b
Remove unused prop
itexpert120 1d03ebf
Better infinite projects feed
itexpert120 68708a0
Change name to NEAR Catalog
itexpert120 d33ecbb
Change logo
itexpert120 bc8615b
Remove Bookmarks
itexpert120 1d8a70c
Add footer links
itexpert120 ef038b5
Change favicon
itexpert120 0b8d52e
Change readme logo
itexpert120 4d210fb
Add opengraph image to home page
itexpert120 a776ea9
Only show projects in search bar when searched
itexpert120 c4a4715
Consistent opengraph images
itexpert120 7a7707c
Use different searchKeys for modal and page
itexpert120 a3f30a5
Add cookie and privacy policy pages
itexpert120 1537d89
Fix padding
itexpert120 8ad3216
Metadata
itexpert120 edd7f73
Fix keywords in main layout
itexpert120 c21d516
Add max width to policy pages
itexpert120 d8f00b9
Change markdown font size
itexpert120 d752034
Add remark plugin to all markdown contents
itexpert120 4b261c7
Better category page metadata
itexpert120 1af936e
Implement max width for search modal
itexpert120 87f7c39
Fix og image alt
itexpert120 aab586c
Rework search
itexpert120 b8fac82
Remove duplicate tags
itexpert120 79f3bfc
Tag click moves to top
itexpert120 7d4694a
Remove even more duplication
itexpert120 aa93a5f
Change font location for og image
itexpert120 e088c3c
Optimize imports
itexpert120 5938b20
Fix tests
itexpert120 42dfbdc
Fix test
itexpert120 5b5b5f9
Hidden Tags on mobile view
itexpert120 c18b8ab
Merge branch 'tweaks' of https://github.com/NEARBuilders/near-directo…
itexpert120 c514e20
Improve twitter timeline
itexpert120 f6306cd
Revert unwanted changes
itexpert120 37c4617
Remove console log
itexpert120 899d852
fix tests
itexpert120 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 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 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,51 @@ | ||
"use client"; | ||
|
||
import { useState, useEffect } from "react"; | ||
import { useInView } from "react-intersection-observer"; | ||
import { ProjectId, ProjectRecord } from "@/lib/types"; | ||
import ProjectsList from "@/components/ui/project-list"; | ||
import { useSearchStore } from "@/store/search-store"; | ||
|
||
const ITEMS_PER_PAGE = 12; | ||
|
||
interface CategoryProjectsListProps { | ||
projects: Record<ProjectId, ProjectRecord>; | ||
} | ||
|
||
export default function CategoryProjectsList({ | ||
projects, | ||
}: CategoryProjectsListProps) { | ||
const [projectsList, setProjectsList] = useState<ProjectRecord[]>([]); | ||
const [displayedProjects, setDisplayedProjects] = useState<ProjectRecord[]>( | ||
[], | ||
); | ||
const { setTags, setSearchKey } = useSearchStore(); | ||
const [page, setPage] = useState(1); | ||
const [hasMore, setHasMore] = useState(true); | ||
const { ref, inView } = useInView(); | ||
|
||
useEffect(() => { | ||
setProjectsList(Object.values(projects)); | ||
setTags([]); | ||
setSearchKey(""); | ||
}, [projects, setTags, setSearchKey]); | ||
|
||
useEffect(() => { | ||
const endIndex = page * ITEMS_PER_PAGE; | ||
setDisplayedProjects(projectsList.slice(0, endIndex)); | ||
setHasMore(endIndex < projectsList.length); | ||
}, [projectsList, page]); | ||
|
||
useEffect(() => { | ||
if (inView && hasMore) { | ||
setPage((prevPage) => prevPage + 1); | ||
} | ||
}, [inView, hasMore]); | ||
|
||
return ( | ||
<> | ||
<ProjectsList projects={displayedProjects} /> | ||
{hasMore && <div ref={ref} style={{ height: "20px" }}></div>} | ||
</> | ||
); | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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.
I felt it was smoother before -- and I think the loading section showing project skeletons -> "no bookmarks found" is a a bit jarring; seems to take longer to load too with loading state defaulting to true.
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.
Yeah, thinking more about it -- especially since this is dependent on local storage starred projects, rather than the "fetchAllProjects" -- we shouldn't be getting hung up on this fetch. Either there are no starredProjects, or there are and then we need fetch
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.
ok, i'll revert