Skip to content

Commit ffce197

Browse files
committed
Initial local space refactor and shared components update
Implement topbar tree map Add local UI component Add breadcrumbs implementation Add shared modal implementation in local topbar Initial theme handling Add initial theme discard Add basic theme options to NavigatorItem Add initial theme setup for components Add navigator v2 themes Add folder list v2 themes Update some buttons via v2 button theme Add second iteration of theme updating Updated preferences tab components Updated topbar action items components Update bottom bar selection components Fix some preferences buttons and tabs Add shared styles for SearchModal component Add shared styles for preferences keymap tab Use shared global style Fix topbar breadcrumbs for specific storage cases Remove duplicate storage breadcrumbs where not needed Implement editing of storage name (localUI) Fix folder rename (localUI) Fix local UI for trashing and deleting note Fix no dialog on delete folder/note Update App.tsx with new dialog Fix local search colors Fix local search and local replace colors (v2 theme) Fix CodeEditor marks colors Discard local modal Discard local modal since cloud one is generic now Fix cloud intro modal Fix cloud intro modal colors Update Form to v2 style Update style functions for primary and secondary buttons Fix some size issues in folder view Fix folder navigation style (v2 update) Fix code fence styles Update code fence styles to v2 theme Fix shared context menu provider for local space Add shared context menu provider implementation in local space App Fix a typo in local space UI Implement proper topbar folder breadcrumbs Remove old topbar breadcrumbs on folder view Add folder page breadcrumbs when on folder view (no note view) Discard old topbar controls and use shared topbar controls (implement them based on previous) Comment out the toggle context view on topbar controls Add initial side bar mappers Add search API Update search structure for local space Implement sidebar mappers except for tree Half tree mapping done Add full tree implementation mock Todo: DND from local space Todo: Implement sidebar folding and other API Fix folder and note parent IDs Still need to fix some todos, styling and implement rest of items Implement Dnd Implement sidebar folding Add sidebar collapse store Fix recursion on folder Update v2 combined providers Reorganize storage sidebar items Fix storages, folders and note mappings Update sidebar to show workspace Update sidebar to show workspace and put notes and folders from storage to workspace root Rename tags to labels, note to doc and storage to workspace (v2 part of API, DB still not) Implement test DnD Refactor more v2 components to new naming Rename routes to doc and workspace, tags to lables and trashCan to archive Refactor sidebar Refactor sidebar application container Use shared app layout Implement rest of dnd Refactor more of application layout Implement proper sidebar toolbar instead of AppNavigator one Fix some search issues for matching note content Overall spaces mapping fix Fix context view component Fix topbar breadcrumb global style border issue Fix App navigator (revert) Add sidebar state in general status Implement timeline mapping for local Fix two bugs Fix topbar rendering fight on z-index with code mirror editor (set code mirror one to z-index: 0) Fix parent folder in breadcrumbs, should be set to breadcrumb folder so that new one goes inside Refactor code Refactor code into application structure Create Application main component Refactro WikiNotePage to use Application component Add separate ArchivePage Add separate AttachmentsPage Add separate LabelsPage Refactor some trash to archive namings Update to appropriate buttons on archive/label pages Update folder detail icon Use shared icon for folder detail view Set color of the icon and size for note/labels/folder/archive view Add timeline page Implement most of the components Fix timeline page Add archived at property Update events handling and show more button Set gray tags only Refactor code in timeline Fix DocLink (add style only) to not refresh the page as it is link with href and onClick prop Update preferences styling Update most of the styles for preferences Set all updated style to shared style functions Update some components Refactor AppNavigator Port features from AppNavigator Refactor CreateStoragePage Update Icon components in molecules and atoms in local space to use shared one Fix AttachmentsPage (no storage in Application component) Revert export buildSpacesBottomRows function Remove unused components from local Use Spinner from shared in cloud Removed bunch of now unused components (replaced by topbar and sidebar) Fix AppNavigator for cloud spaces For now using 2 navigators since its hard to refactor the code to use component in single place In local space there is need for sidebar and other items, in cloud space they are provided via webview In local space with toolbar off on sidebar it does not layout well with AppNavigator being hidden (even after z-index fix, it stays on top rather than move the sidebar) Refactor NoteStorageNavigator Remove unused code Rename component Update to shared toast Dialog/Modal/Toast from shared Remove few components Fix some bugs and error handling in localUI component Update topbar properties to have type for breadcrumbs (button and not separator) Update success messages across pushMessage new toast API Refactor FolderDetailListNoteItem Use WithTooltip and Button from shared components Add Search Highlight colors to shared common theme Update more components to shared Replace some buttons to use shared one Replace some links to use shared one (with inline encapsulation) Remove some unused components Refactor form buttons Refactor more components to shared Refactor AboutTab links Update storage create to shared form elements Rebase and update to latest master (new nav buttons) Update FormRowProps location in localUI Add sidebar hide option Update keymap component buttons Replace KeymapItemButton with shared one Fix global content search results and style Update to correct shared style colors for highlight Fix global search note and note content results (note content results not showing) Remove redundant console.logs from search results API Refactor more components to shared Update context view labels input and rendering (similar to cloud) Update ProgressBar to shared style theme Refactor form input to allow onKeyDown event as well Remove unused components after refactor
1 parent 5fdca54 commit ffce197

