Revert "feat: ability to favorite tags (#1852)"

This reverts commit 4f3b258363.
This commit is contained in:
Mo
2022-10-20 13:00:22 -05:00
parent 8d7d577b1c
commit 5d202a823e
7 changed files with 27 additions and 81 deletions

View File

@@ -68,7 +68,6 @@ export const ICONS = {
eye: icons.EyeIcon,
file: icons.FileIcon,
folder: icons.FolderIcon,
fullscreen: icons.FullscreenIcon,
hashtag: icons.HashtagIcon,
help: icons.HelpIcon,
history: icons.HistoryIcon,

View File

@@ -37,7 +37,7 @@ const smartViewIconType = (view: SmartView, isSelected: boolean): IconType => {
[SystemViewId.StarredNotes]: 'star-filled',
}
return mapping[view.uuid as SystemViewId] || 'window'
return mapping[view.uuid as SystemViewId] || 'hashtag'
}
const getIconClass = (view: SmartView, isSelected: boolean): string => {

View File

@@ -46,11 +46,6 @@ const TagContextMenu = ({ navigationController, isEntitledToFolders, selectedTag
navigationController.remove(selectedTag, true).catch(console.error)
}, [navigationController, selectedTag])
const onClickStar = useCallback(() => {
navigationController.setFavorite(selectedTag, !selectedTag.starred).catch(console.error)
navigationController.setContextMenuOpen(false)
}, [navigationController, selectedTag])
const tagLastModified = useMemo(
() => formatDateForContextMenu(selectedTag.userModifiedDate),
[selectedTag.userModifiedDate],
@@ -67,12 +62,6 @@ const TagContextMenu = ({ navigationController, isEntitledToFolders, selectedTag
>
<div ref={contextMenuRef}>
<Menu a11yLabel="Tag context menu" isOpen={contextMenuOpen}>
<MenuItem type={MenuItemType.IconButton} className={'justify-between py-1.5'} onClick={onClickStar}>
<div className="flex items-center">
<Icon type="star" className="mr-2 text-neutral" />
{selectedTag.starred ? 'Unfavorite' : 'Favorite'}
</div>
</MenuItem>
<MenuItem type={MenuItemType.IconButton} className={'justify-between py-1.5'} onClick={onClickAddSubtag}>
<div className="flex items-center">
<Icon type="add" className="mr-2 text-neutral" />

View File

@@ -9,12 +9,11 @@ import { TagsListItem } from './TagsListItem'
type Props = {
viewControllerManager: ViewControllerManager
type: 'all' | 'favorites'
}
const TagsList: FunctionComponent<Props> = ({ viewControllerManager, type }: Props) => {
const navigationController = viewControllerManager.navigationController
const allTags = type === 'all' ? navigationController.allLocalRootTags : navigationController.starredTags
const TagsList: FunctionComponent<Props> = ({ viewControllerManager }: Props) => {
const tagsState = viewControllerManager.navigationController
const allTags = tagsState.allLocalRootTags
const backend = HTML5Backend
@@ -50,20 +49,17 @@ const TagsList: FunctionComponent<Props> = ({ viewControllerManager, type }: Pro
level={0}
key={tag.uuid}
tag={tag}
type={type}
tagsState={navigationController}
tagsState={tagsState}
features={viewControllerManager.featuresController}
linkingController={viewControllerManager.linkingController}
onContextMenu={onContextMenu}
/>
)
})}
{type === 'all' && (
<RootTagDropZone
tagsState={viewControllerManager.navigationController}
featuresState={viewControllerManager.featuresController}
/>
)}
<RootTagDropZone
tagsState={viewControllerManager.navigationController}
featuresState={viewControllerManager.featuresController}
/>
</>
)}
</DndProvider>

View File

@@ -29,7 +29,6 @@ import { LinkingController } from '@/Controllers/LinkingController'
type Props = {
tag: SNTag
type: 'all' | 'favorites'
tagsState: NavigationController
features: FeaturesController
linkingController: LinkingController
@@ -41,7 +40,7 @@ const PADDING_BASE_PX = 14
const PADDING_PER_LEVEL_PX = 21
export const TagsListItem: FunctionComponent<Props> = observer(
({ tag, type, features, tagsState, level, onContextMenu, linkingController }) => {
({ tag, features, tagsState, level, onContextMenu, linkingController }) => {
const { toggleAppPane } = useResponsiveAppPane()
const [title, setTitle] = useState(tag.title || '')
@@ -263,18 +262,7 @@ export const TagsListItem: FunctionComponent<Props> = observer(
</div>
)}
<div className={'tag-icon draggable mr-2'} ref={dragRef}>
<Icon
type="hashtag"
className={`${
type === 'favorites'
? isSelected
? 'text-warning'
: 'text-info'
: isSelected
? 'text-info'
: 'text-neutral'
}`}
/>
<Icon type="hashtag" className={`${isSelected ? 'text-info' : 'text-neutral'}`} />
</div>
{isEditing ? (
<input
@@ -346,7 +334,6 @@ export const TagsListItem: FunctionComponent<Props> = observer(
level={level + 1}
key={tag.uuid}
tag={tag}
type={type}
tagsState={tagsState}
features={features}
linkingController={linkingController}

View File

@@ -52,37 +52,22 @@ const TagsSection: FunctionComponent<Props> = ({ viewControllerManager }) => {
}, [viewControllerManager, checkIfMigrationNeeded])
return (
<>
{viewControllerManager.navigationController.starredTags.length > 0 && (
<section>
<div className={'section-title-bar'}>
<div className="section-title-bar-header">
<div className="title text-sm">
<span className="font-bold">Favorites</span>
</div>
</div>
</div>
<TagsList type="favorites" viewControllerManager={viewControllerManager} />
</section>
)}
<section>
<div className={'section-title-bar'}>
<div className="section-title-bar-header">
<TagsSectionTitle
features={viewControllerManager.featuresController}
hasMigration={hasMigration}
onClickMigration={runMigration}
/>
<TagsSectionAddButton
tags={viewControllerManager.navigationController}
features={viewControllerManager.featuresController}
/>
</div>
<section>
<div className={'section-title-bar'}>
<div className="section-title-bar-header">
<TagsSectionTitle
features={viewControllerManager.featuresController}
hasMigration={hasMigration}
onClickMigration={runMigration}
/>
<TagsSectionAddButton
tags={viewControllerManager.navigationController}
features={viewControllerManager.featuresController}
/>
</div>
<TagsList type="all" viewControllerManager={viewControllerManager} />
</section>
</>
</div>
<TagsList viewControllerManager={viewControllerManager} />
</section>
)
}