chore: remove folders migration prompt (#2927)

* chore: remove folders migration prompt

* chore: remove unused imports
This commit is contained in:
Antonella Sgarlatta 2025-08-08 10:13:37 -03:00 committed by GitHub
parent be109a0f6b
commit f284111a0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 56 deletions

View file

@ -1,7 +1,6 @@
import TagsList from '@/Components/Tags/TagsList'
import { ApplicationEvent } from '@/__mocks__/@standardnotes/snjs'
import { observer } from 'mobx-react-lite'
import { FunctionComponent, useCallback, useEffect, useState } from 'react'
import { FunctionComponent } from 'react'
import TagsSectionAddButton from './TagsSectionAddButton'
import TagsSectionTitle from './TagsSectionTitle'
import { useApplication } from '../ApplicationProvider'
@ -9,47 +8,6 @@ import { useApplication } from '../ApplicationProvider'
const TagsSection: FunctionComponent = () => {
const application = useApplication()
const [hasMigration, setHasMigration] = useState<boolean>(false)
const checkIfMigrationNeeded = useCallback(() => {
setHasMigration(application.items.hasTagsNeedingFoldersMigration())
}, [application])
useEffect(() => {
const removeObserver = application.addEventObserver(async (event) => {
const events = [ApplicationEvent.CompletedInitialSync, ApplicationEvent.SignedIn]
if (events.includes(event)) {
checkIfMigrationNeeded()
}
})
return () => {
removeObserver()
}
}, [application, checkIfMigrationNeeded])
const runMigration = useCallback(async () => {
if (
await application.alerts.confirm(
'<i>Introducing native, built-in nested tags without requiring the legacy Folders extension.</i><br/></br> ' +
" To get started, we'll need to migrate any tags containing a dot character to the new system.<br/></br> " +
' This migration will convert any tags with dots appearing in their name into a natural' +
' hierarchy that is compatible with the new nested tags feature.' +
' Running this migration will remove any "." characters appearing in tag names.',
'New: Folders to Nested Tags',
'Run Migration',
)
) {
application.mutator
.migrateTagsToFolders()
.then(() => {
void application.sync.sync()
checkIfMigrationNeeded()
})
.catch(console.error)
}
}, [application, checkIfMigrationNeeded])
return (
<>
{application.navigationController.starredTags.length > 0 && (
@ -68,11 +26,7 @@ const TagsSection: FunctionComponent = () => {
<section>
<div className={'section-title-bar'}>
<div className="section-title-bar-header">
<TagsSectionTitle
features={application.featuresController}
hasMigration={hasMigration}
onClickMigration={runMigration}
/>
<TagsSectionTitle features={application.featuresController} />
{!application.navigationController.isSearching && (
<TagsSectionAddButton tags={application.navigationController} features={application.featuresController} />
)}

View file

@ -7,11 +7,9 @@ import StyledTooltip from '../StyledTooltip/StyledTooltip'
type Props = {
features: FeaturesController
hasMigration: boolean
onClickMigration: () => void
}
const TagsSectionTitle: FunctionComponent<Props> = ({ features, hasMigration, onClickMigration }) => {
const TagsSectionTitle: FunctionComponent<Props> = ({ features }) => {
const entitledToFolders = features.hasFolders
const modal = usePremiumModal()
@ -24,11 +22,6 @@ const TagsSectionTitle: FunctionComponent<Props> = ({ features, hasMigration, on
<>
<div className="title text-base md:text-sm">
<span className="font-bold">Folders</span>
{hasMigration && (
<label className="ml-1 cursor-pointer font-bold text-info" onClick={onClickMigration}>
Migration Available
</label>
)}
</div>
</>
)