File tree

165 files changed

+6361
-6189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+6361
-6189
lines changed

src/cloud/components/organisms/Onboarding/UsagePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
} from '@mdi/js'
1111
import Flexbox from '../../atoms/Flexbox'
1212
import Button from '../../atoms/Button'
13-
import Spinner from '../../../../components/atoms/Spinner'
1413
import Icon from '../../../../components/atoms/Icon'
1514
import { useRouter } from '../../../lib/router'
1615
import { usingElectron, sendToHost } from '../../../lib/stores/electron'
16+
import Spinner from '../../../../shared/components/atoms/Spinner'
1717

1818
interface UsagePageProps {
1919
onUsage: (val: 'personal' | 'team') => void

src/cloud/components/organisms/Subscription/SubscriptionManagement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mdiGiftOff, mdiOpenInNew } from '@mdi/js'
22
import React, { useCallback, useMemo, useState } from 'react'
33
import Icon from '../../../../components/atoms/Icon'
4-
import Spinner from '../../../../components/atoms/Spinner'
4+
import Spinner from '../../../../shared/components/atoms/Spinner'
55
import { useToast } from '../../../../shared/lib/stores/toast'
66
import { cancelSubscription } from '../../../api/teams/subscription'
77
import { getTeamPortalUrl } from '../../../api/teams/subscription/invoices'

