Revert "feat: ability to favorite tags (#1852)"
This reverts commit 4f3b258363.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ export class NavigationController
|
||||
{
|
||||
tags: SNTag[] = []
|
||||
smartViews: SmartView[] = []
|
||||
starredTags: SNTag[] = []
|
||||
allNotesCount_ = 0
|
||||
selectedUuid: AnyTag['uuid'] | undefined = undefined
|
||||
selected_: AnyTag | undefined
|
||||
@@ -67,7 +66,6 @@ export class NavigationController
|
||||
|
||||
makeObservable(this, {
|
||||
tags: observable,
|
||||
starredTags: observable,
|
||||
smartViews: observable.ref,
|
||||
hasAtLeastOneFolder: computed,
|
||||
allNotesCount_: observable,
|
||||
@@ -113,7 +111,7 @@ export class NavigationController
|
||||
this.application.streamItems([ContentType.Tag, ContentType.SmartView], ({ changed, removed }) => {
|
||||
runInAction(() => {
|
||||
this.tags = this.application.items.getDisplayableTags()
|
||||
this.starredTags = this.tags.filter((tag) => tag.starred)
|
||||
|
||||
this.smartViews = this.application.items.getSmartViews()
|
||||
|
||||
const currentSelectedTag = this.selected_
|
||||
@@ -478,14 +476,6 @@ export class NavigationController
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
public async setFavorite(tag: SNTag, favorite: boolean) {
|
||||
return this.application.mutator
|
||||
.changeAndSaveItem<TagMutator>(tag, (mutator) => {
|
||||
mutator.starred = favorite
|
||||
})
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
public get editingTag(): SNTag | SmartView | undefined {
|
||||
return this.editing_
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user