chore: preferences changes
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { observer } from 'mobx-react-lite'
|
||||
import { FunctionComponent, useCallback, useMemo } from 'react'
|
||||
import { FunctionComponent, useMemo } from 'react'
|
||||
import Dropdown from '../Dropdown/Dropdown'
|
||||
import { DropdownItem } from '../Dropdown/DropdownItem'
|
||||
import PreferencesMenuItem from './PreferencesComponents/MenuItem'
|
||||
import { PreferencesMenu } from './PreferencesMenu'
|
||||
import { PreferenceId } from '@standardnotes/ui-services'
|
||||
import { useApplication } from '../ApplicationProvider'
|
||||
import { classNames, Environment } from '@standardnotes/snjs'
|
||||
import { classNames } from '@standardnotes/snjs'
|
||||
import { isIOS } from '@/Utils'
|
||||
|
||||
type Props = {
|
||||
@@ -14,35 +13,18 @@ type Props = {
|
||||
}
|
||||
|
||||
const PreferencesMenuView: FunctionComponent<Props> = ({ menu }) => {
|
||||
const application = useApplication()
|
||||
const { selectedPaneId, selectPane, menuItems } = menu
|
||||
|
||||
const dropdownMenuItems: DropdownItem[] = useMemo(
|
||||
() =>
|
||||
menuItems
|
||||
.filter((pref) => pref.id !== 'filesend')
|
||||
.map((menuItem) => ({
|
||||
icon: menuItem.icon,
|
||||
label: menuItem.label,
|
||||
value: menuItem.id,
|
||||
})),
|
||||
menuItems.map((menuItem) => ({
|
||||
icon: menuItem.icon,
|
||||
label: menuItem.label,
|
||||
value: menuItem.id,
|
||||
})),
|
||||
[menuItems],
|
||||
)
|
||||
|
||||
const openFileSend = useCallback(() => {
|
||||
const link = 'https://filesend.standardnotes.com/'
|
||||
|
||||
if (application.isNativeMobileWeb()) {
|
||||
application.mobileDevice().openUrl(link)
|
||||
return
|
||||
} else if (application.environment === Environment.Desktop) {
|
||||
application.desktopDevice?.openUrl(link)
|
||||
return
|
||||
}
|
||||
|
||||
window.open(link, '_blank')
|
||||
}, [application])
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
@@ -59,10 +41,6 @@ const PreferencesMenuView: FunctionComponent<Props> = ({ menu }) => {
|
||||
selected={pref.selected}
|
||||
hasBubble={pref.hasBubble}
|
||||
onClick={() => {
|
||||
if (pref.id === 'filesend') {
|
||||
openFileSend()
|
||||
return
|
||||
}
|
||||
selectPane(pref.id)
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user