This commit is contained in:
@@ -75,7 +75,10 @@ export function Bookmarks({ contentType }: { contentType: string[] }) {
|
||||
}}
|
||||
>
|
||||
{groups
|
||||
.filter((category: BookmarkGroup) => category.enabled === 1)
|
||||
.filter(
|
||||
(category: BookmarkGroup) =>
|
||||
category.enabled === 1 && category.categoryName,
|
||||
)
|
||||
.map((category: BookmarkGroup) => {
|
||||
return (
|
||||
<BookmarkGroups
|
||||
|
||||
@@ -323,10 +323,17 @@ export function Bookmarks() {
|
||||
{groups.length > 0 ? (
|
||||
groups?.map((group: BookmarkGroup) => (
|
||||
<DebouncedGroupSettingsItem
|
||||
key={group.id}
|
||||
key={group?.id}
|
||||
bookmarkGroup={group}
|
||||
bookmarks={bookmarks
|
||||
.filter((a: Bookmark) => a.category === group.categoryName)
|
||||
.filter(
|
||||
(bookmark: Bookmark) =>
|
||||
bookmark.category === group?.categoryName ||
|
||||
(group?.categoryName === undefined &&
|
||||
!groups
|
||||
.map((a: BookmarkGroup) => a?.categoryName)
|
||||
.includes(bookmark?.category)),
|
||||
)
|
||||
.sort((a: Bookmark, b: Bookmark) => (a.index > b.index ? 1 : -1))}
|
||||
searchTerm={searchValue}
|
||||
/>
|
||||
|
||||
@@ -54,7 +54,7 @@ function DebouncedGroupSettingsItem({
|
||||
id: undefined,
|
||||
name: '',
|
||||
url: '',
|
||||
category: group.categoryName,
|
||||
category: group?.categoryName,
|
||||
index: 0,
|
||||
enabled: 1,
|
||||
});
|
||||
@@ -128,7 +128,7 @@ function DebouncedGroupSettingsItem({
|
||||
<Text
|
||||
className={textClasses.deleteItem}
|
||||
classNames={textClasses}
|
||||
>{`"${group.categoryName}"`}</Text>
|
||||
>{`"${group?.categoryName}"`}</Text>
|
||||
<Text style={{ fontWeight: 'bold', textTransform: 'uppercase' }}>
|
||||
This will also delete all bookmarks in this group!
|
||||
</Text>
|
||||
@@ -151,7 +151,7 @@ function DebouncedGroupSettingsItem({
|
||||
w={isMobile ? undefined : '56%'}
|
||||
className={textInputClasses.settingsItem}
|
||||
classNames={textInputClasses}
|
||||
defaultValue={group.categoryName}
|
||||
defaultValue={group?.categoryName || 'ORPHANED'}
|
||||
onChange={(event) => {
|
||||
setUpdate({
|
||||
...group,
|
||||
@@ -165,13 +165,14 @@ function DebouncedGroupSettingsItem({
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
disabled={group?.categoryName === undefined}
|
||||
/>
|
||||
<TextInput
|
||||
label={'Filter Name'}
|
||||
w={isMobile ? undefined : '28%'}
|
||||
className={textInputClasses.settingsItem}
|
||||
classNames={textInputClasses}
|
||||
defaultValue={group.filterName}
|
||||
defaultValue={group?.filterName}
|
||||
onChange={(event) => {
|
||||
setUpdate({
|
||||
...group,
|
||||
@@ -185,6 +186,7 @@ function DebouncedGroupSettingsItem({
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
disabled={group?.categoryName === undefined}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
@@ -206,7 +208,7 @@ function DebouncedGroupSettingsItem({
|
||||
</Card.Section>
|
||||
<Card.Section mt={'1rem'} p={'1rem'}>
|
||||
<Stack pos={'relative'}>
|
||||
<Group
|
||||
{group?.categoryName &&<Group
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: '100%',
|
||||
@@ -222,7 +224,7 @@ function DebouncedGroupSettingsItem({
|
||||
}}
|
||||
>
|
||||
<ManagementPill
|
||||
enabled={group.enabled}
|
||||
enabled={group?.enabled}
|
||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setUpdate({
|
||||
...group,
|
||||
@@ -232,9 +234,9 @@ function DebouncedGroupSettingsItem({
|
||||
openModal={openModal}
|
||||
/>
|
||||
</Box>
|
||||
</Group>
|
||||
</Group>}
|
||||
<DragDropContext onDragEnd={onDragEnd}>
|
||||
<Droppable droppableId={`${bookmarkGroup.id}`}>
|
||||
<Droppable droppableId={`${bookmarkGroup?.id}`}>
|
||||
{(provided: DroppableProvided) => (
|
||||
<Stack
|
||||
pos={'relative'}
|
||||
@@ -332,7 +334,7 @@ function DebouncedGroupSettingsItem({
|
||||
setPopoverOpened((o) => !o);
|
||||
setNewBookmark({
|
||||
...newBookmark,
|
||||
category: group.categoryName,
|
||||
category: group?.categoryName,
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -381,7 +383,7 @@ function DebouncedGroupSettingsItem({
|
||||
pt={'1rem'}
|
||||
classNames={textInputClasses}
|
||||
disabled
|
||||
defaultValue={group.categoryName}
|
||||
defaultValue={group?.categoryName}
|
||||
styles={
|
||||
theme.textShadowsEnabled
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user