Skip to content

Update local space to use shared components #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6199262
Initial local space refactor and shared components update
Komediruzecki Apr 24, 2021
2b41464
Discard all locales/languages
Komediruzecki May 27, 2021
06a36bd
Deprecate show contents of subfolders option
Komediruzecki May 28, 2021
1d15e0b
Remove local Icon component
Komediruzecki May 30, 2021
5e6b821
Refactor some components
Komediruzecki May 30, 2021
ab5d29e
Fix tag color update in storage map
Komediruzecki May 30, 2021
e79eb04
Update SidebarContainer
Komediruzecki May 30, 2021
1b16dae
Add pouchDB deprecation page
Komediruzecki May 30, 2021
dcc7472
Fix timeline events sort
Komediruzecki May 30, 2021
04da293
Cleanup code
Komediruzecki May 30, 2021
f800efc
Fix cursor being reset on changing view
Komediruzecki May 30, 2021
c3d9b74
Discard toggle app navigator from menu
Komediruzecki May 30, 2021
36b6e22
Revert cloud changes
Komediruzecki May 31, 2021
1c9e346
Refactor MarkdownTab to shared components
Komediruzecki May 31, 2021
3874ab6
Fix PouchDBDeprecationPage header
Komediruzecki May 31, 2021
f591e50
Add all prevent defaults to context menu
Komediruzecki May 31, 2021
5ef2a67
Add support for opening exported item in folder
Komediruzecki Jun 1, 2021
ee36174
Add support for export options
Komediruzecki Jun 1, 2021
8ce59fe
Clean up hook deps for storageMap
Rokt33r Jun 2, 2021
1c46465
Discard useless conditional in getResourceId
Rokt33r Jun 2, 2021
94f68fd
Discard commented global styles
Rokt33r Jun 2, 2021
951c851
Discard comments in BaseTheme
Rokt33r Jun 2, 2021
307f65f
Fix sidebarCollapseKey to follow convention
Rokt33r Jun 2, 2021
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
4 changes: 2 additions & 2 deletions src/cloud/components/organisms/Onboarding/UsagePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
} from '@mdi/js'
import Flexbox from '../../atoms/Flexbox'
import Button from '../../atoms/Button'
import Spinner from '../../../../components/atoms/Spinner'
import Icon from '../../../../components/atoms/Icon'
import { useRouter } from '../../../lib/router'
import { usingElectron, sendToHost } from '../../../lib/stores/electron'
import Spinner from '../../../../shared/components/atoms/Spinner'
import Icon from '../../atoms/Icon'