src/cloud/lib/hooks/useCloudResourceModals.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export function useCloudResourceModals() {
248248
) => {
249249
messageBox({
250250
title: `Delete ${title}`,
251-
message: `Are you sure to remove for good this content?`,
251+
message: `Are you sure you want to remove this permanently?`,
252252
iconType: DialogIconTypes.Warning,
253253
buttons: [
254254
{

src/cloud/lib/i18n/enUS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const enTranslation: TranslationSource = {
66
'general.cancel': 'Cancel',
77
'general.update': 'Update',
88
'general.attachments': 'Attachments',
9-
'general.trash': 'Trash',
9+
'general.archive': 'Archive',
1010
'general.allnote': 'All Notes',
1111
'general.signin': 'Sign In',
1212
'general.signinCheck': 'Signing in...',

src/cloud/lib/i18n/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type TranslationSource = {
33
'general.cancel': string
44
'general.update': string
55
'general.attachments': string
6-
'general.trash': string
6+
'general.archive': string
77
'general.allnote': string
88
'general.signin': string
99
'general.signinCheck': string

src/cloud/lib/mappers/topbarTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function mapTopbarTree(
5757
)
5858

5959
folders.forEach((folder) => {
60+
if (folder.pathname == '/') return
6061
const folderId = getFolderId(folder)
6162
const href = `${process.env.BOOST_HUB_BASE_URL}${getFolderHref(
6263
folder,
@@ -112,6 +113,5 @@ export function mapTopbarTree(
112113
})
113114
items.set(parentId, parentArray)
114115
})
115-
116116
return items
117117
}

src/cloud/lib/stores/pageStore/store.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ function usePageDataStore(pageProps: any) {
201201
},
202202
}
203203
}
204-
205204
const docCount = team.creationsCounter
206205
const trialIsOver = !team.trial
207206
overLimit = docCount >= freePlanDocLimit

src/components/App.tsx

Lines changed: 84 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import React, { useState, useEffect, useCallback } from 'react'
1+
import React, { useState, useEffect, useCallback, useMemo } from 'react'
22
import Router from './Router'
3-
import GlobalStyle from './GlobalStyle'
43
import { ThemeProvider } from 'styled-components'
5-
import { selectTheme } from '../themes'
6-
import Dialog from './organisms/Dialog'
74
import { useDb } from '../lib/db'
85
import PreferencesModal from './PreferencesModal/PreferencesModal'
96
import { usePreferences } from '../lib/preferences'
107
import '../lib/i18n'
118
import '../lib/analytics'
129
import CodeMirrorStyle from './CodeMirrorStyle'
13-
import ToastList from './Toast'
1410
import styled from '../lib/styled'
1511
import { useEffectOnce } from 'react-use'
16-
import AppNavigator from './organisms/AppNavigator'
1712
import { useRouter } from '../lib/router'
1813
import { values, keys } from '../lib/db/utils'
1914
import {
@@ -51,8 +46,16 @@ import { useCreateWorkspaceModal } from '../lib/createWorkspaceModal'
5146
import CreateWorkspaceModal from './organisms/CreateWorkspaceModal'
5247
import { useStorageRouter } from '../lib/storageRouter'
5348
import ExternalStyle from './ExternalStyle'
54-
import { useDialog, DialogIconTypes } from '../lib/dialog'
5549
import { selectV2Theme } from '../shared/lib/styled/styleFunctions'
50+
import Modal from '../shared/components/organisms/Modal'
51+
import GlobalStyle from '../shared/components/atoms/GlobalStyle'
52+
import { DialogIconTypes, useDialog } from '../shared/lib/stores/dialog'
53+
import Dialog from '../shared/components/organisms/Dialog/Dialog'
54+
import ContextMenu from '../shared/components/molecules/ContextMenu'
55+
import { useCloudIntroModal } from '../lib/cloudIntroModal'
56+
import CloudIntroModal from './organisms/CloudIntroModal'
57+
import AppNavigator from './organisms/AppNavigator'
58+
import Toast from '../shared/components/organisms/Toast'
5659

5760
const LoadingText = styled.div`
5861
margin: 30px;
@@ -119,25 +122,32 @@ const App = () => {
119122
messageBox({
120123
title: 'Sign In',
121124
message: 'Your cloud access token has been expired.',
122-
buttons: ['Sign In Again', 'Cancel'],
123-
defaultButtonIndex: 0,
125+
buttons: [
126+
{
127+
label: 'Sign In Again',
128+
defaultButton: true,
129+
onClick: () => {
130+
push(`/app/boosthub/login`)
131+
setTimeout(() => {
132+
boostHubLoginRequestEventEmitter.dispatch()
133+
}, 1000)
134+
},
135+
},
136+
{
137+
label: 'Cancel',
138+
cancelButton: true,
139+
onClick: () => {
140+
setPreferences({
141+
'cloud.user': undefined,
142+
})
143+
setGeneralStatus({
144+
boostHubTeams: [],
145+
})
146+
},
147+
},
148+
],
149+
// defaultButtonIndex: 0,
124150
iconType: DialogIconTypes.Warning,
125-
onClose: (value: number | null) => {
126-
if (value === 0) {
127-
push(`/app/boosthub/login`)
128-
setTimeout(() => {
129-
boostHubLoginRequestEventEmitter.dispatch()
130-
}, 1000)
131-
return
132-
}
133-
134-
setPreferences({
135-
'cloud.user': undefined,
136-
})
137-
setGeneralStatus({
138-
boostHubTeams: [],
139-
})
140-
},
141151
})
142152
return
143153
}
@@ -419,35 +429,57 @@ const App = () => {
419429
toggleShowCreateWorkspaceModal,
420430
} = useCreateWorkspaceModal()
421431

432+
const { showingCloudIntroModal } = useCloudIntroModal()
433+
434+
const activeBoostHubTeamDomain = useMemo<string | null>(() => {
435+
if (routeParams.name !== 'boosthub.teams.show') {
436+
return null
437+
}
438+
return routeParams.domain
439+
}, [routeParams])
440+
441+
const boosthubTeam =
442+
activeBoostHubTeamDomain != null
443+
? generalStatus.boostHubTeams.find(
444+
(team) => team.domain === activeBoostHubTeamDomain
445+
)
446+
: null
447+
422448
return (
423-
<ThemeProvider theme={selectTheme(preferences['general.theme'])}>
424-
<ThemeProvider theme={selectV2Theme(preferences['general.theme'] as any)}>
425-
<AppContainer
426-
onDrop={(event: React.DragEvent) => {
427-
event.preventDefault()
428-
}}
429-
>
430-
{initialized ? (
431-
<>
449+
<ThemeProvider theme={selectV2Theme(preferences['general.theme'] as any)}>
450+
<AppContainer
451+
onDrop={(event: React.DragEvent) => {
452+
event.preventDefault()
453+
}}
454+
>
455+
{initialized ? (
456+
<>
457+
{boosthubTeam != null ? (
432458
<AppNavigator />
433-
<Router />
434-
{showCreateWorkspaceModal && (
435-
<CreateWorkspaceModal
436-
closeModal={toggleShowCreateWorkspaceModal}
437-
/>
438-
)}
439-
</>
440-
) : (
441-
<LoadingText>Loading Data...</LoadingText>
442-
)}
443-
<GlobalStyle />
444-
<Dialog />
445-
<PreferencesModal />
446-
<ToastList />
447-
<CodeMirrorStyle />
448-
<ExternalStyle />
449-
</AppContainer>
450-
</ThemeProvider>
459+
) : (
460+
showingCloudIntroModal && <CloudIntroModal />
461+
)}
462+
<Router />
463+
{showCreateWorkspaceModal && (
464+
<CreateWorkspaceModal
465+
closeModal={toggleShowCreateWorkspaceModal}
466+
/>
467+
)}
468+
</>
469+
) : (
470+
<LoadingText>Loading Data...</LoadingText>
471+
)}
472+
<GlobalStyle />
473+
<CodeMirrorStyle />
474+
<ExternalStyle />
475+
476+
<Toast />
477+
<PreferencesModal />
478+
<ContextMenu />
479+
480+
<Dialog />
481+
<Modal />
482+
</AppContainer>
451483
</ThemeProvider>
452484
)
453485
}

0 commit comments

Comments
 (0)