Updated names for uniformity

This commit is contained in:
Sean Edmunds
2025-04-28 14:21:45 -05:00
parent f44f6e004b
commit 19b793fbf9
26 changed files with 247 additions and 404 deletions

View File

@@ -3,24 +3,24 @@ import { useCommonHooks, useQueryAPI } from 'hooks';
import { useEffect, useState } from 'react';
import { textClasses } from 'styles';
import type { Bookmark, BookmarkGroup } from 'types';
import LinkGroups from './LinkGroups';
import BookmarkGroups from './BookmarkGroups';
function Links({ contentType }: { contentType: string[] }) {
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
endpoint: 'api/links',
function Bookmarks({ contentType }: { contentType: string[] }) {
const { data: bookmarkData, isFetched: bookmarksIsFetched } = useQueryAPI({
endpoint: 'api/bookmarks',
});
const { data: groupData, isFetched: groupsIsFetched } = useQueryAPI({
endpoint: 'api/categories',
endpoint: 'api/bookmarkCategories',
});
const { isMobile, bookmarkSort, bookmarkDensity } = useCommonHooks();
const [bookmarkData, setBookmarkData] = useState<Bookmark[]>([]);
const [bookmarks, setBookmarks] = useState<Bookmark[]>([]);
const [groups, setGroups] = useState<BookmarkGroup[]>([]);
useEffect(() => {
if (linkData && linksIsFetched) {
setBookmarkData(linkData);
if (bookmarkData && bookmarksIsFetched) {
setBookmarks(bookmarkData);
}
}, [linksIsFetched, linkData]);
}, [bookmarksIsFetched, bookmarkData]);
useEffect(() => {
if (groupData && groupsIsFetched) {
@@ -57,10 +57,10 @@ function Links({ contentType }: { contentType: string[] }) {
return (
<>
{groupsIsFetched &&
linksIsFetched &&
bookmarksIsFetched &&
groups?.length > 0 &&
contentType.length > 0 && (
<Stack id='links' style={{ gap: 0 }}>
<Stack style={{ gap: 0 }}>
<Text className={textClasses.sectionTitle} classNames={textClasses}>
Bookmarks
</Text>
@@ -85,10 +85,10 @@ function Links({ contentType }: { contentType: string[] }) {
.map((category: BookmarkGroup) => {
return (
<LinkGroups
<BookmarkGroups
key={category.categoryName}
category={category.categoryName}
links={bookmarkData.filter(
bookmarks={bookmarks.filter(
(bookmark: Bookmark) =>
bookmark.category === category.categoryName,
)}
@@ -102,4 +102,4 @@ function Links({ contentType }: { contentType: string[] }) {
);
}
export default Links;
export default Bookmarks;