mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
refactor
This commit is contained in:
1
apps/mobile/.vscode/settings.json
vendored
Normal file
1
apps/mobile/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import Orientation from 'react-native-orientation';
|
import Orientation from 'react-native-orientation';
|
||||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||||
import AppLoader from './src/components/AppLoader';
|
import Launcher from './src/components/launcher';
|
||||||
import { RootView } from './src/navigation/RootView';
|
import { RootView } from './src/navigation/RootView';
|
||||||
import { useTracked } from './src/provider';
|
import { useTracked } from './src/provider';
|
||||||
import { initialize, useSettingStore, useUserStore } from './src/provider/stores';
|
import { initialize, useSettingStore, useUserStore } from './src/provider/stores';
|
||||||
@@ -10,11 +10,10 @@ import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from './src/services/E
|
|||||||
import Notifications from './src/services/Notifications';
|
import Notifications from './src/services/Notifications';
|
||||||
import SettingsService from './src/services/SettingsService';
|
import SettingsService from './src/services/SettingsService';
|
||||||
import { TipManager } from './src/services/tip-manager';
|
import { TipManager } from './src/services/tip-manager';
|
||||||
import { Tracker } from './src/utils';
|
|
||||||
import { db } from './src/utils/database';
|
import { db } from './src/utils/database';
|
||||||
import { eDispatchAction } from './src/utils/Events';
|
import { eDispatchAction } from './src/utils/events';
|
||||||
import { MMKV } from './src/utils/mmkv';
|
import { useAppEvents } from './src/utils/hooks/use-app-events';
|
||||||
import { useAppEvents } from './src/utils/use-app-events';
|
import { MMKV } from './src/utils/database/mmkv';
|
||||||
|
|
||||||
let databaseHasLoaded = false;
|
let databaseHasLoaded = false;
|
||||||
|
|
||||||
@@ -78,9 +77,6 @@ const App = () => {
|
|||||||
await TipManager.init();
|
await TipManager.init();
|
||||||
await loadDatabase();
|
await loadDatabase();
|
||||||
useUserStore.getState().setUser(await db.user.getUser());
|
useUserStore.getState().setUser(await db.user.getUser());
|
||||||
if (SettingsService.get().telemetry) {
|
|
||||||
Tracker.record('3c6890ce-8410-49d5-8831-15fb2eb28a21');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
databaseHasLoaded = true;
|
databaseHasLoaded = true;
|
||||||
@@ -103,7 +99,7 @@ const App = () => {
|
|||||||
return (
|
return (
|
||||||
<SafeAreaProvider>
|
<SafeAreaProvider>
|
||||||
<RootView />
|
<RootView />
|
||||||
<AppLoader onLoad={loadMainApp} />
|
<Launcher onLoad={loadMainApp} />
|
||||||
</SafeAreaProvider>
|
</SafeAreaProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import isURL from 'validator/lib/isURL';
|
|||||||
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../src/services/EventManager';
|
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../src/services/EventManager';
|
||||||
import { getElevation } from '../src/utils';
|
import { getElevation } from '../src/utils';
|
||||||
import { db } from '../src/utils/database';
|
import { db } from '../src/utils/database';
|
||||||
import Storage from '../src/utils/storage';
|
import Storage from '../src/utils/database/storage';
|
||||||
import { sleep } from '../src/utils/TimeUtils';
|
import { sleep } from '../src/utils/time';
|
||||||
import { Search } from './search';
|
import { Search } from './search';
|
||||||
import { useShareStore } from './store';
|
import { useShareStore } from './store';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Appearance, SafeAreaView } from 'react-native';
|
import { Appearance, SafeAreaView } from 'react-native';
|
||||||
import RNBootSplash from 'react-native-bootsplash';
|
import RNBootSplash from 'react-native-bootsplash';
|
||||||
import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/Colors';
|
import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/color-scheme';
|
||||||
import NotesnookShare from './index';
|
import NotesnookShare from './index';
|
||||||
|
|
||||||
export default class QuickNoteIOS extends Component {
|
export default class QuickNoteIOS extends Component {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Appearance } from 'react-native';
|
import { Appearance } from 'react-native';
|
||||||
import create from 'zustand';
|
import create from 'zustand';
|
||||||
import { ACCENT, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, setAccentColor } from '../src/utils/Colors';
|
import { ACCENT, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/color-scheme';
|
||||||
import { MMKV } from '../src/utils/mmkv';
|
import { MMKV } from '../src/utils/database/mmkv';
|
||||||
|
|
||||||
export const useShareStore = create((set, get) => ({
|
export const useShareStore = create((set, get) => ({
|
||||||
colors: Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT,
|
colors: Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT,
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
||||||
import { useTracked } from '../../provider';
|
|
||||||
import { PressableButton } from '../PressableButton';
|
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
|
||||||
import { hexToRGBA, RGB_Linear_Shade } from '../../utils/ColorUtils';
|
|
||||||
import { showTooltip, TOOLTIP_POSITIONS } from '../../utils';
|
|
||||||
|
|
||||||
export const ActionIcon = ({
|
|
||||||
onPress,
|
|
||||||
name,
|
|
||||||
color,
|
|
||||||
customStyle,
|
|
||||||
size = SIZE.xxl,
|
|
||||||
iconStyle = {},
|
|
||||||
left = 10,
|
|
||||||
right = 10,
|
|
||||||
top = 30,
|
|
||||||
bottom = 10,
|
|
||||||
testID,
|
|
||||||
disabled,
|
|
||||||
onLongPress,
|
|
||||||
tooltipText,
|
|
||||||
type = 'gray',
|
|
||||||
fwdRef,
|
|
||||||
tooltipPosition = TOOLTIP_POSITIONS.TOP
|
|
||||||
}) => {
|
|
||||||
const [state, dispatch] = useTracked();
|
|
||||||
const { colors } = state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PressableButton
|
|
||||||
testID={testID}
|
|
||||||
fwdRef={fwdRef}
|
|
||||||
onPress={onPress}
|
|
||||||
hitSlop={{ top: top, left: left, right: right, bottom: bottom }}
|
|
||||||
onLongPress={event => {
|
|
||||||
if (onLongPress) {
|
|
||||||
onLongPress();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tooltipText) {
|
|
||||||
showTooltip(event, tooltipText, tooltipPosition);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
disabled={disabled}
|
|
||||||
type={type}
|
|
||||||
customStyle={{
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
borderRadius: 100,
|
|
||||||
...customStyle
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name={name}
|
|
||||||
style={iconStyle}
|
|
||||||
color={disabled ? RGB_Linear_Shade(-0.05, hexToRGBA(colors.nav)) : color}
|
|
||||||
size={size}
|
|
||||||
/>
|
|
||||||
</PressableButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -7,17 +7,17 @@ import { DDS } from '../../services/DeviceDetection';
|
|||||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseAddNotebookDialog, eOpenAddNotebookDialog } from '../../utils/Events';
|
import { eCloseAddNotebookDialog, eOpenAddNotebookDialog } from '../../utils/events';
|
||||||
import { ph, pv, SIZE } from '../../utils/SizeUtils';
|
import { ph, pv, SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { MoveNotes } from '../MoveNoteDialog/movenote';
|
import { MoveNotes } from '../MoveNoteDialog/movenote';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
|
|
||||||
let refs = [];
|
let refs = [];
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ const TopicItem = ({ item, index, colors, onPress, onDelete }) => {
|
|||||||
justifyContent: 'flex-end'
|
justifyContent: 'flex-end'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
onPress(item, index);
|
onPress(item, index);
|
||||||
}}
|
}}
|
||||||
@@ -485,7 +485,7 @@ const TopicItem = ({ item, index, colors, onPress, onDelete }) => {
|
|||||||
size={SIZE.lg - 5}
|
size={SIZE.lg - 5}
|
||||||
color={colors.icon}
|
color={colors.icon}
|
||||||
/>
|
/>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
onDelete(index);
|
onDelete(index);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ import { useMenuStore } from '../../provider/stores';
|
|||||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../utils/Events';
|
import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../utils/events';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../dialog/dialog-buttons';
|
||||||
import DialogContainer from '../Dialog/dialog-container';
|
import DialogContainer from '../dialog/dialog-container';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
|
|
||||||
export class AddTopicDialog extends React.Component {
|
export class AddTopicDialog extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { FlatList, View } from 'react-native';
|
import { FlatList, View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useMessageStore, useSelectionStore } from '../../provider/stores';
|
import { useMessageStore, useSelectionStore } from '../../provider/stores';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { allowedOnPlatform, renderItem } from './functions';
|
import { allowedOnPlatform, renderItem } from './functions';
|
||||||
|
|
||||||
export const Announcement = ({ color }) => {
|
export const Announcement = ({ color }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { getStyle } from './functions';
|
import { getStyle } from './functions';
|
||||||
|
|
||||||
export const Body = ({ text, style = {} }) => {
|
export const Body = ({ text, style = {} }) => {
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ import React from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { eSendEvent, presentSheet } from '../../services/EventManager';
|
import { eSendEvent, presentSheet } from '../../services/EventManager';
|
||||||
import { eCloseAnnouncementDialog } from '../../utils/Events';
|
import { eCloseAnnouncementDialog } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import SettingsBackupAndRestore from '../../views/Settings/backup-restore';
|
import SettingsBackupAndRestore from '../../views/Settings/backup-restore';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import GeneralSheet from '../GeneralSheet';
|
import SheetProvider from '../sheet-provider';
|
||||||
import { PricingPlans } from '../Premium/pricing-plans';
|
import { PricingPlans } from '../premium/pricing-plans';
|
||||||
import { allowedOnPlatform, getStyle } from './functions';
|
import { allowedOnPlatform, getStyle } from './functions';
|
||||||
|
|
||||||
export const Cta = ({ actions, style = {}, color, inline }) => {
|
export const Cta = ({ actions, style = {}, color, inline }) => {
|
||||||
@@ -53,7 +53,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
|
|||||||
...getStyle(style)
|
...getStyle(style)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GeneralSheet context="premium_cta" />
|
<SheetProvider context="premium_cta" />
|
||||||
{buttons.length > 0 &&
|
{buttons.length > 0 &&
|
||||||
buttons.slice(0, 1).map(item => (
|
buttons.slice(0, 1).map(item => (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { getStyle } from './functions';
|
import { getStyle } from './functions';
|
||||||
|
|
||||||
export const Description = ({ text, style = {} }) => {
|
export const Description = ({ text, style = {} }) => {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { useTracked } from '../../provider';
|
|||||||
import { useMessageStore } from '../../provider/stores';
|
import { useMessageStore } from '../../provider/stores';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { eCloseAnnouncementDialog, eOpenAnnouncementDialog } from '../../utils/Events';
|
import { eCloseAnnouncementDialog, eOpenAnnouncementDialog } from '../../utils/events';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import { allowedOnPlatform, renderItem } from './functions';
|
import { allowedOnPlatform, renderItem } from './functions';
|
||||||
|
|
||||||
export const AnnouncementDialog = () => {
|
export const AnnouncementDialog = () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { getStyle } from './functions';
|
import { getStyle } from './functions';
|
||||||
|
|
||||||
export const List = ({ items, listType, style = {} }) => {
|
export const List = ({ items, listType, style = {} }) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import { getStyle } from './functions';
|
import { getStyle } from './functions';
|
||||||
|
|
||||||
export const SubHeading = ({ text, style = {} }) => {
|
export const SubHeading = ({ text, style = {} }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import { getStyle } from './functions';
|
import { getStyle } from './functions';
|
||||||
|
|
||||||
export const Title = ({ text, style = {} }) => {
|
export const Title = ({ text, style = {} }) => {
|
||||||
|
|||||||
186
apps/mobile/src/components/AttachmentDialog/attachmentitem.js
Normal file
186
apps/mobile/src/components/AttachmentDialog/attachmentitem.js
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { TouchableOpacity, View } from 'react-native';
|
||||||
|
import * as Progress from 'react-native-progress';
|
||||||
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import { useTracked } from '../../provider';
|
||||||
|
import { useAttachmentStore } from '../../provider/stores';
|
||||||
|
import { db } from '../../utils/database';
|
||||||
|
import filesystem from '../../utils/filesystem';
|
||||||
|
import { SIZE } from '../../utils/size';
|
||||||
|
import SheetProvider from '../sheet-provider';
|
||||||
|
import { IconButton } from '../ui/icon-button';
|
||||||
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
|
function formatBytes(bytes, decimals = 2) {
|
||||||
|
if (bytes === 0) return '0 Bytes';
|
||||||
|
|
||||||
|
const k = 1024;
|
||||||
|
const dm = decimals < 0 ? 0 : decimals;
|
||||||
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||||
|
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
|
||||||
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFileExtension(filename) {
|
||||||
|
var ext = /^.+\.([^.]+)$/.exec(filename);
|
||||||
|
return ext == null ? '' : ext[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AttachmentItem = ({ attachment, encryption }) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const colors = state.colors;
|
||||||
|
const progress = useAttachmentStore(state => state.progress);
|
||||||
|
const [currentProgress, setCurrentProgress] = useState(
|
||||||
|
encryption
|
||||||
|
? {
|
||||||
|
type: 'encrypt'
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
const encryptionProgress = encryption
|
||||||
|
? useAttachmentStore(state => state.encryptionProgress)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const onPress = async () => {
|
||||||
|
if (currentProgress) {
|
||||||
|
db.fs.cancel(attachment.metadata.hash, 'download');
|
||||||
|
useAttachmentStore.getState().remove(attachment.metadata.hash);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
filesystem.downloadAttachment(attachment.metadata.hash, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let prog = progress[attachment.metadata.hash];
|
||||||
|
if (prog) {
|
||||||
|
let type = prog.type;
|
||||||
|
let loaded = prog.type === 'download' ? prog.recieved : prog.sent;
|
||||||
|
prog = loaded / prog.total;
|
||||||
|
prog = (prog * 100).toFixed(0);
|
||||||
|
console.log('progress: ', prog);
|
||||||
|
console.log(prog);
|
||||||
|
setCurrentProgress({
|
||||||
|
value: prog,
|
||||||
|
percent: prog + '%',
|
||||||
|
type: type
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setCurrentProgress(null);
|
||||||
|
}
|
||||||
|
}, [progress]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginVertical: 5,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
padding: 12,
|
||||||
|
paddingVertical: 6,
|
||||||
|
borderRadius: 5,
|
||||||
|
backgroundColor: colors.nav
|
||||||
|
}}
|
||||||
|
type="grayBg"
|
||||||
|
>
|
||||||
|
<SheetProvider context={attachment.metadata.hash} />
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexShrink: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginLeft: -5
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon name="file" size={SIZE.xxxl} color={colors.icon} />
|
||||||
|
|
||||||
|
<Paragraph
|
||||||
|
adjustsFontSizeToFit
|
||||||
|
size={6}
|
||||||
|
color={colors.light}
|
||||||
|
style={{
|
||||||
|
position: 'absolute'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{getFileExtension(attachment.metadata.filename).toUpperCase()}
|
||||||
|
</Paragraph>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexShrink: 1,
|
||||||
|
marginLeft: 10
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Paragraph
|
||||||
|
size={SIZE.sm - 1}
|
||||||
|
style={{
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
marginBottom: 2.5
|
||||||
|
}}
|
||||||
|
numberOfLines={1}
|
||||||
|
lineBreakMode="middle"
|
||||||
|
color={colors.pri}
|
||||||
|
>
|
||||||
|
{attachment.metadata.filename}
|
||||||
|
</Paragraph>
|
||||||
|
|
||||||
|
<Paragraph color={colors.icon} size={SIZE.xs}>
|
||||||
|
{formatBytes(attachment.length)}{' '}
|
||||||
|
{currentProgress?.type ? '(' + currentProgress.type + 'ing - tap to cancel)' : ''}
|
||||||
|
</Paragraph>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{currentProgress || encryptionProgress || encryption ? (
|
||||||
|
<TouchableOpacity
|
||||||
|
activeOpacity={0.9}
|
||||||
|
onPress={() => {
|
||||||
|
if (encryption) return;
|
||||||
|
db.fs.cancel(attachment.metadata.hash);
|
||||||
|
setCurrentProgress(null);
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
justifyContent: 'center',
|
||||||
|
marginLeft: 5,
|
||||||
|
marginTop: 5,
|
||||||
|
marginRight: -5
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Progress.Circle
|
||||||
|
size={SIZE.xxl}
|
||||||
|
progress={
|
||||||
|
encryptionProgress
|
||||||
|
? encryptionProgress
|
||||||
|
: currentProgress?.value
|
||||||
|
? currentProgress?.value / 100
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
showsText
|
||||||
|
textStyle={{
|
||||||
|
fontSize: 10
|
||||||
|
}}
|
||||||
|
color={colors.accent}
|
||||||
|
formatText={progress => (progress * 100).toFixed(0)}
|
||||||
|
borderWidth={0}
|
||||||
|
thickness={2}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
onPress={() => !encryption && onPress(attachment)}
|
||||||
|
name="download"
|
||||||
|
size={SIZE.lg}
|
||||||
|
color={colors.pri}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,20 +1,16 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { TouchableOpacity, View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { FlatList } from 'react-native-gesture-handler';
|
import { FlatList } from 'react-native-gesture-handler';
|
||||||
import * as Progress from 'react-native-progress';
|
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useAttachmentStore } from '../../provider/stores';
|
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseAttachmentDialog, eOpenAttachmentsDialog } from '../../utils/Events';
|
import { eCloseAttachmentDialog, eOpenAttachmentsDialog } from '../../utils/events';
|
||||||
import filesystem from '../../utils/filesystem';
|
import { SIZE } from '../../utils/size';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import SheetWrapper from '../Sheet';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import { AttachmentItem } from './attachment-item';
|
||||||
import GeneralSheet from '../GeneralSheet';
|
|
||||||
import Paragraph from '../Typography/Paragraph';
|
|
||||||
export const AttachmentDialog = () => {
|
export const AttachmentDialog = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const colors = state.colors;
|
const colors = state.colors;
|
||||||
@@ -89,7 +85,7 @@ export const AttachmentDialog = () => {
|
|||||||
}
|
}
|
||||||
data={attachments}
|
data={attachments}
|
||||||
renderItem={({ item, index }) => (
|
renderItem={({ item, index }) => (
|
||||||
<Attachment attachment={item} note={note} setNote={setNote} />
|
<AttachmentItem attachment={item} note={note} setNote={setNote} />
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -108,177 +104,3 @@ export const AttachmentDialog = () => {
|
|||||||
</SheetWrapper>
|
</SheetWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatBytes(bytes, decimals = 2) {
|
|
||||||
if (bytes === 0) return '0 Bytes';
|
|
||||||
|
|
||||||
const k = 1024;
|
|
||||||
const dm = decimals < 0 ? 0 : decimals;
|
|
||||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
||||||
|
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
||||||
|
|
||||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileExtension(filename) {
|
|
||||||
var ext = /^.+\.([^.]+)$/.exec(filename);
|
|
||||||
return ext == null ? '' : ext[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Attachment = ({ attachment, encryption }) => {
|
|
||||||
const [state] = useTracked();
|
|
||||||
const colors = state.colors;
|
|
||||||
const progress = useAttachmentStore(state => state.progress);
|
|
||||||
const [currentProgress, setCurrentProgress] = useState(
|
|
||||||
encryption
|
|
||||||
? {
|
|
||||||
type: 'encrypt'
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
const encryptionProgress = encryption
|
|
||||||
? useAttachmentStore(state => state.encryptionProgress)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
const onPress = async () => {
|
|
||||||
if (currentProgress) {
|
|
||||||
db.fs.cancel(attachment.metadata.hash, 'download');
|
|
||||||
useAttachmentStore.getState().remove(attachment.metadata.hash);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
filesystem.downloadAttachment(attachment.metadata.hash, false);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let prog = progress[attachment.metadata.hash];
|
|
||||||
if (prog) {
|
|
||||||
let type = prog.type;
|
|
||||||
let loaded = prog.type === 'download' ? prog.recieved : prog.sent;
|
|
||||||
prog = loaded / prog.total;
|
|
||||||
prog = (prog * 100).toFixed(0);
|
|
||||||
console.log('progress: ', prog);
|
|
||||||
console.log(prog);
|
|
||||||
setCurrentProgress({
|
|
||||||
value: prog,
|
|
||||||
percent: prog + '%',
|
|
||||||
type: type
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setCurrentProgress(null);
|
|
||||||
}
|
|
||||||
}, [progress]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginVertical: 5,
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
padding: 12,
|
|
||||||
paddingVertical: 6,
|
|
||||||
borderRadius: 5,
|
|
||||||
backgroundColor: colors.nav
|
|
||||||
}}
|
|
||||||
type="grayBg"
|
|
||||||
>
|
|
||||||
<GeneralSheet context={attachment.metadata.hash} />
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flexShrink: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
marginLeft: -5
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon name="file" size={SIZE.xxxl} color={colors.icon} />
|
|
||||||
|
|
||||||
<Paragraph
|
|
||||||
adjustsFontSizeToFit
|
|
||||||
size={6}
|
|
||||||
color={colors.light}
|
|
||||||
style={{
|
|
||||||
position: 'absolute'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{getFileExtension(attachment.metadata.filename).toUpperCase()}
|
|
||||||
</Paragraph>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flexShrink: 1,
|
|
||||||
marginLeft: 10
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Paragraph
|
|
||||||
size={SIZE.sm - 1}
|
|
||||||
style={{
|
|
||||||
flexWrap: 'wrap',
|
|
||||||
marginBottom: 2.5
|
|
||||||
}}
|
|
||||||
numberOfLines={1}
|
|
||||||
lineBreakMode="middle"
|
|
||||||
color={colors.pri}
|
|
||||||
>
|
|
||||||
{attachment.metadata.filename}
|
|
||||||
</Paragraph>
|
|
||||||
|
|
||||||
<Paragraph color={colors.icon} size={SIZE.xs}>
|
|
||||||
{formatBytes(attachment.length)}{' '}
|
|
||||||
{currentProgress?.type ? '(' + currentProgress.type + 'ing - tap to cancel)' : ''}
|
|
||||||
</Paragraph>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{currentProgress || encryptionProgress || encryption ? (
|
|
||||||
<TouchableOpacity
|
|
||||||
activeOpacity={0.9}
|
|
||||||
onPress={() => {
|
|
||||||
if (encryption) return;
|
|
||||||
db.fs.cancel(attachment.metadata.hash);
|
|
||||||
setCurrentProgress(null);
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
justifyContent: 'center',
|
|
||||||
marginLeft: 5,
|
|
||||||
marginTop: 5,
|
|
||||||
marginRight: -5
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Progress.Circle
|
|
||||||
size={SIZE.xxl}
|
|
||||||
progress={
|
|
||||||
encryptionProgress
|
|
||||||
? encryptionProgress
|
|
||||||
: currentProgress?.value
|
|
||||||
? currentProgress?.value / 100
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
showsText
|
|
||||||
textStyle={{
|
|
||||||
fontSize: 10
|
|
||||||
}}
|
|
||||||
color={colors.accent}
|
|
||||||
formatText={progress => (progress * 100).toFixed(0)}
|
|
||||||
borderWidth={0}
|
|
||||||
thickness={2}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
|
||||||
) : (
|
|
||||||
<ActionIcon
|
|
||||||
onPress={() => !encryption && onPress(attachment)}
|
|
||||||
name="download"
|
|
||||||
size={SIZE.lg}
|
|
||||||
color={colors.pri}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
import React, { Component } from 'react';
|
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
|
||||||
import { getCurrentColors } from '../../utils/Colors';
|
|
||||||
import { eThemeUpdated } from '../../utils/Events';
|
|
||||||
import { EditorSettings } from '../../views/Editor/EditorSettings';
|
|
||||||
import { AddNotebookDialog } from '../AddNotebookDialog';
|
|
||||||
import { AddTopicDialog } from '../AddTopicDialog';
|
|
||||||
import { AnnouncementDialog } from '../Announcements';
|
|
||||||
import { AttachmentDialog } from '../AttachmentDialog';
|
|
||||||
import { Dialog } from '../Dialog';
|
|
||||||
import ExportDialog from '../ExportDialog';
|
|
||||||
import GeneralSheet from '../GeneralSheet';
|
|
||||||
import ImagePreview from '../ImagePreview';
|
|
||||||
import Auth from '../Auth';
|
|
||||||
import { SessionExpired } from '../Auth/session-expired';
|
|
||||||
import MergeEditor from '../MergeEditor';
|
|
||||||
import MoveNoteDialog from '../MoveNoteDialog';
|
|
||||||
import PremiumDialog from '../Premium';
|
|
||||||
import { Expiring } from '../Premium/expiring';
|
|
||||||
import PublishNoteDialog from '../PublishNoteDialog';
|
|
||||||
import RateDialog from '../RateDialog';
|
|
||||||
import RecoveryKeyDialog from '../RecoveryKeyDialog';
|
|
||||||
import RestoreDialog from '../RestoreDialog';
|
|
||||||
import ResultDialog from '../ResultDialog';
|
|
||||||
import TagsDialog from '../TagsDialog';
|
|
||||||
import { VaultDialog } from '../VaultDialog';
|
|
||||||
|
|
||||||
export class DialogManager extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
colors: getCurrentColors()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
|
||||||
return JSON.stringify(nextProps) !== JSON.stringify(this.props) || nextState !== this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
onThemeChange = () => {
|
|
||||||
this.setState({
|
|
||||||
colors: getCurrentColors()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
eSubscribeEvent(eThemeUpdated, this.onThemeChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
eUnSubscribeEvent(eThemeUpdated, this.onThemeChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let { colors } = this.state;
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Dialog context="global" />
|
|
||||||
<AddTopicDialog colors={colors} />
|
|
||||||
<AddNotebookDialog colors={colors} />
|
|
||||||
<PremiumDialog colors={colors} />
|
|
||||||
<Auth colors={colors} />
|
|
||||||
<MergeEditor />
|
|
||||||
<ExportDialog />
|
|
||||||
<RecoveryKeyDialog colors={colors} />
|
|
||||||
<GeneralSheet />
|
|
||||||
<RestoreDialog />
|
|
||||||
<ResultDialog />
|
|
||||||
<VaultDialog colors={colors} />
|
|
||||||
<MoveNoteDialog colors={colors} />
|
|
||||||
<RateDialog />
|
|
||||||
<ImagePreview />
|
|
||||||
<EditorSettings />
|
|
||||||
<PublishNoteDialog />
|
|
||||||
<TagsDialog />
|
|
||||||
<AttachmentDialog />
|
|
||||||
<Expiring />
|
|
||||||
<AnnouncementDialog />
|
|
||||||
<SessionExpired />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,18 +8,18 @@ import { useTracked } from '../../provider';
|
|||||||
import { ToastEvent } from '../../services/EventManager';
|
import { ToastEvent } from '../../services/EventManager';
|
||||||
import Exporter from '../../services/Exporter';
|
import Exporter from '../../services/Exporter';
|
||||||
import { getElevation } from '../../utils';
|
import { getElevation } from '../../utils';
|
||||||
import { ph, pv, SIZE } from '../../utils/SizeUtils';
|
import { ph, pv, SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');
|
const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');
|
||||||
const { eOpenExportDialog, eCloseExportDialog } = require('../../utils/Events');
|
const { eOpenExportDialog, eCloseExportDialog } = require('../../utils/events');
|
||||||
|
|
||||||
const ExportDialog = () => {
|
const ExportDialog = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { View } from 'react-native';
|
|||||||
import FileViewer from 'react-native-file-viewer';
|
import FileViewer from 'react-native-file-viewer';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
import { ToastEvent } from '../../services/EventManager';
|
import { ToastEvent } from '../../services/EventManager';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
|
|
||||||
export const ShareComponent = ({ uri, name, padding }) => {
|
export const ShareComponent = ({ uri, name, padding }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ import { eSendEvent, ToastEvent } from '../../services/EventManager';
|
|||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import { APP_VERSION } from '../../../version';
|
import { APP_VERSION } from '../../../version';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseProgressDialog } from '../../utils/Events';
|
import { eCloseProgressDialog } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import deviceInfoModule from 'react-native-device-info';
|
import deviceInfoModule from 'react-native-device-info';
|
||||||
|
|
||||||
export const Issue = () => {
|
export const Issue = () => {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { ScrollView, View } from 'react-native';
|
import { ScrollView, View } from 'react-native';
|
||||||
import BaseDialog from '../../components/Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import { PressableButton } from '../../components/PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Seperator from '../../components/Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useMessageStore } from '../../provider/stores';
|
import { useMessageStore } from '../../provider/stores';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { getElevation } from '../../utils';
|
import { getElevation } from '../../utils';
|
||||||
import { eCloseJumpToDialog, eOpenJumpToDialog, eScrollEvent } from '../../utils/Events';
|
import { eCloseJumpToDialog, eOpenJumpToDialog, eScrollEvent } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
const offsets = [];
|
const offsets = [];
|
||||||
let timeout = null;
|
let timeout = null;
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
import { View } from 'react-native';
|
|
||||||
import { SvgXml } from 'react-native-svg';
|
|
||||||
import {
|
|
||||||
FAV_SVG,
|
|
||||||
LOGIN_SVG,
|
|
||||||
LOGO_SVG,
|
|
||||||
NOTEBOOK_SVG,
|
|
||||||
NOTE_SVG,
|
|
||||||
SEARCH_SVG,
|
|
||||||
SETTINGS_SVG,
|
|
||||||
TAG_SVG,
|
|
||||||
TOPIC_SVG,
|
|
||||||
TRASH_SVG
|
|
||||||
} from '../../assets/images/assets';
|
|
||||||
import { useTracked } from '../../provider';
|
|
||||||
export const Placeholder = ({ type, w, h, color }) => {
|
|
||||||
const [state, dispatch] = useTracked();
|
|
||||||
const { colors } = state;
|
|
||||||
const getSVG = () => {
|
|
||||||
switch (type) {
|
|
||||||
case 'notes':
|
|
||||||
return NOTE_SVG(color || colors.accent);
|
|
||||||
case 'notebooks':
|
|
||||||
return NOTEBOOK_SVG(colors.accent);
|
|
||||||
case 'topics':
|
|
||||||
return TOPIC_SVG(colors.accent);
|
|
||||||
case 'tags':
|
|
||||||
return TAG_SVG(colors.accent);
|
|
||||||
case 'favorites':
|
|
||||||
return FAV_SVG(colors.accent);
|
|
||||||
case 'trash':
|
|
||||||
return TRASH_SVG(colors.accent);
|
|
||||||
case 'settings':
|
|
||||||
return SETTINGS_SVG(colors.accent);
|
|
||||||
case 'search':
|
|
||||||
return SEARCH_SVG(colors.accent);
|
|
||||||
case 'login':
|
|
||||||
return LOGIN_SVG(colors.accent);
|
|
||||||
case 'signup':
|
|
||||||
return LOGO_SVG;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SvgToPngView
|
|
||||||
color={type === 'notes' ? color || colors.accent : colors.accent}
|
|
||||||
src={getSVG()}
|
|
||||||
img={type}
|
|
||||||
width={w}
|
|
||||||
height={h}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const SvgToPngView = ({ width = 250, height = 250, src }) => {
|
|
||||||
const [error, setError] = useState(false);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
height: width || 250,
|
|
||||||
width: height || 250
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SvgXml xml={src} width="100%" height="100%" />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
|
||||||
import { useTracked } from '../../provider';
|
|
||||||
import { ph, pv, SIZE } from '../../utils/SizeUtils';
|
|
||||||
import { Button } from '../Button';
|
|
||||||
import Paragraph from '../Typography/Paragraph';
|
|
||||||
|
|
||||||
export const Loading = ({
|
|
||||||
height = 150,
|
|
||||||
tagline = 'Loading....',
|
|
||||||
done = false,
|
|
||||||
doneText = 'Action completed successfully!',
|
|
||||||
onDone = () => {},
|
|
||||||
customStyle = {}
|
|
||||||
}) => {
|
|
||||||
const [state, dispatch] = useTracked();
|
|
||||||
const { colors } = state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={[
|
|
||||||
{ height: height, backgroundColor: colors.bg },
|
|
||||||
styles.activityContainer,
|
|
||||||
customStyle
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{done ? (
|
|
||||||
<>
|
|
||||||
<Paragraph color={colors.icon} size={SIZE.xs} style={styles.activityText}>
|
|
||||||
{doneText}
|
|
||||||
</Paragraph>
|
|
||||||
|
|
||||||
<Button onPress={onDone} title="Open file" />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<ActivityIndicator color={colors.accent} />
|
|
||||||
<Paragraph
|
|
||||||
size={SIZE.md}
|
|
||||||
style={{
|
|
||||||
marginTop: 10
|
|
||||||
}}
|
|
||||||
color={colors.pri}
|
|
||||||
>
|
|
||||||
{tagline}
|
|
||||||
</Paragraph>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
activityText: {
|
|
||||||
fontSize: SIZE.sm,
|
|
||||||
textAlign: 'center',
|
|
||||||
marginBottom: 10
|
|
||||||
},
|
|
||||||
activityContainer: {
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center'
|
|
||||||
},
|
|
||||||
button: {
|
|
||||||
paddingVertical: pv,
|
|
||||||
paddingHorizontal: ph,
|
|
||||||
marginTop: 10,
|
|
||||||
borderRadius: 5,
|
|
||||||
alignSelf: 'center',
|
|
||||||
width: '48%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
borderWidth: 1,
|
|
||||||
flexDirection: 'row'
|
|
||||||
},
|
|
||||||
buttonText: {
|
|
||||||
//fontFamily: "sans-serif",
|
|
||||||
color: 'white',
|
|
||||||
fontSize: SIZE.sm
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -4,14 +4,14 @@ import { useTracked } from '../../provider';
|
|||||||
import { useMenuStore, useNoteStore } from '../../provider/stores';
|
import { useMenuStore, useNoteStore } from '../../provider/stores';
|
||||||
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { COLORS_NOTE } from '../../utils/Colors';
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { refreshNotesPage } from '../../utils/Events';
|
import { refreshNotesPage } from '../../utils/events';
|
||||||
import { normalize, SIZE } from '../../utils/SizeUtils';
|
import { normalize, SIZE } from '../../utils/size';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const ColorSection = () => {
|
export const ColorSection = () => {
|
||||||
const colorNotes = useMenuStore(state => state.colorNotes);
|
const colorNotes = useMenuStore(state => state.colorNotes);
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import { timeSince } from '../../utils/TimeUtils';
|
|
||||||
import Paragraph from '../Typography/Paragraph';
|
|
||||||
|
|
||||||
export const TimeSince = ({ time, style, updateFrequency = 30000 }) => {
|
|
||||||
const [timeAgo, setTimeAgo] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let t = timeSince(time || Date.now());
|
|
||||||
setTimeAgo(t);
|
|
||||||
let interval = setInterval(() => {
|
|
||||||
t = timeSince(time);
|
|
||||||
setTimeAgo(t);
|
|
||||||
}, updateFrequency);
|
|
||||||
return () => {
|
|
||||||
clearInterval(interval);
|
|
||||||
interval = null;
|
|
||||||
};
|
|
||||||
}, [time, updateFrequency]);
|
|
||||||
|
|
||||||
return <Paragraph style={style}>{timeAgo}</Paragraph>;
|
|
||||||
};
|
|
||||||
@@ -17,19 +17,19 @@ import Navigation from '../../services/Navigation';
|
|||||||
import Sync from '../../services/Sync';
|
import Sync from '../../services/Sync';
|
||||||
import { dHeight } from '../../utils';
|
import { dHeight } from '../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eApplyChanges, eShowMergeDialog, refreshNotesPage } from '../../utils/Events';
|
import { eApplyChanges, eShowMergeDialog, refreshNotesPage } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { normalize, SIZE } from '../../utils/SizeUtils';
|
import { normalize, SIZE } from '../../utils/size';
|
||||||
import { timeConverter } from '../../utils/TimeUtils';
|
import { timeConverter } from '../../utils/time';
|
||||||
import { getNote, sourceUri, updateNoteInEditor } from '../../views/Editor/Functions';
|
import { getNote, sourceUri, updateNoteInEditor } from '../../views/Editor/Functions';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../dialog/dialog-buttons';
|
||||||
import DialogContainer from '../Dialog/dialog-container';
|
import DialogContainer from '../dialog/dialog-container';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
const primaryWebView = createRef();
|
const primaryWebView = createRef();
|
||||||
const secondaryWebView = createRef();
|
const secondaryWebView = createRef();
|
||||||
@@ -324,7 +324,7 @@ const MergeEditor = () => {
|
|||||||
flexShrink: 1
|
flexShrink: 1
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon onPress={close} color={colors.pri} name="arrow-left" />
|
<IconButton onPress={close} color={colors.pri} name="arrow-left" />
|
||||||
<Paragraph style={{ flexWrap: 'wrap' }} color={colors.icon} size={SIZE.xs}>
|
<Paragraph style={{ flexWrap: 'wrap' }} color={colors.icon} size={SIZE.xs}>
|
||||||
<Text style={{ color: colors.accent, fontWeight: 'bold' }}>(This Device)</Text>
|
<Text style={{ color: colors.accent, fontWeight: 'bold' }}>(This Device)</Text>
|
||||||
{'\n'}
|
{'\n'}
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/E
|
|||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { getTotalNotes } from '../../utils';
|
import { getTotalNotes } from '../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eOpenMoveNoteDialog } from '../../utils/Events';
|
import { eOpenMoveNoteDialog } from '../../utils/events';
|
||||||
import layoutmanager from '../../utils/layout-manager';
|
import layoutmanager from '../../utils/layout-manager';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { Dialog } from '../Dialog';
|
import { Dialog } from '../dialog';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
let newNotebookTitle = null;
|
let newNotebookTitle = null;
|
||||||
const notebookInput = createRef();
|
const notebookInput = createRef();
|
||||||
@@ -332,7 +332,7 @@ const MoveNoteComponent = ({ close, note, setNote }) => {
|
|||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name={expanded === item.id ? 'plus' : 'chevron-down'}
|
name={expanded === item.id ? 'plus' : 'chevron-down'}
|
||||||
color={expanded === item.id ? colors.accent : colors.pri}
|
color={expanded === item.id ? colors.accent : colors.pri}
|
||||||
size={SIZE.xl}
|
size={SIZE.xl}
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import { useTracked } from '../../provider';
|
|||||||
import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
|
import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseProgressDialog } from '../../utils/Events';
|
import { eCloseProgressDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { Dialog } from '../Dialog';
|
import { Dialog } from '../dialog';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const MoveNotes = ({
|
export const MoveNotes = ({
|
||||||
notebook,
|
notebook,
|
||||||
@@ -31,7 +31,7 @@ export const MoveNotes = ({
|
|||||||
const colors = state.colors;
|
const colors = state.colors;
|
||||||
const [currentNotebook, setCurrentNotebook] = useState(notebook);
|
const [currentNotebook, setCurrentNotebook] = useState(notebook);
|
||||||
|
|
||||||
let notes = db.notes.all;
|
let notes = db.notes?.all;
|
||||||
|
|
||||||
const [selectedNoteIds, setSelectedNoteIds] = useState<String[]>([]);
|
const [selectedNoteIds, setSelectedNoteIds] = useState<String[]>([]);
|
||||||
const [topic, setTopic] = useState(selectedTopic);
|
const [topic, setTopic] = useState(selectedTopic);
|
||||||
@@ -80,8 +80,8 @@ export const MoveNotes = ({
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
await db.notebooks.notebook(currentNotebook.id).topics.add(value);
|
await db.notebooks?.notebook(currentNotebook.id).topics.add(value);
|
||||||
setCurrentNotebook(db.notebooks.notebook(currentNotebook.id).data);
|
setCurrentNotebook(db.notebooks?.notebook(currentNotebook.id).data);
|
||||||
Navigation.setRoutesToUpdate([
|
Navigation.setRoutesToUpdate([
|
||||||
Navigation.routeNames.NotesPage,
|
Navigation.routeNames.NotesPage,
|
||||||
Navigation.routeNames.Favorites,
|
Navigation.routeNames.Favorites,
|
||||||
@@ -139,7 +139,7 @@ export const MoveNotes = ({
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{selectedNoteIds.indexOf(item.id) > -1 ? (
|
{selectedNoteIds.indexOf(item.id) > -1 ? (
|
||||||
<ActionIcon
|
<IconButton
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: null,
|
width: null,
|
||||||
height: null,
|
height: null,
|
||||||
@@ -262,7 +262,7 @@ export const MoveNotes = ({
|
|||||||
<Button
|
<Button
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
await db.notes.move(
|
await db.notes?.move(
|
||||||
{
|
{
|
||||||
topic: topic.id,
|
topic: topic.id,
|
||||||
id: topic.notebookId
|
id: topic.notebookId
|
||||||
@@ -289,6 +289,8 @@ export const MoveNotes = ({
|
|||||||
|
|
||||||
MoveNotes.present = (notebook: any, topic: any) => {
|
MoveNotes.present = (notebook: any, topic: any) => {
|
||||||
presentSheet({
|
presentSheet({
|
||||||
component: ref => <MoveNotes fwdRef={ref} notebook={notebook} selectedTopic={topic} />
|
component: (ref: RefObject<ActionSheet>) => (
|
||||||
|
<MoveNotes fwdRef={ref} notebook={notebook} selectedTopic={topic} />
|
||||||
|
)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import { useTracked } from '../../provider';
|
|||||||
import { presentSheet } from '../../services/EventManager';
|
import { presentSheet } from '../../services/EventManager';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { timeConverter, timeSince } from '../../utils/TimeUtils';
|
import { timeConverter, timeSince } from '../../utils/time';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import GeneralSheet from '../GeneralSheet';
|
import SheetProvider from '../sheet-provider';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import NotePreview from './preview';
|
import NotePreview from './preview';
|
||||||
|
|
||||||
export default function NoteHistory({ note, ref }) {
|
export default function NoteHistory({ note, ref }) {
|
||||||
@@ -82,7 +82,7 @@ export default function NoteHistory({ note, ref }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<GeneralSheet context="note_history" />
|
<SheetProvider context="note_history" />
|
||||||
<DialogHeader
|
<DialogHeader
|
||||||
title="Note history"
|
title="Note history"
|
||||||
paragraph="Revert back to an older version of this note"
|
paragraph="Revert back to an older version of this note"
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { useEditorStore } from '../../provider/stores';
|
|||||||
import { eSendEvent, ToastEvent } from '../../services/EventManager';
|
import { eSendEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseProgressDialog, eOnLoadNote } from '../../utils/Events';
|
import { eCloseProgressDialog, eOnLoadNote } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { normalize } from '../../utils/SizeUtils';
|
import { normalize } from '../../utils/size';
|
||||||
import { getNote, sourceUri } from '../../views/Editor/Functions';
|
import { getNote, sourceUri } from '../../views/Editor/Functions';
|
||||||
import tiny from '../../views/Editor/tiny/tiny';
|
import tiny from '../../views/Editor/tiny/tiny';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export default function NotePreview({ session, content }) {
|
export default function NotePreview({ session, content }) {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ import { useTracked } from '../../provider';
|
|||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../provider/stores';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { COLORS_NOTE } from '../../utils/Colors';
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { refreshNotesPage } from '../../utils/Events';
|
import { refreshNotesPage } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { TimeSince } from '../Menu/TimeSince';
|
import { TimeSince } from '../side-menu/TimeSince';
|
||||||
import { Properties } from '../Properties';
|
import { Properties } from '../properties';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
const navigateToTopic = topic => {
|
const navigateToTopic = topic => {
|
||||||
let routeName = 'NotesPage';
|
let routeName = 'NotesPage';
|
||||||
@@ -282,7 +282,7 @@ const NoteItem = ({ item, isTrash, tags, dateBy = 'dateCreated', noOpen = false
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
testID={notesnook.listitem.menu}
|
testID={notesnook.listitem.menu}
|
||||||
color={colors.pri}
|
color={colors.pri}
|
||||||
name="dots-horizontal"
|
name="dots-horizontal"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import {
|
|||||||
COLOR_SCHEME_LIGHT,
|
COLOR_SCHEME_LIGHT,
|
||||||
COLOR_SCHEME_PITCH_BLACK,
|
COLOR_SCHEME_PITCH_BLACK,
|
||||||
setColorScheme
|
setColorScheme
|
||||||
} from '../../utils/Colors';
|
} from '../../utils/color-scheme';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import {
|
import {
|
||||||
eOpenAddNotebookDialog,
|
eOpenAddNotebookDialog,
|
||||||
@@ -41,11 +41,11 @@ import {
|
|||||||
eOpenLoginDialog,
|
eOpenLoginDialog,
|
||||||
eOpenMoveNoteDialog,
|
eOpenMoveNoteDialog,
|
||||||
eOpenPublishNoteDialog
|
eOpenPublishNoteDialog
|
||||||
} from '../../utils/Events';
|
} from '../../utils/events';
|
||||||
import { deleteItems } from '../../utils/functions';
|
import { deleteItems } from '../../utils/functions';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import { MoveNotes } from '../MoveNoteDialog/movenote';
|
import { MoveNotes } from '../MoveNoteDialog/movenote';
|
||||||
import NoteHistory from '../NoteHistory';
|
import NoteHistory from '../NoteHistory';
|
||||||
import tiny from '../../views/Editor/tiny/tiny.js';
|
import tiny from '../../views/Editor/tiny/tiny.js';
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import { useTracked } from '../../provider';
|
|||||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eClosePublishNoteDialog, eOpenPublishNoteDialog } from '../../utils/Events';
|
import { eClosePublishNoteDialog, eOpenPublishNoteDialog } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { useAttachmentStore } from '../../provider/stores';
|
import { useAttachmentStore } from '../../provider/stores';
|
||||||
import { editing } from '../../utils';
|
import { editing } from '../../utils';
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ const PublishNoteDialog = () => {
|
|||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Clipboard.setString(publishUrl);
|
Clipboard.setString(publishUrl);
|
||||||
ToastEvent.show({
|
ToastEvent.show({
|
||||||
@@ -232,7 +232,7 @@ const PublishNoteDialog = () => {
|
|||||||
marginBottom: 10
|
marginBottom: 10
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (publishing) return;
|
if (publishing) return;
|
||||||
setIsLocked(!isLocked);
|
setIsLocked(!isLocked);
|
||||||
@@ -265,7 +265,7 @@ const PublishNoteDialog = () => {
|
|||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setSelfDestruct(!selfDestruct);
|
setSelfDestruct(!selfDestruct);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { Linking, Platform, View } from 'react-native';
|
import { Linking, Platform, View } from 'react-native';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { eCloseRateDialog, eOpenRateDialog } from '../../utils/Events';
|
import { eCloseRateDialog, eOpenRateDialog } from '../../utils/events';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { STORE_LINK } from '../../utils';
|
import { STORE_LINK } from '../../utils/constants';
|
||||||
import { clearMessage } from '../../services/Message';
|
import { clearMessage } from '../../services/Message';
|
||||||
|
|
||||||
const RateDialog = () => {
|
const RateDialog = () => {
|
||||||
|
|||||||
@@ -1,31 +1,25 @@
|
|||||||
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
import React, { createRef } from 'react';
|
import React, { createRef } from 'react';
|
||||||
import { Platform, View } from 'react-native';
|
import { Platform, View } from 'react-native';
|
||||||
|
import FileViewer from 'react-native-file-viewer';
|
||||||
import QRCode from 'react-native-qrcode-svg';
|
import QRCode from 'react-native-qrcode-svg';
|
||||||
|
import * as ScopedStorage from 'react-native-scoped-storage';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
import { LOGO_BASE64 } from '../../assets/images/assets';
|
import { LOGO_BASE64 } from '../../assets/images/assets';
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import {
|
|
||||||
eSendEvent,
|
|
||||||
eSubscribeEvent,
|
|
||||||
eUnSubscribeEvent,
|
|
||||||
ToastEvent
|
|
||||||
} from '../../services/EventManager';
|
|
||||||
import { db } from '../../utils/database';
|
|
||||||
import { eOpenRecoveryKeyDialog, eOpenResultDialog } from '../../utils/Events';
|
|
||||||
import { sanitizeFilename } from '../../utils/filename';
|
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
|
||||||
import Storage from '../../utils/storage';
|
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
|
||||||
import SheetWrapper from '../Sheet';
|
|
||||||
import { Button } from '../Button';
|
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
|
||||||
import Seperator from '../Seperator';
|
|
||||||
import Paragraph from '../Typography/Paragraph';
|
|
||||||
import FileViewer from 'react-native-file-viewer';
|
|
||||||
|
|
||||||
import * as ScopedStorage from 'react-native-scoped-storage';
|
|
||||||
import { MMKV } from '../../utils/mmkv';
|
|
||||||
import { clearMessage } from '../../services/Message';
|
import { clearMessage } from '../../services/Message';
|
||||||
|
import { db } from '../../utils/database';
|
||||||
|
import { eOpenRecoveryKeyDialog } from '../../utils/events';
|
||||||
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
|
import { sanitizeFilename } from '../../utils/sanitizer';
|
||||||
|
import { SIZE } from '../../utils/size';
|
||||||
|
import Storage from '../../utils/database/storage';
|
||||||
|
import { sleep } from '../../utils/time';
|
||||||
|
import { Button } from '../ui/button';
|
||||||
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
|
import Seperator from '../ui/seperator';
|
||||||
|
import SheetWrapper from '../ui/sheet';
|
||||||
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
let RNFetchBlob;
|
let RNFetchBlob;
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,21 @@ import { useTracked } from '../../provider';
|
|||||||
import { initialize } from '../../provider/stores';
|
import { initialize } from '../../provider/stores';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseRestoreDialog, eOpenRestoreDialog } from '../../utils/Events';
|
import { eCloseRestoreDialog, eOpenRestoreDialog } from '../../utils/events';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import storage from '../../utils/storage';
|
import storage from '../../utils/database/storage';
|
||||||
import { sleep, timeConverter } from '../../utils/TimeUtils';
|
import { sleep, timeConverter } from '../../utils/time';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import * as ScopedStorage from 'react-native-scoped-storage';
|
import * as ScopedStorage from 'react-native-scoped-storage';
|
||||||
import { Dialog } from '../Dialog';
|
import { Dialog } from '../dialog';
|
||||||
import { verifyUser } from '../../views/Settings/functions';
|
import { verifyUser } from '../../views/Settings/functions';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
|
|
||||||
const actionSheetRef = createRef();
|
const actionSheetRef = createRef();
|
||||||
let RNFetchBlob;
|
let RNFetchBlob;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { View } from 'react-native';
|
|||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../services/EventManager';
|
||||||
import { eCloseProgressDialog, eCloseResultDialog, eOpenPremiumDialog } from '../../utils/Events';
|
import { eCloseProgressDialog, eCloseResultDialog, eOpenPremiumDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
export const ProFeatures = ({ count = 6 }) => {
|
export const ProFeatures = ({ count = 6 }) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const { colors } = state;
|
const { colors } = state;
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { useTracked } from '../../provider';
|
|||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { getElevation } from '../../utils';
|
import { getElevation } from '../../utils';
|
||||||
import { eCloseResultDialog, eOpenResultDialog } from '../../utils/Events';
|
import { eCloseResultDialog, eOpenResultDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { ProFeatures } from './pro-features';
|
import { ProFeatures } from './pro-features';
|
||||||
|
|
||||||
const ResultDialog = () => {
|
const ResultDialog = () => {
|
||||||
|
|||||||
@@ -1,258 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
||||||
|
|
||||||
const Circle = ({ size, color, position }) => {
|
|
||||||
let style = {
|
|
||||||
wrapper: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
...position
|
|
||||||
},
|
|
||||||
circle: {
|
|
||||||
width: size,
|
|
||||||
height: size,
|
|
||||||
borderRadius: size / 2,
|
|
||||||
backgroundColor: color
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<View style={style.wrapper}>
|
|
||||||
<View style={style.circle} />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Donut = ({ size, color, position }) => {
|
|
||||||
let style = {
|
|
||||||
wrapper: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
...position
|
|
||||||
},
|
|
||||||
donut: {
|
|
||||||
width: size,
|
|
||||||
height: size,
|
|
||||||
borderRadius: size / 2,
|
|
||||||
borderWidth: size / 4,
|
|
||||||
borderColor: color
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<View style={style.wrapper}>
|
|
||||||
<View style={style.donut} />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Triangle = ({ size, color, position }) => {
|
|
||||||
let style = {
|
|
||||||
wrapper: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
...position
|
|
||||||
},
|
|
||||||
triangle: {
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderStyle: 'solid',
|
|
||||||
borderLeftWidth: size / 2,
|
|
||||||
borderRightWidth: size / 2,
|
|
||||||
borderBottomWidth: size,
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderBottomColor: color,
|
|
||||||
transform: [{ rotate: '180deg' }]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<View style={style.wrapper}>
|
|
||||||
<View style={style.triangle} />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const DiamondNarrow = ({ size, color, position }) => {
|
|
||||||
let style = {
|
|
||||||
wrapper: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
...position
|
|
||||||
},
|
|
||||||
diamondNarrow: {},
|
|
||||||
diamondNarrowTop: {
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
borderTopWidth: 0,
|
|
||||||
borderTopColor: 'transparent',
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderLeftWidth: size / 2,
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderRightWidth: size / 2,
|
|
||||||
borderBottomColor: color,
|
|
||||||
borderBottomWidth: size / 1.42
|
|
||||||
},
|
|
||||||
diamondNarrowBottom: {
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
borderTopWidth: size / 1.42,
|
|
||||||
borderTopColor: color,
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderLeftWidth: size / 2,
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderRightWidth: size / 2,
|
|
||||||
borderBottomColor: 'transparent',
|
|
||||||
borderBottomWidth: 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<View style={style.wrapper}>
|
|
||||||
<View style={style.diamondNarrow}>
|
|
||||||
<View style={style.diamondNarrowTop} />
|
|
||||||
<View style={style.diamondNarrowBottom} />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CutDiamond = ({ size, color, position }) => {
|
|
||||||
let style = {
|
|
||||||
wrapper: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
...position
|
|
||||||
},
|
|
||||||
cutDiamond: {},
|
|
||||||
cutDiamondTop: {
|
|
||||||
width: size,
|
|
||||||
height: 0,
|
|
||||||
borderTopWidth: 0,
|
|
||||||
borderTopColor: 'transparent',
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderLeftWidth: size / 4,
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderRightWidth: size / 4,
|
|
||||||
borderBottomColor: color,
|
|
||||||
borderBottomWidth: size / 4
|
|
||||||
},
|
|
||||||
cutDiamondBottom: {
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
borderTopWidth: size / 1.42,
|
|
||||||
borderTopColor: color,
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderLeftWidth: size / 2,
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderRightWidth: size / 2,
|
|
||||||
borderBottomColor: 'transparent',
|
|
||||||
borderBottomWidth: 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<View style={style.wrapper}>
|
|
||||||
<View style={style.cutDiamond}>
|
|
||||||
<View style={style.cutDiamondTop} />
|
|
||||||
<View style={style.cutDiamondBottom} />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Shapes = ({ primaryColor, secondaryColor, height, figures, borderRadius, style }) => {
|
|
||||||
const config = {
|
|
||||||
primaryColor: primaryColor || '#416DF8',
|
|
||||||
secondaryColor: secondaryColor || '#2F53D5',
|
|
||||||
height: Dimensions.get('window').height / (height || 3.5),
|
|
||||||
sizefigure: 100,
|
|
||||||
figures: figures || [
|
|
||||||
{ name: 'circle', position: 'center', size: 60 },
|
|
||||||
{ name: 'donut', position: 'flex-start', axis: 'top', size: 80 },
|
|
||||||
{ name: 'circle', position: 'center', axis: 'right', size: 100 }
|
|
||||||
],
|
|
||||||
borderRadius: borderRadius !== undefined ? borderRadius : 30
|
|
||||||
};
|
|
||||||
|
|
||||||
const arrFigures = [];
|
|
||||||
const buildFigures = () => {
|
|
||||||
config.figures.forEach((e, i) => {
|
|
||||||
let position = {
|
|
||||||
alignItems: e.position
|
|
||||||
};
|
|
||||||
|
|
||||||
const sizefigure = e.size || config.sizefigure;
|
|
||||||
|
|
||||||
switch (e.axis) {
|
|
||||||
case 'left':
|
|
||||||
position.left = -sizefigure / 2;
|
|
||||||
break;
|
|
||||||
case 'right':
|
|
||||||
position.right = -sizefigure / 2;
|
|
||||||
break;
|
|
||||||
case 'top':
|
|
||||||
position.top = -sizefigure / 2;
|
|
||||||
break;
|
|
||||||
case 'bottom':
|
|
||||||
position.bottom = -sizefigure / 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.name === 'circle') {
|
|
||||||
arrFigures.push(
|
|
||||||
<Circle key={i} size={sizefigure} color={config.secondaryColor} position={position} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (e.name === 'donut') {
|
|
||||||
arrFigures.push(
|
|
||||||
<Donut key={i} size={sizefigure} color={config.secondaryColor} position={position} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (e.name === 'triangle') {
|
|
||||||
arrFigures.push(
|
|
||||||
<Triangle key={i} size={sizefigure} color={config.secondaryColor} position={position} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (e.name === 'diamondNarrow') {
|
|
||||||
arrFigures.push(
|
|
||||||
<DiamondNarrow
|
|
||||||
key={i}
|
|
||||||
size={sizefigure}
|
|
||||||
color={config.secondaryColor}
|
|
||||||
position={position}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (e.name === 'cutDiamond') {
|
|
||||||
arrFigures.push(
|
|
||||||
<CutDiamond key={i} size={sizefigure} color={config.secondaryColor} position={position} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return arrFigures;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
...styles.wrapper,
|
|
||||||
backgroundColor: config.primaryColor,
|
|
||||||
height: config.height,
|
|
||||||
borderBottomLeftRadius: config.borderRadius,
|
|
||||||
borderBottomRightRadius: config.borderRadius,
|
|
||||||
...style
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<>{buildFigures()}</>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
wrapper: {
|
|
||||||
position: 'absolute',
|
|
||||||
height: '100%',
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export { Shapes };
|
|
||||||
@@ -4,13 +4,13 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../provider/stores';
|
||||||
import { useTip } from '../../services/tip-manager';
|
import { useTip } from '../../services/tip-manager';
|
||||||
import { COLORS_NOTE } from '../../utils/Colors';
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { Tip } from '../Tip';
|
import { Tip } from '../tip';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const Empty = React.memo(
|
export const Empty = React.memo(
|
||||||
({ loading = true, placeholderData, headerProps, type, screen }) => {
|
({ loading = true, placeholderData, headerProps, type, screen }) => {
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { View } from 'react-native';
|
|
||||||
import { useTracked } from '../../provider';
|
|
||||||
import { useMessageStore } from '../../provider/stores';
|
|
||||||
import { COLORS_NOTE } from '../../utils/Colors';
|
|
||||||
import { hexToRGBA } from '../../utils/ColorUtils';
|
|
||||||
import { normalize, SIZE } from '../../utils/SizeUtils';
|
|
||||||
import { Announcement } from '../Announcements/announcement';
|
|
||||||
import { Button } from '../Button';
|
|
||||||
import { Placeholder } from '../ListPlaceholders';
|
|
||||||
import Heading from '../Typography/Heading';
|
|
||||||
import { Card } from './card';
|
|
||||||
|
|
||||||
export const Header = React.memo(
|
|
||||||
({
|
|
||||||
type,
|
|
||||||
messageCard = true,
|
|
||||||
title,
|
|
||||||
paragraph,
|
|
||||||
color,
|
|
||||||
onPress,
|
|
||||||
shouldShow = false,
|
|
||||||
icon,
|
|
||||||
screen,
|
|
||||||
noAnnouncement,
|
|
||||||
height
|
|
||||||
}) => {
|
|
||||||
const [state] = useTracked();
|
|
||||||
const { colors } = state;
|
|
||||||
const announcements = useMessageStore(state => state.announcements);
|
|
||||||
|
|
||||||
return announcements.length !== 0 && !noAnnouncement ? (
|
|
||||||
<Announcement color={color || colors.accent} />
|
|
||||||
) : type === 'search' ? null : !shouldShow ? (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
marginBottom: 5,
|
|
||||||
padding: 0,
|
|
||||||
width: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{messageCard ? <Card color={COLORS_NOTE[color?.toLowerCase()] || colors.accent} /> : null}
|
|
||||||
</View>
|
|
||||||
) : (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
width: '100%'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
minHeight: height || 195,
|
|
||||||
padding: 12,
|
|
||||||
width: '100%',
|
|
||||||
zIndex: 10,
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
backgroundColor: COLORS_NOTE[color?.toLowerCase()]
|
|
||||||
? hexToRGBA(COLORS_NOTE[color?.toLowerCase()], 0.15)
|
|
||||||
: color || colors.shade
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
right: 0,
|
|
||||||
paddingRight: 12,
|
|
||||||
bottom: 0,
|
|
||||||
position: 'absolute'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Placeholder
|
|
||||||
color={COLORS_NOTE[color?.toLowerCase()] || colors.accent}
|
|
||||||
w={normalize(150)}
|
|
||||||
h={normalize(150)}
|
|
||||||
type={screen === 'Favorites' ? 'favorites' : type}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
marginTop: 15
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Heading style={{ marginBottom: paragraph ? 0 : 0 }} size={SIZE.xxxl * 1.2}>
|
|
||||||
<Heading size={SIZE.xxxl * 1.2} color={colors.accent}>
|
|
||||||
{title.slice(0, 1) === '#' ? '#' : null}
|
|
||||||
</Heading>
|
|
||||||
|
|
||||||
{title.slice(0, 1) === '#' ? title.slice(1) : title}
|
|
||||||
</Heading>
|
|
||||||
|
|
||||||
{paragraph ? (
|
|
||||||
<Button
|
|
||||||
height={20}
|
|
||||||
title={paragraph}
|
|
||||||
icon={icon}
|
|
||||||
style={{
|
|
||||||
alignSelf: 'flex-start',
|
|
||||||
paddingLeft: 0
|
|
||||||
}}
|
|
||||||
textStyle={{
|
|
||||||
fontWeight: 'normal'
|
|
||||||
}}
|
|
||||||
iconSize={SIZE.sm}
|
|
||||||
fontSize={SIZE.sm}
|
|
||||||
onPress={onPress}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Header.displayName = 'Header';
|
|
||||||
@@ -9,15 +9,15 @@ import {
|
|||||||
presentSheet
|
presentSheet
|
||||||
} from '../../services/EventManager';
|
} from '../../services/EventManager';
|
||||||
import SettingsService from '../../services/SettingsService';
|
import SettingsService from '../../services/SettingsService';
|
||||||
import { GROUP } from '../../utils';
|
import { GROUP } from '../../utils/constants';
|
||||||
import { COLORS_NOTE } from '../../utils/Colors';
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eOpenJumpToDialog } from '../../utils/Events';
|
import { eOpenJumpToDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Sort from '../Sort';
|
import Sort from '../sort';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
|
|
||||||
export const SectionHeader = ({ item, index, type, color, screen }) => {
|
export const SectionHeader = ({ item, index, type, color, screen }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -117,7 +117,7 @@ export const SectionHeader = ({ item, index, type, color, screen }) => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{type === 'notes' || type === 'notebooks' || type === 'home' ? (
|
{type === 'notes' || type === 'notebooks' || type === 'home' ? (
|
||||||
<ActionIcon
|
<IconButton
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: 25,
|
width: 25,
|
||||||
height: 25
|
height: 25
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import { useTagStore } from '../../provider/stores';
|
|||||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseTagsDialog, eOpenTagsDialog } from '../../utils/Events';
|
import { eCloseTagsDialog, eOpenTagsDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import SheetWrapper from '../Sheet';
|
import SheetWrapper from '../ui/sheet';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
const TagsDialog = () => {
|
const TagsDialog = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const colors = state.colors;
|
const colors = state.colors;
|
||||||
|
|||||||
@@ -20,19 +20,19 @@ import {
|
|||||||
eCloseVaultDialog,
|
eCloseVaultDialog,
|
||||||
eOnLoadNote,
|
eOnLoadNote,
|
||||||
eOpenVaultDialog
|
eOpenVaultDialog
|
||||||
} from '../../utils/Events';
|
} from '../../utils/events';
|
||||||
import { deleteItems } from '../../utils/functions';
|
import { deleteItems } from '../../utils/functions';
|
||||||
import { tabBarRef } from '../../utils/Refs';
|
import { tabBarRef } from '../../utils/global-refs';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { getNote } from '../../views/Editor/Functions';
|
import { getNote } from '../../views/Editor/Functions';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../dialog/dialog-buttons';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
let Keychain;
|
let Keychain;
|
||||||
const passInputRef = createRef();
|
const passInputRef = createRef();
|
||||||
@@ -703,7 +703,7 @@ export class VaultDialog extends Component {
|
|||||||
onSubmit={() => {
|
onSubmit={() => {
|
||||||
changePassword ? changePassInputRef.current?.focus() : this.onPress;
|
changePassword ? changePassInputRef.current?.focus() : this.onPress;
|
||||||
}}
|
}}
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
returnKeyLabel={changePassword ? 'Next' : this.state.title}
|
returnKeyLabel={changePassword ? 'Next' : this.state.title}
|
||||||
returnKeyType={changePassword ? 'next' : 'done'}
|
returnKeyType={changePassword ? 'next' : 'done'}
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
@@ -755,7 +755,7 @@ export class VaultDialog extends Component {
|
|||||||
onChangeText={value => {
|
onChangeText={value => {
|
||||||
this.newPassword = value;
|
this.newPassword = value;
|
||||||
}}
|
}}
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
onSubmit={this.onPress}
|
onSubmit={this.onPress}
|
||||||
returnKeyLabel="Change"
|
returnKeyLabel="Change"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
@@ -774,7 +774,7 @@ export class VaultDialog extends Component {
|
|||||||
onChangeText={value => {
|
onChangeText={value => {
|
||||||
this.password = value;
|
this.password = value;
|
||||||
}}
|
}}
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
@@ -794,7 +794,7 @@ export class VaultDialog extends Component {
|
|||||||
errorMessage="Passwords do not match."
|
errorMessage="Passwords do not match."
|
||||||
onErrorCheck={e => null}
|
onErrorCheck={e => null}
|
||||||
marginBottom={0}
|
marginBottom={0}
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
returnKeyLabel="Create"
|
returnKeyLabel="Create"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
onChangeText={value => {
|
onChangeText={value => {
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { useTracked } from '../../provider';
|
|||||||
import { useUserStore } from '../../provider/stores';
|
import { useUserStore } from '../../provider/stores';
|
||||||
import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
|
import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseProgressDialog } from '../../utils/Events';
|
import { eCloseProgressDialog } from '../../utils/events';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { Notice } from '../Notice';
|
import { Notice } from '../ui/notice';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
|
|
||||||
export const ChangePassword = () => {
|
export const ChangePassword = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -83,7 +83,7 @@ export const ChangePassword = () => {
|
|||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
placeholder="Old Password"
|
placeholder="Old Password"
|
||||||
@@ -99,7 +99,7 @@ export const ChangePassword = () => {
|
|||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
validationType="password"
|
validationType="password"
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
placeholder="New password"
|
placeholder="New password"
|
||||||
@@ -5,14 +5,14 @@ import { useTracked } from '../../provider';
|
|||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { ToastEvent } from '../../services/EventManager';
|
import { ToastEvent } from '../../services/EventManager';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../dialog/dialog-header';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const ForgotPassword = () => {
|
export const ForgotPassword = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -86,7 +86,7 @@ export const ForgotPassword = () => {
|
|||||||
paddingBottom: 50
|
paddingBottom: 50
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: null,
|
width: null,
|
||||||
height: null
|
height: null
|
||||||
@@ -129,7 +129,7 @@ export const ForgotPassword = () => {
|
|||||||
onErrorCheck={e => setError(e)}
|
onErrorCheck={e => setError(e)}
|
||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
autoCompleteType="email"
|
autoComplete="email"
|
||||||
validationType="email"
|
validationType="email"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { useTracked } from '../../provider/index';
|
import { useTracked } from '../../provider/index';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { eCloseLoginDialog, eOpenLoginDialog } from '../../utils/Events';
|
import { eCloseLoginDialog, eOpenLoginDialog } from '../../utils/events';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
import { Login } from './login';
|
import { Login } from './login';
|
||||||
import { Signup } from './signup';
|
import { Signup } from './signup';
|
||||||
|
|
||||||
@@ -9,18 +9,18 @@ import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManage
|
|||||||
import { clearMessage } from '../../services/Message';
|
import { clearMessage } from '../../services/Message';
|
||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseLoginDialog } from '../../utils/Events';
|
import { eCloseLoginDialog } from '../../utils/events';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { SvgToPngView } from '../ListPlaceholders';
|
import { SvgView } from '../ui/svg';
|
||||||
import { BouncingView } from '../Transitions/bouncing-view';
|
import { BouncingView } from '../ui/transitions/bouncing-view';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { SVG } from './background';
|
import { SVG } from './background';
|
||||||
import { ForgotPassword } from './forgot-password';
|
import { ForgotPassword } from './forgot-password';
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ export const Login = ({ changeMode }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name="arrow-left"
|
name="arrow-left"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
eSendEvent(eCloseLoginDialog);
|
eSendEvent(eCloseLoginDialog);
|
||||||
@@ -134,7 +134,7 @@ export const Login = ({ changeMode }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BouncingView initialScale={1.2} duration={5000}>
|
<BouncingView initialScale={1.2} duration={5000}>
|
||||||
<SvgToPngView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
|
<SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
|
||||||
</BouncingView>
|
</BouncingView>
|
||||||
</View>
|
</View>
|
||||||
<BouncingView initialScale={0.95} duration={3000}>
|
<BouncingView initialScale={0.95} duration={3000}>
|
||||||
@@ -187,7 +187,7 @@ export const Login = ({ changeMode }) => {
|
|||||||
onErrorCheck={e => setError(e)}
|
onErrorCheck={e => setError(e)}
|
||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
autoCompleteType="email"
|
autoComplete="email"
|
||||||
validationType="email"
|
validationType="email"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
@@ -205,7 +205,7 @@ export const Login = ({ changeMode }) => {
|
|||||||
returnKeyLabel="Done"
|
returnKeyLabel="Done"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
validationType="password"
|
validationType="password"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
@@ -14,17 +14,17 @@ import { clearMessage } from '../../services/Message';
|
|||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import Sync from '../../services/Sync';
|
import Sync from '../../services/Sync';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { Dialog } from '../Dialog';
|
import { Dialog } from '../dialog';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
function getEmail(email) {
|
function getEmail(email) {
|
||||||
if (!email) return null;
|
if (!email) return null;
|
||||||
@@ -157,7 +157,7 @@ export const SessionExpired = () => {
|
|||||||
paddingVertical: 20
|
paddingVertical: 20
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: 60,
|
width: 60,
|
||||||
height: 60
|
height: 60
|
||||||
@@ -187,7 +187,7 @@ export const SessionExpired = () => {
|
|||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
@@ -8,19 +8,19 @@ import { eSendEvent, ToastEvent } from '../../services/EventManager';
|
|||||||
import { clearMessage, setEmailVerifyMessage } from '../../services/Message';
|
import { clearMessage, setEmailVerifyMessage } from '../../services/Message';
|
||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eCloseLoginDialog } from '../../utils/Events';
|
import { eCloseLoginDialog } from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import umami from '../../utils/umami';
|
import umami from '../../utils/analytics';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { SvgToPngView } from '../ListPlaceholders';
|
import { SvgView } from '../ui/svg';
|
||||||
import { BouncingView } from '../Transitions/bouncing-view';
|
import { BouncingView } from '../ui/transitions/bouncing-view';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { SVG } from './background';
|
import { SVG } from './background';
|
||||||
|
|
||||||
export const Signup = ({ changeMode, welcome, trial }) => {
|
export const Signup = ({ changeMode, welcome, trial }) => {
|
||||||
@@ -87,7 +87,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!welcome && (
|
{!welcome && (
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name="arrow-left"
|
name="arrow-left"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
eSendEvent(eCloseLoginDialog);
|
eSendEvent(eCloseLoginDialog);
|
||||||
@@ -119,7 +119,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BouncingView initialScale={1.2} duration={5000}>
|
<BouncingView initialScale={1.2} duration={5000}>
|
||||||
<SvgToPngView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
|
<SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
|
||||||
</BouncingView>
|
</BouncingView>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
|||||||
onErrorCheck={e => setError(e)}
|
onErrorCheck={e => setError(e)}
|
||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
autoCompleteType="email"
|
autoComplete="email"
|
||||||
validationType="email"
|
validationType="email"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
@@ -190,7 +190,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
|||||||
returnKeyLabel="Next"
|
returnKeyLabel="Next"
|
||||||
returnKeyType="next"
|
returnKeyType="next"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
validationType="password"
|
validationType="password"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
@@ -206,7 +206,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
|||||||
returnKeyLabel="Signup"
|
returnKeyLabel="Signup"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
secureTextEntry
|
secureTextEntry
|
||||||
autoCompleteType="password"
|
autoComplete="password"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
validationType="confirmPassword"
|
validationType="confirmPassword"
|
||||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useSelectionStore } from '../../provider/stores';
|
import { useSelectionStore } from '../../provider/stores';
|
||||||
|
|
||||||
export const ContainerTopSection = ({ children }) => {
|
export const ContainerHeader = ({ children }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const { colors } = state;
|
const { colors } = state;
|
||||||
const selectionMode = useSelectionStore(state => state.selectionMode);
|
const selectionMode = useSelectionStore(state => state.selectionMode);
|
||||||
@@ -6,11 +6,11 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../e2e/test.ids';
|
||||||
import { useSelectionStore, useSettingStore } from '../../provider/stores';
|
import { useSelectionStore, useSettingStore } from '../../provider/stores';
|
||||||
import { editing, getElevation, showTooltip, TOOLTIP_POSITIONS } from '../../utils';
|
import { editing, getElevation, showTooltip, TOOLTIP_POSITIONS } from '../../utils';
|
||||||
import { normalize, SIZE } from '../../utils/SizeUtils';
|
import { normalize, SIZE } from '../../utils/size';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
|
|
||||||
const translateY = new Animated.Value(0);
|
const translateY = new Animated.Value(0);
|
||||||
export const ContainerBottomButton = ({ title, onPress, color = 'accent', shouldShow = false }) => {
|
export const FloatingButton = ({ title, onPress, color = 'accent', shouldShow = false }) => {
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const deviceMode = useSettingStore(state => state.deviceMode);
|
const deviceMode = useSettingStore(state => state.deviceMode);
|
||||||
const selectionMode = useSelectionStore(state => state.selectionMode);
|
const selectionMode = useSelectionStore(state => state.selectionMode);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
|
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
|
||||||
export const Container = ({ children }) => {
|
export const Container = ({ children }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const { colors } = state;
|
const { colors } = state;
|
||||||
@@ -9,8 +9,8 @@ import {
|
|||||||
View
|
View
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../provider/stores';
|
||||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
|
||||||
import { BouncingView } from '../Transitions/bouncing-view';
|
import { BouncingView } from '../ui/transitions/bouncing-view';
|
||||||
|
|
||||||
const BaseDialog = ({
|
const BaseDialog = ({
|
||||||
visible,
|
visible,
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../e2e/test.ids';
|
||||||
|
|
||||||
@@ -2,10 +2,10 @@ import React from 'react';
|
|||||||
import { Text } from 'react-native';
|
import { Text } from 'react-native';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
const DialogHeader = ({
|
const DialogHeader = ({
|
||||||
icon,
|
icon,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../services/EventManager';
|
||||||
import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/Events';
|
import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/events';
|
||||||
|
|
||||||
type DialogInfo = {
|
type DialogInfo = {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -4,11 +4,11 @@ import { useTracked } from '../../provider';
|
|||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { getElevation } from '../../utils';
|
import { getElevation } from '../../utils';
|
||||||
import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/Events';
|
import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/events';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
import BaseDialog from './base-dialog';
|
import BaseDialog from './base-dialog';
|
||||||
import DialogButtons from './dialog-buttons';
|
import DialogButtons from './dialog-buttons';
|
||||||
import DialogHeader from './dialog-header';
|
import DialogHeader from './dialog-header';
|
||||||
@@ -84,66 +84,64 @@ export const Dialog = ({ context = 'global' }) => {
|
|||||||
paddingTop: 12
|
paddingTop: 12
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return visible ? (
|
||||||
visible && (
|
<BaseDialog
|
||||||
<BaseDialog
|
statusBarTranslucent={false}
|
||||||
statusBarTranslucent={false}
|
bounce={!dialogInfo.input}
|
||||||
bounce={!dialogInfo.input}
|
closeOnTouch={!dialogInfo.disableBackdropClosing}
|
||||||
closeOnTouch={!dialogInfo.disableBackdropClosing}
|
onShow={async () => {
|
||||||
onShow={async () => {
|
if (dialogInfo.input) {
|
||||||
if (dialogInfo.input) {
|
inputRef.current?.setNativeProps({
|
||||||
inputRef.current?.setNativeProps({
|
text: dialogInfo.defaultValue
|
||||||
text: dialogInfo.defaultValue
|
});
|
||||||
});
|
await sleep(300);
|
||||||
await sleep(300);
|
inputRef.current?.focus();
|
||||||
inputRef.current?.focus();
|
}
|
||||||
}
|
}}
|
||||||
}}
|
visible={true}
|
||||||
visible={true}
|
onRequestClose={hide}
|
||||||
onRequestClose={hide}
|
>
|
||||||
>
|
<View style={style}>
|
||||||
<View style={style}>
|
<DialogHeader
|
||||||
<DialogHeader
|
title={dialogInfo.title}
|
||||||
title={dialogInfo.title}
|
icon={dialogInfo.icon}
|
||||||
icon={dialogInfo.icon}
|
paragraph={dialogInfo.paragraph}
|
||||||
paragraph={dialogInfo.paragraph}
|
paragraphColor={dialogInfo.paragraphColor}
|
||||||
paragraphColor={dialogInfo.paragraphColor}
|
padding={12}
|
||||||
padding={12}
|
/>
|
||||||
/>
|
<Seperator half />
|
||||||
<Seperator half />
|
|
||||||
|
|
||||||
{dialogInfo.input ? (
|
{dialogInfo.input ? (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
paddingHorizontal: 12
|
paddingHorizontal: 12
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
fwdRef={inputRef}
|
||||||
|
autoCapitalize="none"
|
||||||
|
onChangeText={value => {
|
||||||
|
setInputValue(value);
|
||||||
}}
|
}}
|
||||||
>
|
secureTextEntry={dialogInfo.secureTextEntry}
|
||||||
<Input
|
//defaultValue={dialogInfo.defaultValue}
|
||||||
fwdRef={inputRef}
|
onSubmit={onPressPositive}
|
||||||
autoCapitalize="none"
|
returnKeyLabel="Done"
|
||||||
onChangeText={value => {
|
returnKeyType="done"
|
||||||
setInputValue(value);
|
placeholder={dialogInfo.inputPlaceholder}
|
||||||
}}
|
/>
|
||||||
secureTextEntry={dialogInfo.secureTextEntry}
|
</View>
|
||||||
//defaultValue={dialogInfo.defaultValue}
|
) : null}
|
||||||
onSubmit={onPressPositive}
|
|
||||||
returnKeyLabel="Done"
|
|
||||||
returnKeyType="done"
|
|
||||||
placeholder={dialogInfo.inputPlaceholder}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
onPressNegative={onNegativePress}
|
onPressNegative={onNegativePress}
|
||||||
onPressPositive={dialogInfo.positivePress && onPressPositive}
|
onPressPositive={dialogInfo.positivePress && onPressPositive}
|
||||||
positiveTitle={dialogInfo.positiveText}
|
positiveTitle={dialogInfo.positiveText}
|
||||||
negativeTitle={dialogInfo.negativeText}
|
negativeTitle={dialogInfo.negativeText}
|
||||||
positiveType={dialogInfo.positiveType}
|
positiveType={dialogInfo.positiveType}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Toast context="local" />
|
<Toast context="local" />
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
)
|
) : null;
|
||||||
);
|
|
||||||
};
|
};
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
eOpenAddNotebookDialog,
|
eOpenAddNotebookDialog,
|
||||||
eOpenAddTopicDialog,
|
eOpenAddTopicDialog,
|
||||||
eOpenMoveNoteDialog
|
eOpenMoveNoteDialog
|
||||||
} from '../../utils/Events';
|
} from '../../utils/events';
|
||||||
|
|
||||||
export const ActionSheetEvent = (item, buttons) => {
|
export const ActionSheetEvent = (item, buttons) => {
|
||||||
eSendEvent(eOpenActionSheet, {
|
eSendEvent(eOpenActionSheet, {
|
||||||
58
apps/mobile/src/components/dialogprovider/index.js
Normal file
58
apps/mobile/src/components/dialogprovider/index.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTracked } from '../../provider';
|
||||||
|
import { EditorSettings } from '../../views/Editor/EditorSettings';
|
||||||
|
import { AddNotebookDialog } from '../AddNotebookDialog';
|
||||||
|
import { AddTopicDialog } from '../AddTopicDialog';
|
||||||
|
import { AnnouncementDialog } from '../Announcements';
|
||||||
|
import { AttachmentDialog } from '../AttachmentDialog';
|
||||||
|
import Auth from '../auth';
|
||||||
|
import { SessionExpired } from '../auth/session-expired';
|
||||||
|
import { Dialog } from '../dialog';
|
||||||
|
import ExportDialog from '../ExportDialog';
|
||||||
|
import ImagePreview from '../image-preview';
|
||||||
|
import MergeEditor from '../MergeEditor';
|
||||||
|
import MoveNoteDialog from '../MoveNoteDialog';
|
||||||
|
import PremiumDialog from '../premium';
|
||||||
|
import { Expiring } from '../premium/expiring';
|
||||||
|
import PublishNoteDialog from '../PublishNoteDialog';
|
||||||
|
import RateDialog from '../RateDialog';
|
||||||
|
import RecoveryKeyDialog from '../RecoveryKeyDialog';
|
||||||
|
import RestoreDialog from '../RestoreDialog';
|
||||||
|
import ResultDialog from '../ResultDialog';
|
||||||
|
import SheetProvider from '../sheet-provider';
|
||||||
|
import TagsDialog from '../TagsDialog';
|
||||||
|
import { VaultDialog } from '../VaultDialog';
|
||||||
|
|
||||||
|
function DialogProvider() {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const { colors } = state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dialog context="global" />
|
||||||
|
<AddTopicDialog colors={colors} />
|
||||||
|
<AddNotebookDialog colors={colors} />
|
||||||
|
<PremiumDialog colors={colors} />
|
||||||
|
<Auth colors={colors} />
|
||||||
|
<MergeEditor />
|
||||||
|
<ExportDialog />
|
||||||
|
<RecoveryKeyDialog colors={colors} />
|
||||||
|
<SheetProvider />
|
||||||
|
<RestoreDialog />
|
||||||
|
<ResultDialog />
|
||||||
|
<VaultDialog colors={colors} />
|
||||||
|
<MoveNoteDialog colors={colors} />
|
||||||
|
<RateDialog />
|
||||||
|
<ImagePreview />
|
||||||
|
<EditorSettings />
|
||||||
|
<PublishNoteDialog />
|
||||||
|
<TagsDialog />
|
||||||
|
<AttachmentDialog />
|
||||||
|
<Expiring />
|
||||||
|
<AnnouncementDialog />
|
||||||
|
<SessionExpired />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default React.memo(DialogProvider, () => true);
|
||||||
@@ -4,11 +4,11 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import { eScrollEvent } from '../../utils/Events';
|
import { eScrollEvent } from '../../utils/events';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { SearchInput } from '../SearchInput';
|
import { SearchInput } from '../SearchInput';
|
||||||
import { HeaderLeftMenu } from './HeaderLeftMenu';
|
import { LeftMenus } from './left-menus';
|
||||||
import { HeaderRightMenu } from './HeaderRightMenu';
|
import { RightMenus } from './right-menus';
|
||||||
import { Title } from './title';
|
import { Title } from './title';
|
||||||
|
|
||||||
export const Header = React.memo(
|
export const Header = React.memo(
|
||||||
@@ -49,7 +49,7 @@ export const Header = React.memo(
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<View style={styles.leftBtnContainer}>
|
<View style={styles.leftBtnContainer}>
|
||||||
<HeaderLeftMenu headerMenuState={!isBack} currentScreen={screen} />
|
<LeftMenus headerMenuState={!isBack} currentScreen={screen} />
|
||||||
|
|
||||||
<Title
|
<Title
|
||||||
notebook={notebook}
|
notebook={notebook}
|
||||||
@@ -60,7 +60,7 @@ export const Header = React.memo(
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<HeaderRightMenu rightButtons={rightButtons} action={action} currentScreen={screen} />
|
<RightMenus rightButtons={rightButtons} action={action} currentScreen={screen} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -4,10 +4,9 @@ import { useTracked } from '../../provider';
|
|||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../provider/stores';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
|
||||||
|
|
||||||
export const HeaderLeftMenu = ({ currentScreen, headerMenuState }) => {
|
export const LeftMenus = ({ currentScreen, headerMenuState }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const { colors } = state;
|
const { colors } = state;
|
||||||
const deviceMode = useSettingStore(state => state.deviceMode);
|
const deviceMode = useSettingStore(state => state.deviceMode);
|
||||||
@@ -23,7 +22,7 @@ export const HeaderLeftMenu = ({ currentScreen, headerMenuState }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{deviceMode !== 'tablet' || currentScreen === 'Search' || !headerMenuState ? (
|
{deviceMode !== 'tablet' || currentScreen === 'Search' || !headerMenuState ? (
|
||||||
<ActionIcon
|
<IconButton
|
||||||
testID={notesnook.ids.default.header.buttons.left}
|
testID={notesnook.ids.default.header.buttons.left}
|
||||||
customStyle={{
|
customStyle={{
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import Menu, { MenuItem } from 'react-native-reanimated-material-menu';
|
import Menu from 'react-native-reanimated-material-menu';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../e2e/test.ids';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../provider/stores';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { Button } from '../ui/button';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
|
||||||
|
|
||||||
export const HeaderRightMenu = ({ currentScreen, action, rightButtons }) => {
|
export const RightMenus = ({ currentScreen, action, rightButtons }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const { colors } = state;
|
const { colors } = state;
|
||||||
const deviceMode = useSettingStore(state => state.deviceMode);
|
const deviceMode = useSettingStore(state => state.deviceMode);
|
||||||
@@ -19,7 +17,7 @@ export const HeaderRightMenu = ({ currentScreen, action, rightButtons }) => {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.rightBtnContainer}>
|
<View style={styles.rightBtnContainer}>
|
||||||
{currentScreen !== 'Settings' ? (
|
{currentScreen !== 'Settings' ? (
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
Navigation.navigate('Search', {
|
Navigation.navigate('Search', {
|
||||||
menu: false
|
menu: false
|
||||||
@@ -65,7 +63,7 @@ export const HeaderRightMenu = ({ currentScreen, action, rightButtons }) => {
|
|||||||
backgroundColor: colors.bg
|
backgroundColor: colors.bg
|
||||||
}}
|
}}
|
||||||
button={
|
button={
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
menuRef.current?.show();
|
menuRef.current?.show();
|
||||||
}}
|
}}
|
||||||
@@ -3,10 +3,10 @@ import { View } from 'react-native';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import { eOnNewTopicAdded, eScrollEvent } from '../../utils/Events';
|
import { eOnNewTopicAdded, eScrollEvent } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const Title = ({ heading, headerColor, screen, notebook }) => {
|
export const Title = ({ heading, headerColor, screen, notebook }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -2,9 +2,9 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||||
import RNFetchBlob from 'rn-fetch-blob';
|
import RNFetchBlob from 'rn-fetch-blob';
|
||||||
import Storage from '../../utils/storage';
|
import Storage from '../../utils/database/storage';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');
|
const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');
|
||||||
|
|
||||||
const ImagePreview = () => {
|
const ImagePreview = () => {
|
||||||
@@ -62,7 +62,7 @@ const ImagePreview = () => {
|
|||||||
paddingTop: 30
|
paddingTop: 30
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name="close"
|
name="close"
|
||||||
color="white"
|
color="white"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -23,27 +23,27 @@ import { setRateAppMessage } from '../../services/Message';
|
|||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import { editing } from '../../utils';
|
import { editing } from '../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eOpenAnnouncementDialog } from '../../utils/Events';
|
import { eOpenAnnouncementDialog } from '../../utils/events';
|
||||||
import { MMKV } from '../../utils/mmkv';
|
import { MMKV } from '../../utils/database/mmkv';
|
||||||
import { tabBarRef } from '../../utils/Refs';
|
import { tabBarRef } from '../../utils/global-refs';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import SettingsBackupAndRestore from '../../views/Settings/backup-restore';
|
import SettingsBackupAndRestore from '../../views/Settings/backup-restore';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Input from '../Input';
|
import Input from '../ui/input';
|
||||||
import { SvgToPngView } from '../ListPlaceholders';
|
import { SvgView } from '../ui/svg';
|
||||||
import { SVG } from '../Auth/background';
|
import { SVG } from '../auth/background';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import SplashScreen from '../SplashScreen';
|
import Intro from '../intro';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { Update } from '../Update';
|
import { Update } from '../update';
|
||||||
|
|
||||||
let passwordValue = null;
|
let passwordValue = null;
|
||||||
let didVerifyUser = false;
|
let didVerifyUser = false;
|
||||||
|
|
||||||
const AppLoader = ({ onLoad }) => {
|
const Launcher = ({ onLoad }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const colors = state.colors;
|
const colors = state.colors;
|
||||||
const setNotes = useNoteStore(state => state.setNotes);
|
const setNotes = useNoteStore(state => state.setNotes);
|
||||||
@@ -250,7 +250,7 @@ const AppLoader = ({ onLoad }) => {
|
|||||||
overflow: 'hidden'
|
overflow: 'hidden'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SvgToPngView src={SVG(colors.night ? 'white' : 'black')} height={700} />
|
<SvgView src={SVG(colors.night ? 'white' : 'black')} height={700} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@@ -263,7 +263,7 @@ const AppLoader = ({ onLoad }) => {
|
|||||||
marginTop: 15
|
marginTop: 15
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name="fingerprint"
|
name="fingerprint"
|
||||||
size={100}
|
size={100}
|
||||||
customStyle={{
|
customStyle={{
|
||||||
@@ -355,8 +355,8 @@ const AppLoader = ({ onLoad }) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
) : requireIntro.value && !_loading ? (
|
) : requireIntro.value && !_loading ? (
|
||||||
<SplashScreen />
|
<Intro />
|
||||||
) : null;
|
) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AppLoader;
|
export default Launcher;
|
||||||
@@ -3,10 +3,10 @@ import { View } from 'react-native';
|
|||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { useMessageStore, useSelectionStore } from '../../provider/stores';
|
import { useMessageStore, useSelectionStore } from '../../provider/stores';
|
||||||
import { hexToRGBA } from '../../utils/ColorUtils';
|
import { hexToRGBA } from '../../utils/color-scheme/utils';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const Card = ({ color }) => {
|
export const Card = ({ color }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
130
apps/mobile/src/components/list/empty.js
Normal file
130
apps/mobile/src/components/list/empty.js
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ActivityIndicator, useWindowDimensions, View } from 'react-native';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
|
import { useTracked } from '../../provider';
|
||||||
|
import { useSettingStore } from '../../provider/stores';
|
||||||
|
import { useTip } from '../../services/tip-manager';
|
||||||
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
|
import { SIZE } from '../../utils/size';
|
||||||
|
import { Button } from '../ui/button';
|
||||||
|
import Seperator from '../ui/seperator';
|
||||||
|
import { Tip } from '../tip';
|
||||||
|
import Heading from '../ui/typography/heading';
|
||||||
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
|
export const Empty = React.memo(
|
||||||
|
({ loading = true, placeholderData, headerProps, type, screen }) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const { colors } = state;
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
const { height } = useWindowDimensions();
|
||||||
|
const introCompleted = useSettingStore(state => state.isIntroCompleted);
|
||||||
|
const tip = useTip(
|
||||||
|
screen === 'Notes' && introCompleted ? 'first-note' : placeholderData.type || type,
|
||||||
|
screen === 'Notes' ? 'notes' : null
|
||||||
|
);
|
||||||
|
const color =
|
||||||
|
colors[COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'];
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
{
|
||||||
|
height: height - (140 + insets.top),
|
||||||
|
width: '80%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignSelf: 'center'
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{!loading ? (
|
||||||
|
<>
|
||||||
|
<Tip
|
||||||
|
color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
|
||||||
|
tip={tip}
|
||||||
|
style={{
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
paddingHorizontal: 0
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{placeholderData.button && (
|
||||||
|
<Button
|
||||||
|
type="grayAccent"
|
||||||
|
title={placeholderData.button}
|
||||||
|
iconPosition="right"
|
||||||
|
icon="arrow-right"
|
||||||
|
onPress={placeholderData.action}
|
||||||
|
accentColor={
|
||||||
|
COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'
|
||||||
|
}
|
||||||
|
accentText="light"
|
||||||
|
style={{
|
||||||
|
alignSelf: 'flex-start',
|
||||||
|
borderRadius: 5,
|
||||||
|
height: 40
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignSelf: 'center',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
width: '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Heading>{placeholderData.heading}</Heading>
|
||||||
|
<Paragraph size={SIZE.sm} textBreakStrategy="balanced">
|
||||||
|
{placeholderData.loading}
|
||||||
|
</Paragraph>
|
||||||
|
<Seperator />
|
||||||
|
<ActivityIndicator
|
||||||
|
size={SIZE.lg}
|
||||||
|
color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(prev, next) => {
|
||||||
|
if (prev.loading === next.loading) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a tips manager.
|
||||||
|
* The tip manager stores many tips. Each tip has following values
|
||||||
|
* 1. Text
|
||||||
|
* 2. contexts: An array of context strings. // Places where the tip can be shown
|
||||||
|
* 3. Button if any.
|
||||||
|
* 4. Image/Gif asset.
|
||||||
|
*
|
||||||
|
* Tip manager adds the following methods -> get(context). Returns a random tip for the following context.
|
||||||
|
*
|
||||||
|
* Tips can be shown in a sheet or in a list. For sheets, GeneralSheet can be used to
|
||||||
|
* render tips.
|
||||||
|
*
|
||||||
|
* Where can the tips be shown and how?
|
||||||
|
* 1. When transitioning, show tips in a sheet. Make sure its useful
|
||||||
|
* 2. Replace placeholders with tips.
|
||||||
|
* 3. Show tips in editor placeholder.
|
||||||
|
* 4. Show tips between list items?
|
||||||
|
*
|
||||||
|
* Tooltips.
|
||||||
|
* Small tooltips can be shown in initial render first time.
|
||||||
|
* Especially for items that are not shown on blank page. Should be
|
||||||
|
* in places where it makes sense and does not interrupt the user.
|
||||||
|
*
|
||||||
|
* Can also be shown when first time entering a screen that
|
||||||
|
* has something that the user might not know of. Like sorting and side menu.
|
||||||
|
*
|
||||||
|
* Todo:
|
||||||
|
* 1. Make a tip manager.
|
||||||
|
* 2. Make a list of tips.
|
||||||
|
* 3. Add images for those tips.
|
||||||
|
* 4. Show tips
|
||||||
|
*/
|
||||||
@@ -6,14 +6,14 @@ import { useUserStore } from '../../provider/stores';
|
|||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../services/EventManager';
|
||||||
import Sync from '../../services/Sync';
|
import Sync from '../../services/Sync';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { eScrollEvent } from '../../utils/Events';
|
import { eScrollEvent } from '../../utils/events';
|
||||||
import JumpToDialog from '../JumpToDialog';
|
import JumpToDialog from '../JumpToDialog';
|
||||||
import { NotebookWrapper } from '../NotebookItem/wrapper';
|
import { NotebookWrapper } from '../list-items/notebook/wrapper';
|
||||||
import { NoteWrapper } from '../NoteItem/wrapper';
|
import { NoteWrapper } from '../list-items/note/wrapper';
|
||||||
import TagItem from '../TagItem';
|
import TagItem from '../list-items/tag';
|
||||||
import { Empty } from './empty';
|
import { Empty } from './empty';
|
||||||
import { Footer } from './footer';
|
import { Footer } from '../list-items/footer';
|
||||||
import { Header } from './header';
|
import { Header } from '../list-items/headers/header';
|
||||||
import { SectionHeader } from './section-header';
|
import { SectionHeader } from './section-header';
|
||||||
|
|
||||||
let renderItems = {
|
let renderItems = {
|
||||||
@@ -48,7 +48,7 @@ const RenderItem = ({ item, index, type, ...restArgs }) => {
|
|||||||
return <Item item={item} tags={tags} dateBy={dateBy} index={index} type={type} {...restArgs} />;
|
return <Item item={item} tags={tags} dateBy={dateBy} index={index} type={type} {...restArgs} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SimpleList = ({
|
const List = ({
|
||||||
listData,
|
listData,
|
||||||
type,
|
type,
|
||||||
refreshCallback,
|
refreshCallback,
|
||||||
@@ -186,4 +186,4 @@ const SimpleList = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SimpleList;
|
export default List;
|
||||||
39
apps/mobile/src/components/listitems/headers/header.js
Normal file
39
apps/mobile/src/components/listitems/headers/header.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { View } from 'react-native';
|
||||||
|
import { useTracked } from '../../../provider';
|
||||||
|
import { useMessageStore } from '../../../provider/stores';
|
||||||
|
import { COLORS_NOTE } from '../../../utils/color-scheme';
|
||||||
|
import { Announcement } from '../../Announcements/announcement';
|
||||||
|
import { Card } from '../../list/card';
|
||||||
|
|
||||||
|
export const Header = React.memo(
|
||||||
|
({ type, messageCard = true, color, shouldShow = false, noAnnouncement }) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const { colors } = state;
|
||||||
|
const announcements = useMessageStore(state => state.announcements);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{announcements.length !== 0 && !noAnnouncement ? (
|
||||||
|
<Announcement color={color || colors.accent} />
|
||||||
|
) : type === 'search' ? null : !shouldShow ? (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
marginBottom: 5,
|
||||||
|
padding: 0,
|
||||||
|
width: '100%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{messageCard ? (
|
||||||
|
<Card color={COLORS_NOTE[color?.toLowerCase()] || colors.accent} />
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Header.displayName = 'Header';
|
||||||
@@ -5,10 +5,10 @@ import { useMenuStore } from '../../provider/stores';
|
|||||||
import { ToastEvent } from '../../services/EventManager';
|
import { ToastEvent } from '../../services/EventManager';
|
||||||
import { getTotalNotes } from '../../utils';
|
import { getTotalNotes } from '../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../utils/database';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const NotebookHeader = ({ notebook, onEditNotebook }) => {
|
export const NotebookHeader = ({ notebook, onEditNotebook }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -64,7 +64,7 @@ export const NotebookHeader = ({ notebook, onEditNotebook }) => {
|
|||||||
flexDirection: 'row'
|
flexDirection: 'row'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
name={isPinnedToMenu ? 'link-variant-off' : 'link-variant'}
|
name={isPinnedToMenu ? 'link-variant-off' : 'link-variant'}
|
||||||
onPress={onPinNotebook}
|
onPress={onPinNotebook}
|
||||||
tooltipText={'Create shortcut in side menu'}
|
tooltipText={'Create shortcut in side menu'}
|
||||||
@@ -78,7 +78,7 @@ export const NotebookHeader = ({ notebook, onEditNotebook }) => {
|
|||||||
color={isPinnedToMenu ? colors.accent : colors.icon}
|
color={isPinnedToMenu ? colors.accent : colors.icon}
|
||||||
size={SIZE.lg}
|
size={SIZE.lg}
|
||||||
/>
|
/>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
size={SIZE.lg}
|
size={SIZE.lg}
|
||||||
onPress={onEditNotebook}
|
onPress={onEditNotebook}
|
||||||
tooltipText="Edit this notebook"
|
tooltipText="Edit this notebook"
|
||||||
145
apps/mobile/src/components/listitems/headers/sectionheader.js
Normal file
145
apps/mobile/src/components/listitems/headers/sectionheader.js
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import { TouchableOpacity, useWindowDimensions, View } from 'react-native';
|
||||||
|
import { useTracked } from '../../provider';
|
||||||
|
import { useSettingStore } from '../../provider/stores';
|
||||||
|
import {
|
||||||
|
eSendEvent,
|
||||||
|
eSubscribeEvent,
|
||||||
|
eUnSubscribeEvent,
|
||||||
|
presentSheet
|
||||||
|
} from '../../services/EventManager';
|
||||||
|
import SettingsService from '../../services/SettingsService';
|
||||||
|
import { GROUP } from '../../utils/constants';
|
||||||
|
import { COLORS_NOTE } from '../../utils/color-scheme';
|
||||||
|
import { db } from '../../utils/database';
|
||||||
|
import { eOpenJumpToDialog } from '../../utils/events';
|
||||||
|
import { SIZE } from '../../utils/size';
|
||||||
|
import { IconButton } from '../ui/icon-button';
|
||||||
|
import { Button } from '../ui/button';
|
||||||
|
import Sort from '../Sort';
|
||||||
|
import Heading from '../ui/typography/heading';
|
||||||
|
|
||||||
|
export const SectionHeader = ({ item, index, type, color, screen }) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const { colors } = state;
|
||||||
|
const { fontScale } = useWindowDimensions();
|
||||||
|
const [groupOptions, setGroupOptions] = useState(db.settings?.getGroupOptions(type));
|
||||||
|
let groupBy = Object.keys(GROUP).find(key => GROUP[key] === groupOptions.groupBy);
|
||||||
|
const jumpToRef = useRef();
|
||||||
|
const sortRef = useRef();
|
||||||
|
const compactModeRef = useRef();
|
||||||
|
|
||||||
|
const settings = useSettingStore(state => state.settings);
|
||||||
|
const listMode = type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;
|
||||||
|
|
||||||
|
groupBy = !groupBy
|
||||||
|
? 'Default'
|
||||||
|
: groupBy.slice(0, 1).toUpperCase() + groupBy.slice(1, groupBy.length);
|
||||||
|
|
||||||
|
const onUpdate = () => {
|
||||||
|
setGroupOptions({ ...db.settings?.getGroupOptions(type) });
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
eSubscribeEvent('groupOptionsUpdate', onUpdate);
|
||||||
|
return () => {
|
||||||
|
eUnSubscribeEvent('groupOptionsUpdate', onUpdate);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
width: '95%',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
paddingHorizontal: 12,
|
||||||
|
height: 35 * fontScale,
|
||||||
|
backgroundColor: colors.nav,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 5,
|
||||||
|
marginVertical: 5
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
eSendEvent(eOpenJumpToDialog, type);
|
||||||
|
}}
|
||||||
|
ref={jumpToRef}
|
||||||
|
activeOpacity={0.9}
|
||||||
|
hitSlop={{ top: 10, left: 10, right: 30, bottom: 15 }}
|
||||||
|
style={{
|
||||||
|
height: '100%',
|
||||||
|
justifyContent: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Heading
|
||||||
|
color={COLORS_NOTE[color?.toLowerCase()] || colors.accent}
|
||||||
|
size={SIZE.sm}
|
||||||
|
style={{
|
||||||
|
minWidth: 60,
|
||||||
|
alignSelf: 'center',
|
||||||
|
textAlignVertical: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!item.title || item.title === '' ? 'Pinned' : item.title}
|
||||||
|
</Heading>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{index === 0 ? (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
onPress={() => {
|
||||||
|
presentSheet({
|
||||||
|
component: <Sort screen={screen} type={type} />
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
tooltipText="Change sorting of items in list"
|
||||||
|
fwdRef={sortRef}
|
||||||
|
title={groupBy}
|
||||||
|
icon={groupOptions.sortDirection === 'asc' ? 'sort-ascending' : 'sort-descending'}
|
||||||
|
height={25}
|
||||||
|
style={{
|
||||||
|
borderRadius: 100,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
marginRight: type === 'notes' || type === 'home' || type === 'notebooks' ? 10 : 0
|
||||||
|
}}
|
||||||
|
type="gray"
|
||||||
|
iconPosition="right"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{type === 'notes' || type === 'notebooks' || type === 'home' ? (
|
||||||
|
<IconButton
|
||||||
|
customStyle={{
|
||||||
|
width: 25,
|
||||||
|
height: 25
|
||||||
|
}}
|
||||||
|
tooltipText={
|
||||||
|
listMode == 'compact' ? 'Switch to normal mode' : 'Switch to compact mode'
|
||||||
|
}
|
||||||
|
fwdRef={compactModeRef}
|
||||||
|
color={colors.icon}
|
||||||
|
name={listMode == 'compact' ? 'view-list' : 'view-list-outline'}
|
||||||
|
onPress={() => {
|
||||||
|
SettingsService.set(
|
||||||
|
type !== 'notebooks' ? 'notesListMode' : 'notebooksListMode',
|
||||||
|
listMode === 'normal' ? 'compact' : 'normal'
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
size={SIZE.lg - 2}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
303
apps/mobile/src/components/listitems/note/index.js
Normal file
303
apps/mobile/src/components/listitems/note/index.js
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
import { decode, EntityLevel } from 'entities';
|
||||||
|
import React from 'react';
|
||||||
|
import { View } from 'react-native';
|
||||||
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import { notesnook } from '../../../../e2e/test.ids';
|
||||||
|
import { useTracked } from '../../../provider';
|
||||||
|
import { useSettingStore } from '../../../provider/stores';
|
||||||
|
import { eSendEvent } from '../../../services/EventManager';
|
||||||
|
import Navigation from '../../../services/Navigation';
|
||||||
|
import { COLORS_NOTE } from '../../../utils/color-scheme';
|
||||||
|
import { db } from '../../../utils/database';
|
||||||
|
import { refreshNotesPage } from '../../../utils/events';
|
||||||
|
import { SIZE } from '../../../utils/size';
|
||||||
|
import { IconButton } from '../../ui/icon-button';
|
||||||
|
import { Button } from '../../ui/button';
|
||||||
|
import { TimeSince } from '../../side-menu/TimeSince';
|
||||||
|
import { Properties } from '../../properties';
|
||||||
|
import Heading from '../../ui/typography/heading';
|
||||||
|
import Paragraph from '../../ui/typography/paragraph';
|
||||||
|
|
||||||
|
const navigateToTopic = topic => {
|
||||||
|
let routeName = 'NotesPage';
|
||||||
|
let params = { ...topic, menu: false, get: 'topics' };
|
||||||
|
let headerState = {
|
||||||
|
heading: topic.title,
|
||||||
|
id: topic.id,
|
||||||
|
type: topic.type
|
||||||
|
};
|
||||||
|
eSendEvent(refreshNotesPage, params);
|
||||||
|
Navigation.navigate(routeName, params, headerState);
|
||||||
|
};
|
||||||
|
|
||||||
|
function navigateToTag(item) {
|
||||||
|
let _tag = db.tags.tag(item.id);
|
||||||
|
if (!_tag) return;
|
||||||
|
let params = {
|
||||||
|
..._tag,
|
||||||
|
type: 'tag',
|
||||||
|
get: 'tagged'
|
||||||
|
};
|
||||||
|
|
||||||
|
eSendEvent(refreshNotesPage, params);
|
||||||
|
Navigation.navigate('NotesPage', params, {
|
||||||
|
heading: '#' + _tag.title,
|
||||||
|
id: _tag.id,
|
||||||
|
type: _tag.type
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const showActionSheet = item => {
|
||||||
|
Properties.present(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
const NoteItem = ({ item, isTrash, tags, dateBy = 'dateCreated', noOpen = false }) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const { colors } = state;
|
||||||
|
const settings = useSettingStore(state => state.settings);
|
||||||
|
const compactMode = settings.notesListMode === 'compact';
|
||||||
|
const attachmentCount = db.attachments?.ofNote(item.id, 'all')?.length || 0;
|
||||||
|
|
||||||
|
function getNotebook() {
|
||||||
|
if (isTrash || !item.notebooks || item.notebooks.length < 1) return [];
|
||||||
|
let item_notebook = item.notebooks?.slice(0, 1)[0];
|
||||||
|
let notebook = db.notebooks.notebook(item_notebook.id);
|
||||||
|
|
||||||
|
if (!notebook) return [];
|
||||||
|
let topic = notebook.topics.topic(item_notebook.topics[0])?._topic;
|
||||||
|
|
||||||
|
if (!topic) return [];
|
||||||
|
|
||||||
|
notebook = notebook.data;
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
title: `${notebook?.title} › ${topic?.title}`,
|
||||||
|
notebook: notebook,
|
||||||
|
topic: topic
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexGrow: 1,
|
||||||
|
flexShrink: 1
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!compactMode ? (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
zIndex: 10,
|
||||||
|
elevation: 10,
|
||||||
|
marginBottom: 2.5
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{getNotebook().map(_item => (
|
||||||
|
<Button
|
||||||
|
title={_item.title}
|
||||||
|
key={_item}
|
||||||
|
height={20}
|
||||||
|
icon="book-outline"
|
||||||
|
type="grayBg"
|
||||||
|
fontSize={SIZE.xs}
|
||||||
|
iconSize={SIZE.sm}
|
||||||
|
textStyle={{
|
||||||
|
marginRight: 0
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
borderRadius: 5,
|
||||||
|
marginRight: 5,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
borderColor: colors.icon,
|
||||||
|
paddingHorizontal: 6
|
||||||
|
}}
|
||||||
|
onPress={() => navigateToTopic(_item.topic)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<Heading
|
||||||
|
numberOfLines={1}
|
||||||
|
color={COLORS_NOTE[item.color?.toLowerCase()] || colors.heading}
|
||||||
|
style={{
|
||||||
|
flexWrap: 'wrap'
|
||||||
|
}}
|
||||||
|
size={SIZE.md}
|
||||||
|
>
|
||||||
|
{item.title}
|
||||||
|
</Heading>
|
||||||
|
|
||||||
|
{item.headline && !compactMode ? (
|
||||||
|
<Paragraph
|
||||||
|
style={{
|
||||||
|
flexWrap: 'wrap'
|
||||||
|
}}
|
||||||
|
numberOfLines={2}
|
||||||
|
>
|
||||||
|
{decode(item.headline, {
|
||||||
|
level: EntityLevel.HTML
|
||||||
|
})}
|
||||||
|
</Paragraph>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
alignItems: 'center',
|
||||||
|
width: '100%',
|
||||||
|
marginTop: 5,
|
||||||
|
height: SIZE.md + 2
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!isTrash ? (
|
||||||
|
<>
|
||||||
|
{item.conflicted ? (
|
||||||
|
<Icon
|
||||||
|
name="alert-circle"
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
size={SIZE.sm}
|
||||||
|
color={colors.red}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<TimeSince
|
||||||
|
style={{
|
||||||
|
fontSize: SIZE.xs,
|
||||||
|
color: colors.icon,
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
time={item[dateBy]}
|
||||||
|
updateFrequency={Date.now() - item[dateBy] < 60000 ? 2000 : 60000}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{attachmentCount > 0 ? (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon name="attachment" size={SIZE.md} color={colors.icon} />
|
||||||
|
<Paragraph color={colors.icon} size={SIZE.xs}>
|
||||||
|
{attachmentCount}
|
||||||
|
</Paragraph>
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{item.pinned ? (
|
||||||
|
<Icon
|
||||||
|
testID="icon-pinned"
|
||||||
|
name="pin-outline"
|
||||||
|
size={SIZE.sm}
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
color={COLORS_NOTE[item.color?.toLowerCase()] || colors.accent}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{item.locked ? (
|
||||||
|
<Icon
|
||||||
|
name="lock"
|
||||||
|
size={SIZE.sm}
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
color={colors.icon}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{item.favorite ? (
|
||||||
|
<Icon
|
||||||
|
testID="icon-star"
|
||||||
|
name="star"
|
||||||
|
size={SIZE.md}
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
color="orange"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!isTrash && !compactMode && tags
|
||||||
|
? tags.map(item =>
|
||||||
|
item.id ? (
|
||||||
|
<Button
|
||||||
|
title={'#' + item.alias}
|
||||||
|
key={item.id}
|
||||||
|
height={23}
|
||||||
|
type="gray"
|
||||||
|
textStyle={{
|
||||||
|
textDecorationLine: 'underline'
|
||||||
|
}}
|
||||||
|
hitSlop={{ top: 8, bottom: 12, left: 0, right: 0 }}
|
||||||
|
fontSize={SIZE.xs}
|
||||||
|
style={{
|
||||||
|
borderRadius: 5,
|
||||||
|
paddingHorizontal: 6,
|
||||||
|
marginRight: 4,
|
||||||
|
zIndex: 10,
|
||||||
|
maxWidth: tags.length > 1 ? 130 : null
|
||||||
|
}}
|
||||||
|
onPress={() => navigateToTag(item)}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
)
|
||||||
|
: null}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Paragraph
|
||||||
|
color={colors.icon}
|
||||||
|
size={SIZE.xs}
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Deleted on{' '}
|
||||||
|
{item && item.dateDeleted
|
||||||
|
? new Date(item.dateDeleted).toISOString().slice(0, 10)
|
||||||
|
: null}
|
||||||
|
</Paragraph>
|
||||||
|
|
||||||
|
<Paragraph
|
||||||
|
color={colors.accent}
|
||||||
|
size={SIZE.xs}
|
||||||
|
style={{
|
||||||
|
marginRight: 6
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.itemType[0].toUpperCase() + item.itemType.slice(1)}
|
||||||
|
</Paragraph>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<IconButton
|
||||||
|
testID={notesnook.listitem.menu}
|
||||||
|
color={colors.pri}
|
||||||
|
name="dots-horizontal"
|
||||||
|
size={SIZE.xl}
|
||||||
|
onPress={() => !noOpen && showActionSheet(item, isTrash)}
|
||||||
|
customStyle={{
|
||||||
|
justifyContent: 'center',
|
||||||
|
height: 35,
|
||||||
|
width: 35,
|
||||||
|
borderRadius: 100,
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NoteItem;
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import NoteItem from '.';
|
import NoteItem from '.';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../../e2e/test.ids';
|
||||||
import { useEditorStore, useSelectionStore, useTrashStore } from '../../provider/stores';
|
import { useEditorStore, useSelectionStore, useTrashStore } from '../../../provider/stores';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../../services/DeviceDetection';
|
||||||
import { eSendEvent, openVault, ToastEvent } from '../../services/EventManager';
|
import { eSendEvent, openVault, ToastEvent } from '../../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../../services/Navigation';
|
||||||
import { history } from '../../utils';
|
import { history } from '../../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../../utils/database';
|
||||||
import { eOnLoadNote, eShowMergeDialog } from '../../utils/Events';
|
import { eOnLoadNote, eShowMergeDialog } from '../../../utils/events';
|
||||||
import { tabBarRef } from '../../utils/Refs';
|
import { tabBarRef } from '../../../utils/global-refs';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../../dialog/functions';
|
||||||
import SelectionWrapper from '../SelectionWrapper';
|
import SelectionWrapper from '../selection-wrapper';
|
||||||
|
|
||||||
export const NoteWrapper = React.memo(
|
export const NoteWrapper = React.memo(
|
||||||
({ item, index, tags, dateBy }) => {
|
({ item, index, tags, dateBy }) => {
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../../e2e/test.ids';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../../provider/stores';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../../services/Navigation';
|
||||||
import { getTotalNotes, history } from '../../utils';
|
import { getTotalNotes, history } from '../../../utils';
|
||||||
import { refreshNotesPage } from '../../utils/Events';
|
import { refreshNotesPage } from '../../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../../ui/button';
|
||||||
import { Properties } from '../Properties';
|
import { Properties } from '../../properties';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../../ui/typography/paragraph';
|
||||||
|
|
||||||
export const NotebookItem = ({ item, isTopic = false, notebookID, isTrash, dateBy }) => {
|
export const NotebookItem = ({ item, isTopic = false, notebookID, isTrash, dateBy }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -186,7 +186,7 @@ export const NotebookItem = ({ item, isTopic = false, notebookID, isTrash, dateB
|
|||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
color={colors.heading}
|
color={colors.heading}
|
||||||
name="dots-horizontal"
|
name="dots-horizontal"
|
||||||
testID={notesnook.ids.notebook.menu}
|
testID={notesnook.ids.notebook.menu}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { NotebookItem } from '.';
|
import { NotebookItem } from '.';
|
||||||
import { useSelectionStore } from '../../provider/stores';
|
import { useSelectionStore } from '../../../provider/stores';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../../services/Navigation';
|
||||||
import { history } from '../../utils';
|
import { history } from '../../../utils';
|
||||||
import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';
|
import { eOnNewTopicAdded, refreshNotesPage } from '../../../utils/events';
|
||||||
import SelectionWrapper from '../SelectionWrapper';
|
import SelectionWrapper from '../selection-wrapper';
|
||||||
|
|
||||||
export const NotebookWrapper = React.memo(
|
export const NotebookWrapper = React.memo(
|
||||||
({ item, index, dateBy }) => {
|
({ item, index, dateBy }) => {
|
||||||
@@ -2,21 +2,21 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
import Animated, { useValue } from 'react-native-reanimated';
|
import Animated, { useValue } from 'react-native-reanimated';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import {
|
import {
|
||||||
useMenuStore,
|
useMenuStore,
|
||||||
useNotebookStore,
|
useNotebookStore,
|
||||||
useSelectionStore,
|
useSelectionStore,
|
||||||
useTrashStore
|
useTrashStore
|
||||||
} from '../../provider/stores';
|
} from '../../../provider/stores';
|
||||||
import { openVault, ToastEvent } from '../../services/EventManager';
|
import { openVault, ToastEvent } from '../../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../../services/Navigation';
|
||||||
import { dWidth, getElevation, toTXT } from '../../utils';
|
import { dWidth, getElevation, toTXT } from '../../../utils';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../../utils/database';
|
||||||
import { deleteItems } from '../../utils/functions';
|
import { deleteItems } from '../../../utils/functions';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../../ui/icon-button';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../../ui/button';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../../dialog/functions';
|
||||||
|
|
||||||
export const ActionStrip = ({ note, setActionStrip }) => {
|
export const ActionStrip = ({ note, setActionStrip }) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -279,7 +279,7 @@ export const ActionStrip = ({ note, setActionStrip }) => {
|
|||||||
marginLeft: 15
|
marginLeft: 15
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ActionIcon
|
<IconButton
|
||||||
color={item.color || colors.heading}
|
color={item.color || colors.heading}
|
||||||
onPress={item.onPress}
|
onPress={item.onPress}
|
||||||
tooltipText={item.title}
|
tooltipText={item.title}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import { useEditorStore } from '../../provider/stores';
|
import { useEditorStore } from '../../../provider/stores';
|
||||||
import { hexToRGBA } from '../../utils/ColorUtils';
|
import { hexToRGBA } from '../../../utils/color-scheme/utils';
|
||||||
|
|
||||||
export const Filler = ({ item, background }) => {
|
export const Filler = ({ item, background }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import { useSettingStore } from '../../provider/stores';
|
import { useSettingStore } from '../../../provider/stores';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../../services/EventManager';
|
||||||
import { history } from '../../utils';
|
import { history } from '../../../utils';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../../ui/pressable';
|
||||||
import { ActionStrip } from './action-strip';
|
import { ActionStrip } from './action-strip';
|
||||||
import { Filler } from './back-fill';
|
import { Filler } from './back-fill';
|
||||||
import { SelectionIcon } from './selection';
|
import { SelectionIcon } from './selection';
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { TouchableOpacity, View } from 'react-native';
|
import { TouchableOpacity, View } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import { Actions } from '../../provider/Actions';
|
import { Actions } from '../../../provider/Actions';
|
||||||
import { useSelectionStore } from '../../provider/stores';
|
import { useSelectionStore } from '../../../provider/stores';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../../utils/size';
|
||||||
|
|
||||||
export const SelectionIcon = ({ setActionStrip, item, compactMode }) => {
|
export const SelectionIcon = ({ setActionStrip, item, compactMode }) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useWindowDimensions, View } from 'react-native';
|
import { useWindowDimensions, View } from 'react-native';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import { notesnook } from '../../../../e2e/test.ids';
|
||||||
import { PressableButton } from '../../components/PressableButton';
|
import { PressableButton } from '../../ui/pressable';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../../provider';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import { eSendEvent } from '../../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../../services/Navigation';
|
||||||
import { db } from '../../utils/database';
|
import { db } from '../../../utils/database';
|
||||||
import { refreshNotesPage } from '../../utils/Events';
|
import { refreshNotesPage } from '../../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../../utils/size';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../../ui/icon-button';
|
||||||
import { Properties } from '../Properties';
|
import { Properties } from '../../properties';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../../ui/typography/paragraph';
|
||||||
|
|
||||||
const TagItem = React.memo(
|
const TagItem = React.memo(
|
||||||
({ item, index }) => {
|
({ item, index }) => {
|
||||||
@@ -80,7 +80,7 @@ const TagItem = React.memo(
|
|||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ActionIcon
|
<IconButton
|
||||||
color={colors.heading}
|
color={colors.heading}
|
||||||
name="dots-horizontal"
|
name="dots-horizontal"
|
||||||
size={SIZE.xl}
|
size={SIZE.xl}
|
||||||
@@ -13,20 +13,20 @@ import {
|
|||||||
eCloseProgressDialog,
|
eCloseProgressDialog,
|
||||||
eOpenLoginDialog,
|
eOpenLoginDialog,
|
||||||
eOpenResultDialog
|
eOpenResultDialog
|
||||||
} from '../../utils/Events';
|
} from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import umami from '../../utils/umami';
|
import umami from '../../utils/analytics';
|
||||||
import { ActionIcon } from '../ActionIcon';
|
import { IconButton } from '../ui/icon-button';
|
||||||
import { AuthMode } from '../Auth';
|
import { AuthMode } from '../auth';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import GeneralSheet from '../GeneralSheet';
|
import SheetProvider from '../sheet-provider';
|
||||||
import { SvgToPngView } from '../ListPlaceholders';
|
import { SvgView } from '../ui/svg';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import { Toast } from '../Toast';
|
import { Toast } from '../toast';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { Walkthrough } from '../Walkthrough';
|
import { Walkthrough } from '../walkthroughs';
|
||||||
import { features } from './features';
|
import { features } from './features';
|
||||||
import { Group } from './group';
|
import { Group } from './group';
|
||||||
import { PricingPlans } from './pricing-plans';
|
import { PricingPlans } from './pricing-plans';
|
||||||
@@ -77,8 +77,8 @@ export const Component = ({ close, promo, getRef }) => {
|
|||||||
maxHeight: '100%'
|
maxHeight: '100%'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GeneralSheet context="pricing_plans" />
|
<SheetProvider context="pricing_plans" />
|
||||||
<ActionIcon
|
<IconButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
close();
|
close();
|
||||||
}}
|
}}
|
||||||
@@ -111,7 +111,7 @@ export const Component = ({ close, promo, getRef }) => {
|
|||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SvgToPngView width={350} height={350} src={LAUNCH_ROCKET(colors.accent)} />
|
<SvgView width={350} height={350} src={LAUNCH_ROCKET(colors.accent)} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
@@ -3,15 +3,15 @@ import { View } from 'react-native';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import PremiumService from '../../services/PremiumService';
|
import PremiumService from '../../services/PremiumService';
|
||||||
import { eOpenPremiumDialog, eOpenResultDialog, eOpenTrialEndingDialog } from '../../utils/Events';
|
import { eOpenPremiumDialog, eOpenResultDialog, eOpenTrialEndingDialog } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import DialogContainer from '../Dialog/dialog-container';
|
import DialogContainer from '../dialog/dialog-container';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../ui/seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { CompactFeatures } from './compact-features';
|
import { CompactFeatures } from './compact-features';
|
||||||
import { Offer } from './offer';
|
import { Offer } from './offer';
|
||||||
|
|
||||||
@@ -2,8 +2,8 @@ import React from 'react';
|
|||||||
import { Text, View } from 'react-native';
|
import { Text, View } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { ProTag } from './pro-tag';
|
import { ProTag } from './pro-tag';
|
||||||
|
|
||||||
export const FeatureBlock = ({ vertical, highlight, content, icon, pro, proTagBg }) => {
|
export const FeatureBlock = ({ vertical, highlight, content, icon, pro, proTagBg }) => {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ScrollView, View } from 'react-native';
|
import { ScrollView, View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { FeatureBlock } from './feature';
|
import { FeatureBlock } from './feature';
|
||||||
import { ProTag } from './pro-tag';
|
import { ProTag } from './pro-tag';
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { createRef } from 'react';
|
import React, { createRef } from 'react';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { eClosePremiumDialog, eOpenPremiumDialog } from '../../utils/Events';
|
import { eClosePremiumDialog, eOpenPremiumDialog } from '../../utils/events';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import { Component } from './component';
|
import { Component } from './component';
|
||||||
|
|
||||||
class PremiumDialog extends React.Component {
|
class PremiumDialog extends React.Component {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Text } from 'react-native';
|
import { Text } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const Offer = ({ off = '30', text = 'on yearly plan, offer ends soon', padding = 0 }) => {
|
export const Offer = ({ off = '30', text = 'on yearly plan, offer ends soon', padding = 0 }) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -5,14 +5,14 @@ import { useTracked } from '../../provider';
|
|||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import { dWidth, editing, getElevation } from '../../utils';
|
import { dWidth, editing, getElevation } from '../../utils';
|
||||||
import { eCloseActionSheet, eOpenPremiumDialog, eShowGetPremium } from '../../utils/Events';
|
import { eCloseActionSheet, eOpenPremiumDialog, eShowGetPremium } from '../../utils/events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import { EditorWebView } from '../../views/Editor/Functions';
|
import { EditorWebView } from '../../views/Editor/Functions';
|
||||||
import tiny from '../../views/Editor/tiny/tiny';
|
import tiny from '../../views/Editor/tiny/tiny';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const translatePrem = new Animated.Value(-dWidth);
|
export const translatePrem = new Animated.Value(-dWidth);
|
||||||
export const opacityPrem = new Animated.Value(0);
|
export const opacityPrem = new Animated.Value(0);
|
||||||
@@ -2,10 +2,10 @@ import React from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { getElevation } from '../../utils';
|
import { getElevation } from '../../utils';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { PressableButton } from '../PressableButton';
|
import { PressableButton } from '../ui/pressable';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const PricingItem = ({ product, onPress, compact }) => {
|
export const PricingItem = ({ product, onPress, compact }) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -11,18 +11,18 @@ import {
|
|||||||
eCloseProgressDialog,
|
eCloseProgressDialog,
|
||||||
eCloseSimpleDialog,
|
eCloseSimpleDialog,
|
||||||
eOpenLoginDialog
|
eOpenLoginDialog
|
||||||
} from '../../utils/Events';
|
} from '../../utils/events';
|
||||||
import { openLinkInBrowser } from '../../utils/functions';
|
import { openLinkInBrowser } from '../../utils/functions';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/size';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import { sleep } from '../../utils/time';
|
||||||
import umami from '../../utils/umami';
|
import umami from '../../utils/analytics';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../ui/button';
|
||||||
import { Dialog } from '../Dialog';
|
import { Dialog } from '../dialog';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../dialog/base-dialog';
|
||||||
import { presentDialog } from '../Dialog/functions';
|
import { presentDialog } from '../dialog/functions';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../ui/typography/heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
import { Walkthrough } from '../Walkthrough';
|
import { Walkthrough } from '../walkthroughs';
|
||||||
import { PricingItem } from './pricing-item';
|
import { PricingItem } from './pricing-item';
|
||||||
|
|
||||||
const promoCyclesMonthly = {
|
const promoCyclesMonthly = {
|
||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../ui/typography/paragraph';
|
||||||
|
|
||||||
export const ProTag = ({ width, size, background }) => {
|
export const ProTag = ({ width, size, background }) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user