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

View File

@@ -24,8 +24,7 @@ export class AddTopicDialog extends React.Component {
if (!this.title)
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);
ToastEvent.show('New topic added', 'success', 3000, () => {}, '');
this.close();

View File

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

View File

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

View File

@@ -276,7 +276,7 @@ export default class NoteItem extends React.Component {
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>
</View>
</View>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,16 +29,19 @@ export const Notebook = ({navigation}) => {
let isFocused = useIsFocused();
const onLoad = () => {
topics = db.notebooks.notebook(navigation.state.params.notebook.dateCreated)
.topics;
notebook = db.notebooks.notebook(
navigation.state.params.notebook.dateCreated,
);
let allTopics;
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(() => {
eSendEvent(eScrollEvent, 0);
params = navigation.state.params;
let topic = params.notebook.topics;
notebook = params.notebook;

View File

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