Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"@stripe/react-stripe-js": "^1.2.0",
"@stripe/stripe-js": "^1.11.0",
"@types/react-color": "^3.0.4",
"array-move": "^2.2.1",
"aws-amplify": "^4.0.3",
"chart.js": "^2.9.4",
"classcat": "^4.0.2",
Expand Down
17 changes: 16 additions & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import CloudIntroModal from './organisms/CloudIntroModal'
import AppNavigator from './organisms/AppNavigator'
import Toast from '../shared/components/organisms/Toast'
import styled from '../shared/lib/styled'
import { useToast } from '../shared/lib/stores/toast'

const LoadingText = styled.div`
margin: 30px;
Expand All @@ -69,7 +70,7 @@ const AppContainer = styled.div`
`

const App = () => {
const { initialize, storageMap } = useDb()
const { initialize, storageMap, getUninitializedStorageData } = useDb()
const { push, pathname } = useRouter()
const [initialized, setInitialized] = useState(false)
const { setGeneralStatus, generalStatus } = useGeneralStatus()
Expand All @@ -82,6 +83,7 @@ const App = () => {
const routeParams = useRouteParams()
const { navigate: navigateToStorage } = useStorageRouter()
const { messageBox } = useDialog()
const { pushMessage } = useToast()

useEffectOnce(() => {
const fetchDesktopGlobalDataOfCloud = async () => {
Expand Down Expand Up @@ -208,8 +210,21 @@ const App = () => {
}
}
setInitialized(true)

// notify on failed initializations
const uninitializedStorageData = await getUninitializedStorageData()
if (uninitializedStorageData.length > 0) {
pushMessage({
title: 'Error',
description: `Failed to initialize some storages, please check console for more info.`,
})
}
})
.catch((error) => {
pushMessage({
title: 'Error',
description: `Failed to initialize some storages, please check console for more info.`,
})
console.error(error)
})
})
Expand Down
7 changes: 6 additions & 1 deletion src/components/organisms/FolderDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
selectStyle,
} from '../../shared/lib/styled/styleFunctions'
import styled from '../../shared/lib/styled'
import { NOTE_ID_PREFIX } from '../../lib/db/consts'

interface FolderDetailProps {
storage: NoteStorage
Expand Down Expand Up @@ -46,7 +47,11 @@ const FolderDetail = ({ storage, folderPathname }: FolderDetailProps) => {
return []
}

return [...folder.noteIdSet]
return [
...(folder.orderedIds || []).filter((orderId) =>
orderId.startsWith(NOTE_ID_PREFIX)
),
]
.reduce((notes, noteId) => {
const note = storage.noteMap[noteId]
if (note != null && !note.trashed) {
Expand Down
24 changes: 16 additions & 8 deletions src/components/organisms/SidebarContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ import { useTranslation } from 'react-i18next'
import { useSearchModal } from '../../lib/searchModal'
import styled from '../../shared/lib/styled'
import cc from 'classcat'
import { SidebarTreeSortingOrders } from '../../shared/lib/sidebar'
import { useGeneralStatus } from '../../lib/generalStatus'
import { AppUser } from '../../shared/lib/mappers/users'
import { useLocalUI } from '../../lib/v2/hooks/local/useLocalUI'
import {
mapTree,
SidebarTreeSortingOrders,
} from '../../lib/v2/mappers/local/sidebarTree'
import { mapTree } from '../../lib/v2/mappers/local/sidebarTree'
import { useLocalDB } from '../../lib/v2/hooks/local/useLocalDB'
import { useLocalDnd } from '../../lib/v2/hooks/local/useLocalDnd'
import { CollapsableType } from '../../lib/v2/stores/sidebarCollapse'
Expand Down Expand Up @@ -293,14 +291,22 @@ const SidebarContainer = ({
)

const getFoldEvents = useCallback(
(type: CollapsableType, key: string) => {
(type: CollapsableType, key: string, reversed?: boolean) => {
if (reversed) {
return {
fold: () => unfoldItem(type, key),
unfold: () => foldItem(type, key),
toggle: () => toggleItem(type, key),
}
}

return {
fold: () => foldItem(type, key),
unfold: () => unfoldItem(type, key),
toggle: () => toggleItem(type, key),
}
},
[foldItem, unfoldItem, toggleItem]
[toggleItem, unfoldItem, foldItem]
)

const tree = useMemo(() => {
Expand Down Expand Up @@ -356,11 +362,13 @@ const SidebarContainer = ({
const sidebarHeaderControls: SidebarControls = useMemo(() => {
return {
'View Options': (tree || []).map((category) => {
const key = (category.label || '').toLocaleLowerCase()
const hideKey = `hide-${key}`
return {
type: 'check',
label: category.label,
checked: !sideBarOpenedLinksIdsSet.has(`hide-${category.label}`),
onClick: () => toggleItem('links', `hide-${category.label}`),
checked: !sideBarOpenedLinksIdsSet.has(hideKey),
onClick: () => toggleItem('links', hideKey),
}
}),
Sorting: Object.values(SidebarTreeSortingOrders).map((sort) => {
Expand Down
Loading