@@ -39,7 +39,7 @@ import {
3939 mdiWeb ,
4040} from '@mdi/js'
4141import { buildIconUrl } from '../api/files'
42- import { sendToHost , useElectron , usingElectron } from '../lib/stores/electron'
42+ import { sendToHost , usingElectron } from '../lib/stores/electron'
4343import ContentLayout , {
4444 ContentLayoutProps ,
4545} from '../../shared/components/templates/ContentLayout'
@@ -110,7 +110,6 @@ const Application = ({
110110 const { push, query, goBack, goForward, pathname } = useRouter ( )
111111 const [ popOverState , setPopOverState ] = useState < PopOverState > ( null )
112112 const { openSettingsTab, closeSettingsTab } = useSettings ( )
113- const { usingElectron, sendToElectron } = useElectron ( )
114113 const { openNewDocForm, openNewFolderForm } = useCloudResourceModals ( )
115114 const [ showFuzzyNavigation , setShowFuzzyNavigation ] = useState ( false )
116115 const {
@@ -290,14 +289,8 @@ const Application = ({
290289 )
291290
292291 const onSpaceClick = useCallback ( ( ) => {
293- if ( ! usingElectron ) {
294- setPopOverState ( 'spaces' )
295- return
296- }
297-
298- setPopOverState ( null )
299- sendToElectron ( 'sidebar-spaces' )
300- } , [ usingElectron , sendToElectron ] )
292+ setPopOverState ( 'spaces' )
293+ } , [ ] )
301294
302295 const sidebarHeader = useMemo ( ( ) => {
303296 return (
@@ -493,43 +486,64 @@ const Application = ({
493486export default Application
494487
495488function buildSpacesBottomRows ( push : ( url : string ) => void , t : TFunction ) {
496- return [
497- {
498- label : t ( lngKeys . CreateNewSpace ) ,
499- icon : mdiPlusCircleOutline ,
500- linkProps : {
501- href : `${ process . env . BOOST_HUB_BASE_URL } /cooperate` ,
502- onClick : ( event : React . MouseEvent ) => {
503- event . preventDefault ( )
504- push ( `/cooperate` )
489+ return usingElectron
490+ ? [
491+ {
492+ label : t ( lngKeys . CreateNewSpace ) ,
493+ icon : mdiPlusCircleOutline ,
494+ linkProps : {
495+ href : `${ process . env . BOOST_HUB_BASE_URL } /cooperate` ,
496+ onClick : ( event : React . MouseEvent ) => {
497+ event . preventDefault ( )
498+ sendToHost ( 'new-space' )
499+ } ,
500+ } ,
505501 } ,
506- } ,
507- } ,
508- {
509- label : t ( lngKeys . DownloadDesktopApp ) ,
510- icon : mdiDownload ,
511- linkProps : {
512- href : 'https://github.com/BoostIO/BoostNote.next/releases/latest' ,
513- target : '_blank' ,
514- rel : 'noopener noreferrer' ,
515- } ,
516- } ,
517- {
518- label : t ( lngKeys . LogOut ) ,
519- icon : mdiLogoutVariant ,
520- linkProps : {
521- href : '/api/oauth/signout' ,
522- onClick : ( event : React . MouseEvent ) => {
523- event . preventDefault ( )
524- if ( usingElectron ) {
525- sendToHost ( 'sign-out' )
526- } else {
527- window . location . href = `${ process . env . BOOST_HUB_BASE_URL } /api/oauth/signout`
528- }
502+ {
503+ label : t ( lngKeys . LogOut ) ,
504+ icon : mdiLogoutVariant ,
505+ linkProps : {
506+ href : '/api/oauth/signout' ,
507+ onClick : ( event : React . MouseEvent ) => {
508+ event . preventDefault ( )
509+ sendToHost ( 'sign-out' )
510+ } ,
511+ } ,
529512 } ,
530- } ,
531- } ,
532- ]
513+ ]
514+ : [
515+ {
516+ label : t ( lngKeys . CreateNewSpace ) ,
517+ icon : mdiPlusCircleOutline ,
518+ linkProps : {
519+ href : `${ process . env . BOOST_HUB_BASE_URL } /cooperate` ,
520+ onClick : ( event : React . MouseEvent ) => {
521+ event . preventDefault ( )
522+ push ( `/cooperate` )
523+ } ,
524+ } ,
525+ } ,
526+ {
527+ label : t ( lngKeys . DownloadDesktopApp ) ,
528+ icon : mdiDownload ,
529+ linkProps : {
530+ href : 'https://github.com/BoostIO/BoostNote.next/releases/latest' ,
531+ target : '_blank' ,
532+ rel : 'noopener noreferrer' ,
533+ } ,
534+ } ,
535+ {
536+ label : t ( lngKeys . LogOut ) ,
537+ icon : mdiLogoutVariant ,
538+ linkProps : {
539+ href : '/api/oauth/signout' ,
540+ onClick : ( event : React . MouseEvent ) => {
541+ event . preventDefault ( )
542+ window . location . href = `${ process . env . BOOST_HUB_BASE_URL } /api/oauth/signout`
543+ } ,
544+ } ,
545+ } ,
546+ ]
533547}
534548
535549function isCodeMirrorTextAreaEvent ( event : KeyboardEvent ) {
0 commit comments