interface UsagePageProps {
onUsage: (val: 'personal' | 'team') => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { mdiGiftOff, mdiOpenInNew } from '@mdi/js'
import React, { useCallback, useMemo, useState } from 'react'
import Icon from '../../../../components/atoms/Icon'
import Spinner from '../../../../components/atoms/Spinner'
import Spinner from '../../../../shared/components/atoms/Spinner'
import { useToast } from '../../../../shared/lib/stores/toast'
import { cancelSubscription } from '../../../api/teams/subscription'
import { getTeamPortalUrl } from '../../../api/teams/subscription/invoices'
Expand All @@ -24,6 +23,7 @@ import {
newUserStandardCouponId,
} from '../../../lib/consts'
import { useElectron } from '../../../lib/stores/electron'
import Icon from '../../../../shared/components/atoms/Icon'

interface SubscriptionManagementProps {
subscription: SerializedSubscription
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/lib/hooks/useCloudResourceModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export function useCloudResourceModals() {
) => {
messageBox({
title: `Delete ${title}`,
message: `Are you sure to remove for good this content?`,
message: `Are you sure you want to remove this permanently?`,
iconType: DialogIconTypes.Warning,
buttons: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/lib/i18n/enUS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const enTranslation: TranslationSource = {
'general.cancel': 'Cancel',
'general.update': 'Update',
'general.attachments': 'Attachments',
'general.trash': 'Trash',
'general.archive': 'Archive',
'general.allnote': 'All Notes',
'general.signin': 'Sign In',
'general.signinCheck': 'Signing in...',
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/lib/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export type TranslationSource = {
'general.cancel': string
'general.update': string
'general.attachments': string
'general.trash': string
'general.archive': string
'general.allnote': string
'general.signin': string
'general.signinCheck': string
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/lib/mappers/topbarTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function mapTopbarTree(
)

folders.forEach((folder) => {
if (folder.pathname == '/') return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a mistake, changing this in cloud mapper, I'll revert this.
I suppose its not a mistake in rebasing

const folderId = getFolderId(folder)
const href = `${process.env.BOOST_HUB_BASE_URL}${getFolderHref(
folder,
Expand Down Expand Up @@ -112,6 +113,5 @@ export function mapTopbarTree(
})
items.set(parentId, parentArray)
})

return items
}
1 change: 0 additions & 1 deletion src/cloud/lib/stores/pageStore/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function usePageDataStore(pageProps: any) {
},
}
}

const docCount = team.creationsCounter
const trialIsOver = !team.trial
overLimit = docCount >= freePlanDocLimit
Expand Down
136 changes: 84 additions & 52 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import React, { useState, useEffect, useCallback } from 'react'
import React, { useState, useEffect, useCallback, useMemo } from 'react'
import Router from './Router'
import GlobalStyle from './GlobalStyle'
import { ThemeProvider } from 'styled-components'
import { selectTheme } from '../themes'
import Dialog from './organisms/Dialog'
import { useDb } from '../lib/db'
import PreferencesModal from './PreferencesModal/PreferencesModal'
import { usePreferences } from '../lib/preferences'
import '../lib/i18n'
import '../lib/analytics'
import CodeMirrorStyle from './CodeMirrorStyle'
import ToastList from './Toast'
import styled from '../lib/styled'
import { useEffectOnce } from 'react-use'
import AppNavigator from './organisms/AppNavigator'
import { useRouter } from '../lib/router'
import { values, keys } from '../lib/db/utils'
import {
Expand Down Expand Up @@ -51,8 +46,16 @@ import { useCreateWorkspaceModal } from '../lib/createWorkspaceModal'
import CreateWorkspaceModal from './organisms/CreateWorkspaceModal'
import { useStorageRouter } from '../lib/storageRouter'
import ExternalStyle from './ExternalStyle'
import { useDialog, DialogIconTypes } from '../lib/dialog'
import { selectV2Theme } from '../shared/lib/styled/styleFunctions'
import Modal from '../shared/components/organisms/Modal'
import GlobalStyle from '../shared/components/atoms/GlobalStyle'
import { DialogIconTypes, useDialog } from '../shared/lib/stores/dialog'
import Dialog from '../shared/components/organisms/Dialog/Dialog'
import ContextMenu from '../shared/components/molecules/ContextMenu'
import { useCloudIntroModal } from '../lib/cloudIntroModal'
import CloudIntroModal from './organisms/CloudIntroModal'
import AppNavigator from './organisms/AppNavigator'
import Toast from '../shared/components/organisms/Toast'

const LoadingText = styled.div`
margin: 30px;
Expand Down Expand Up @@ -119,25 +122,32 @@ const App = () => {
messageBox({
title: 'Sign In',
message: 'Your cloud access token has been expired.',
buttons: ['Sign In Again', 'Cancel'],
defaultButtonIndex: 0,
buttons: [
{
label: 'Sign In Again',
defaultButton: true,
onClick: () => {
push(`/app/boosthub/login`)
setTimeout(() => {
boostHubLoginRequestEventEmitter.dispatch()
}, 1000)
},
},
{
label: 'Cancel',
cancelButton: true,
onClick: () => {
setPreferences({
'cloud.user': undefined,
})
setGeneralStatus({
boostHubTeams: [],
})
},
},
],
// defaultButtonIndex: 0,
iconType: DialogIconTypes.Warning,
onClose: (value: number | null) => {
if (value === 0) {
push(`/app/boosthub/login`)
setTimeout(() => {
boostHubLoginRequestEventEmitter.dispatch()
}, 1000)
return
}

setPreferences({
'cloud.user': undefined,
})
setGeneralStatus({
boostHubTeams: [],
})
},
})
return
}
Expand Down Expand Up @@ -419,35 +429,57 @@ const App = () => {
toggleShowCreateWorkspaceModal,
} = useCreateWorkspaceModal()

const { showingCloudIntroModal } = useCloudIntroModal()

const activeBoostHubTeamDomain = useMemo<string | null>(() => {
if (routeParams.name !== 'boosthub.teams.show') {
return null
}
return routeParams.domain
}, [routeParams])

const boosthubTeam =
activeBoostHubTeamDomain != null
? generalStatus.boostHubTeams.find(
(team) => team.domain === activeBoostHubTeamDomain
)
: null

return (
<ThemeProvider theme={selectTheme(preferences['general.theme'])}>
<ThemeProvider theme={selectV2Theme(preferences['general.theme'] as any)}>
<AppContainer
onDrop={(event: React.DragEvent) => {
event.preventDefault()
}}
>
{initialized ? (
<>
<ThemeProvider theme={selectV2Theme(preferences['general.theme'] as any)}>
<AppContainer
onDrop={(event: React.DragEvent) => {
event.preventDefault()
}}
>
{initialized ? (
<>
{boosthubTeam != null ? (
<AppNavigator />
<Router />
{showCreateWorkspaceModal && (
<CreateWorkspaceModal
closeModal={toggleShowCreateWorkspaceModal}
/>
)}
</>
) : (
<LoadingText>Loading Data...</LoadingText>
)}
<GlobalStyle />
<Dialog />
<PreferencesModal />
<ToastList />
<CodeMirrorStyle />
<ExternalStyle />
</AppContainer>
</ThemeProvider>
) : (
showingCloudIntroModal && <CloudIntroModal />
)}
<Router />
{showCreateWorkspaceModal && (
<CreateWorkspaceModal
closeModal={toggleShowCreateWorkspaceModal}
/>
)}
</>
) : (
<LoadingText>Loading Data...</LoadingText>
)}
<GlobalStyle />
<CodeMirrorStyle />
<ExternalStyle />

<Toast />
<PreferencesModal />
<ContextMenu />

<Dialog />
<Modal />
</AppContainer>
</ThemeProvider>
)
}
Expand Down
Loading