minor fixes

This commit is contained in:
ammarahm-ed
2020-02-12 03:24:36 +05:00
parent 65d252e641
commit 377b192f8a
12 changed files with 59 additions and 37 deletions

View File

@@ -184,7 +184,7 @@ export const ActionSheetComponent = ({
}, },
{ {
name: 'Share', name: 'Share',
icon: 'share-2', icon: 'share-variant',
func: () => { func: () => {
if (note.locked) { if (note.locked) {
close('unlock_share'); close('unlock_share');
@@ -202,7 +202,7 @@ export const ActionSheetComponent = ({
}, },
{ {
name: 'Export', name: 'Export',
icon: 'external-link', icon: 'export',
func: () => { func: () => {
close(); close();
}, },
@@ -501,7 +501,7 @@ export const ActionSheetComponent = ({
width: '100%', width: '100%',
paddingHorizontal: 0, paddingHorizontal: 0,
}}> }}>
{!note.id ? ( {!note.id && !note.dateCreated ? (
<Text <Text
style={{ style={{
width: '100%', width: '100%',
@@ -626,7 +626,7 @@ export const ActionSheetComponent = ({
</View> </View>
)} )}
{note.id ? ( {note.id || note.dateCreated ? (
<View <View
style={{ style={{
width: '100%', width: '100%',
@@ -657,7 +657,7 @@ export const ActionSheetComponent = ({
</View> </View>
) : null} ) : null}
{hasTags && note.id ? ( {hasTags && (note.id || note.dateCreated) ? (
<View <View
style={{ style={{
marginHorizontal: 12, marginHorizontal: 12,

View File

@@ -24,8 +24,7 @@ export class AddTopicDialog extends React.Component {
if (!this.title) if (!this.title)
return ToastEvent.show('Title is required', 'error', 3000, () => {}, ''); return ToastEvent.show('Title is required', 'error', 3000, () => {}, '');
await db.notebooks.notebook(this.props.notebookID).topics.add(this.title); await db.notebooks.notebook(this.props.notebookID).topics.add(this.title),
eSendEvent(eOnNewTopicAdded); eSendEvent(eOnNewTopicAdded);
ToastEvent.show('New topic added', 'success', 3000, () => {}, ''); ToastEvent.show('New topic added', 'success', 3000, () => {}, '');
this.close(); this.close();

View File

@@ -101,7 +101,7 @@ export const TEMPLATE_DELETE = type => {
positiveText: 'Delete', positiveText: 'Delete',
negativeText: 'Cancel', negativeText: 'Cancel',
action: dialogActions.ACTION_DELETE, action: dialogActions.ACTION_DELETE,
icon: 'trash', icon: 'delete',
}; };
}; };
@@ -112,7 +112,7 @@ export const TEMPLATE_TRASH = type => {
positiveText: 'Restore', positiveText: 'Restore',
negativeText: 'Delete', negativeText: 'Delete',
action: dialogActions.ACTION_TRASH, action: dialogActions.ACTION_TRASH,
icon: 'trash', icon: 'delete-restore',
}; };
}; };
@@ -123,7 +123,7 @@ export const TEMPLATE_EXIT_FULLSCREEN = () => {
positiveText: 'Exit', positiveText: 'Exit',
negativeText: 'Cancel', negativeText: 'Cancel',
action: dialogActions.ACTION_EXIT_FULLSCREEN, action: dialogActions.ACTION_EXIT_FULLSCREEN,
icon: 'x', icon: 'close',
}; };
}; };
@@ -134,7 +134,7 @@ export const TEMPLATE_EXIT = type => {
positiveText: `Close`, positiveText: `Close`,
negativeText: 'Cancel', negativeText: 'Cancel',
action: dialogActions.ACTION_EXIT, action: dialogActions.ACTION_EXIT,
icon: 'x', icon: 'close',
}; };
}; };
@@ -147,14 +147,14 @@ export const TEMPLATE_INFO = dateCreated => {
noButtons: true, noButtons: true,
noTitle: true, noTitle: true,
action: dialogActions.ACTION_CLOSE, action: dialogActions.ACTION_CLOSE,
icon: 'info', icon: 'information-outline',
}; };
}; };
export const TEMPLATE_EMPTY_TRASH = { export const TEMPLATE_EMPTY_TRASH = {
title: 'Empty Trash', title: 'Empty Trash',
paragraph: 'Are you sure you want to clear the trash?', paragraph: 'Are you sure you want to clear the trash?',
icon: 'trash', icon: 'delete-outline',
positiveText: 'Clear', positiveText: 'Clear',
negativeText: 'Cancel', negativeText: 'Cancel',
action: dialogActions.ACTION_EMPTY_TRASH, action: dialogActions.ACTION_EMPTY_TRASH,

View File

@@ -29,7 +29,7 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager'; import {eSendEvent} from '../../services/eventManager';
import {eOpenModalMenu, eSendSideMenuOverlayRef} from '../../services/events'; import {eOpenModalMenu, eSendSideMenuOverlayRef} from '../../services/events';
import NavigationService from '../../services/NavigationService'; import NavigationService from '../../services/NavigationService';
import {timeSince} from '../../utils/utils'; import {timeSince, getElevation} from '../../utils/utils';
export const Menu = ({ export const Menu = ({
close = () => {}, close = () => {},
@@ -540,7 +540,7 @@ export const Menu = ({
))} ))}
</View> </View>
{user && user.username ? ( {!user && !user.username ? (
<View <View
style={{ style={{
width: '100%', width: '100%',
@@ -562,6 +562,8 @@ export const Menu = ({
onPress={async () => { onPress={async () => {
//await db.sync(); //await db.sync();
console.log(await db.sync(), 'SYNCED'); console.log(await db.sync(), 'SYNCED');
dispatch({type: ACTIONS.NOTES});
dispatch({type: ACTIONS.PINNED});
}} }}
style={{ style={{
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
@@ -619,19 +621,23 @@ export const Menu = ({
}} }}
activeOpacity={opacity / 2} activeOpacity={opacity / 2}
style={{ style={{
...getElevation(2),
paddingVertical: pv + 5, paddingVertical: pv + 5,
paddingHorizontal: noTextMode ? 0 : 12,
width: '100%', width: '100%',
justifyContent: noTextMode ? 'center' : 'flex-start', justifyContent: noTextMode ? 'center' : 'flex-start',
alignItems: 'center', alignItems: 'center',
flexDirection: 'row', flexDirection: 'row',
backgroundColor: colors.accent,
borderRadius: 5,
paddingHorizontal: 6,
}}> }}>
<Icon <Icon
style={{ style={{
minWidth: 40, minWidth: 40,
textAlign: 'left',
}} }}
name="log-in" name="login"
color={colors.accent} color="white"
size={SIZE.lg} size={SIZE.lg}
/> />
@@ -639,10 +645,10 @@ export const Menu = ({
<Text <Text
style={{ style={{
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: colors.accent, color: 'white',
fontSize: SIZE.md, fontSize: SIZE.md,
}}> }}>
{' '}Login Login
</Text> </Text>
)} )}
</TouchableOpacity> </TouchableOpacity>

View File

@@ -276,7 +276,7 @@ export default class NoteItem extends React.Component {
isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'], isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'],
); );
}}> }}>
<Icon name="more-horizontal" size={SIZE.lg} color={colors.icon} /> <Icon name="dots-horizontal" size={SIZE.lg} color={colors.icon} />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>

View File

@@ -233,7 +233,7 @@ export const NotebookItem = ({
notebookID: notebookID, notebookID: notebookID,
}); });
}}> }}>
<Icon name="more-horizontal" size={SIZE.lg} color={colors.icon} /> <Icon name="dots-horizontal" size={SIZE.lg} color={colors.icon} />
</TouchableOpacity> </TouchableOpacity>
)} )}

View File

@@ -17,6 +17,7 @@ import {ToastEvent} from '../../utils/utils';
import {NotesPlaceHolder} from '../ListPlaceholders'; import {NotesPlaceHolder} from '../ListPlaceholders';
import NoteItem from '../NoteItem'; import NoteItem from '../NoteItem';
import SelectionWrapper from '../SelectionWrapper'; import SelectionWrapper from '../SelectionWrapper';
import {db} from '../../../App';
export const NotesList = ({isGrouped = false}) => { export const NotesList = ({isGrouped = false}) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
@@ -24,6 +25,7 @@ export const NotesList = ({isGrouped = false}) => {
const notes = [...state.notes]; const notes = [...state.notes];
const searchResults = [...state.searchResults]; const searchResults = [...state.searchResults];
const [refreshing, setRefreshing] = useState(false); const [refreshing, setRefreshing] = useState(false);
const _renderItem = ({item, index}) => ( const _renderItem = ({item, index}) => (
<SelectionWrapper <SelectionWrapper
index={index} index={index}
@@ -191,12 +193,20 @@ export const NotesList = ({isGrouped = false}) => {
tintColor={colors.accent} tintColor={colors.accent}
colors={[colors.accent]} colors={[colors.accent]}
progressViewOffset={165} progressViewOffset={165}
onRefresh={() => { onRefresh={async () => {
setRefreshing(true); setRefreshing(true);
setTimeout(() => { try {
await db.sync();
dispatch({type: ACTIONS.NOTES});
dispatch({type: ACTIONS.PINNED});
dispatch({type: ACTIONS.FAVORITES});
setRefreshing(false); setRefreshing(false);
ToastEvent.show('Sync Complete', 'success'); ToastEvent.show('Sync Complete', 'success');
}, 1000); } catch (e) {
setRefreshing(false);
ToastEvent.show('Sync failed, network error', 'error');
}
}} }}
refreshing={refreshing} refreshing={refreshing}
/> />
@@ -258,13 +268,13 @@ const PinnedItems = () => {
customStyle={{ customStyle={{
backgroundColor: colors.shade, backgroundColor: colors.shade,
width: '100%', width: '100%',
paddingHorizontal: '5%',
paddingTop: 20,
marginHorizontal: 0,
marginBottom: 10,
paddingHorizontal: 12, paddingHorizontal: 12,
paddingTop: 20,
paddingRight: 18,
marginBottom: 10,
marginTop: 20, marginTop: 20,
borderBottomWidth: 0, borderBottomWidth: 0,
marginHorizontal: 0,
}} }}
pinned={true} pinned={true}
item={item} item={item}

View File

@@ -421,7 +421,7 @@ const Editor = ({navigation, noMenu}) => {
paddingRight: 12, paddingRight: 12,
zIndex: 800, zIndex: 800,
}}> }}>
<Icon name="more-horizontal" color={colors.icon} size={SIZE.xxxl} /> <Icon name="dots-horizontal" color={colors.icon} size={SIZE.xxxl} />
</TouchableOpacity> </TouchableOpacity>
</View> </View>

View File

@@ -42,6 +42,7 @@ export const Folders = ({navigation}) => {
}; };
useEffect(() => { useEffect(() => {
eSendEvent(eScrollEvent, 0);
dispatch({type: ACTIONS.NOTEBOOKS}); dispatch({type: ACTIONS.NOTEBOOKS});
let backhandler; let backhandler;

View File

@@ -11,6 +11,7 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager'; import {eSendEvent} from '../../services/eventManager';
import NavigationService from '../../services/NavigationService'; import NavigationService from '../../services/NavigationService';
import {SideMenuEvent} from '../../utils/utils'; import {SideMenuEvent} from '../../utils/utils';
import {eScrollEvent} from '../../services/events';
let count = 0; let count = 0;
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent( export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
SafeAreaView, SafeAreaView,
@@ -22,6 +23,7 @@ export const Home = ({navigation}) => {
const isFocused = useIsFocused(); const isFocused = useIsFocused();
useEffect(() => { useEffect(() => {
eSendEvent(eScrollEvent, 0);
dispatch({type: ACTIONS.COLORS}); dispatch({type: ACTIONS.COLORS});
dispatch({type: ACTIONS.NOTES}); dispatch({type: ACTIONS.NOTES});
}, [isFocused]); }, [isFocused]);

View File

@@ -29,16 +29,19 @@ export const Notebook = ({navigation}) => {
let isFocused = useIsFocused(); let isFocused = useIsFocused();
const onLoad = () => { const onLoad = () => {
topics = db.notebooks.notebook(navigation.state.params.notebook.dateCreated) let allTopics;
.topics;
notebook = db.notebooks.notebook(
navigation.state.params.notebook.dateCreated,
);
setTopics([...topics]); allTopics = db.notebooks.notebook(navigation.state.params.notebook.id).data
.topics;
console.log(allTopics);
notebook = db.notebooks.notebook(navigation.state.params.notebook.id);
setTopics(allTopics);
}; };
useEffect(() => { useEffect(() => {
eSendEvent(eScrollEvent, 0);
params = navigation.state.params; params = navigation.state.params;
let topic = params.notebook.topics; let topic = params.notebook.topics;
notebook = params.notebook; notebook = params.notebook;

View File

@@ -25,6 +25,7 @@ export const Notes = ({navigation}) => {
}, []); }, []);
useEffect(() => { useEffect(() => {
eSendEvent(eScrollEvent, 0);
if (params.type === 'tag') { if (params.type === 'tag') {
let notesInTag = db.notes.tagged(params.tag.title); let notesInTag = db.notes.tagged(params.tag.title);
setNotes([...notesInTag]); setNotes([...notesInTag]);