Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

update note item ui

ammarahm-edf221cf827530
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 5942d9eb6..b0b5fa394 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -123,9 +123,7 @@ const NoteItem = ({item, isTrash, tags}) => {
fontSize={SIZE.xs + 1}
iconSize={SIZE.sm}
textStyle={{
- marginRight: 0,
- fontWeight: 'normal',
- fontFamily: null
+ marginRight: 0
}}
style={{
borderRadius: 5,
@@ -137,31 +135,6 @@ const NoteItem = ({item, isTrash, tags}) => {
onPress={() => navigateToTopic(_item.topic)}
/>
))}
- {!isTrash && tags
- ? tags.slice(0, 2)?.map(item => (
- <Button
- title={'#' + db.tags.alias(item)}
- key={item}
- height={20}
- textStyle={{
- marginRight: 0,
- fontWeight: 'normal',
- fontFamily: null
- }}
- type="grayBg"
- fontSize={SIZE.xs + 1}
- style={{
- borderRadius: 5,
- marginRight: 5,
- borderWidth: 0.5,
- borderColor: colors.icon,
- paddingHorizontal: 6,
- zIndex: 10
- }}
- onPress={() => navigateToTag(item)}
- />
- ))
- : null}
</View>
)}
@@ -196,11 +169,21 @@ const NoteItem = ({item, isTrash, tags}) => {
}}>
{!isTrash ? (
<>
+ {item.conflicted ? (
+ <Icon
+ name="alert-circle"
+ style={{
+ marginRight: 6
+ }}
+ size={SIZE.sm}
+ color={colors.red}
+ />
+ ) : null}
<TimeSince
style={{
fontSize: SIZE.xs + 1,
color: colors.icon,
- marginRight: 10
+ marginRight: 6
}}
time={item.dateCreated}
updateFrequency={
@@ -208,27 +191,13 @@ const NoteItem = ({item, isTrash, tags}) => {
}
/>
- {item.color ? (
- <View
- key={item}
- style={{
- width: SIZE.xs,
- height: SIZE.xs,
- borderRadius: 100,
- backgroundColor: COLORS_NOTE[item.color.toLowerCase()],
- marginRight: -4.5,
- marginRight: 10
- }}
- />
- ) : null}
-
{item.pinned ? (
<Icon
style={{marginRight: 10}}
name="pin"
size={SIZE.sm}
style={{
- marginRight: 5
+ marginRight: 6
}}
color={
COLORS_NOTE[item.color?.toLowerCase()] || colors.accent
@@ -242,7 +211,7 @@ const NoteItem = ({item, isTrash, tags}) => {
name="lock"
size={SIZE.sm}
style={{
- marginRight: 10
+ marginRight: 6
}}
color={colors.icon}
/>
@@ -253,35 +222,35 @@ const NoteItem = ({item, isTrash, tags}) => {
name="star"
size={SIZE.md}
style={{
- marginRight: 10
+ marginRight: 6
}}
color="orange"
/>
) : null}
- {item.conflicted ? (
- <View
- style={{
- marginRight: 10,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between'
- }}>
- <Icon
- name="alert-circle"
- size={SIZE.xs + 1}
- color={colors.red}
- />
- <Heading
- size={SIZE.xs}
- style={{
- color: colors.red,
- marginLeft: 2
- }}>
- CONFLICTS
- </Heading>
- </View>
- ) : null}
+ {!isTrash && !compactMode && tags
+ ? tags.slice(0, 3)?.map(item => (
+ <Button
+ title={'#' + db.tags.alias(item)}
+ key={item}
+ height={20}
+ type="gray"
+ textStyle={{
+ textDecorationLine: 'underline'
+ }}
+ hitSlop={{top: 8, bottom: 12, left: 0, right: 0}}
+ fontSize={SIZE.xs + 1}
+ style={{
+ borderRadius: 5,
+ paddingHorizontal: 2,
+ marginRight: 4,
+ zIndex: 10,
+ maxWidth: 120
+ }}
+ onPress={() => navigateToTag(item)}
+ />
+ ))
+ : null}
</>
) : (
<>
diff --git a/apps/mobile/src/utils/TimeUtils.js b/apps/mobile/src/utils/TimeUtils.js
index a8a8fe6f9..9c849dea7 100644
--- a/apps/mobile/src/utils/TimeUtils.js
+++ b/apps/mobile/src/utils/TimeUtils.js
@@ -1,33 +1,41 @@
+
export const sleep = (duration) =>
new Promise((resolve) => setTimeout(() => resolve(), duration));
export function timeSince(date) {
let seconds = Math.floor((new Date() - date) / 1000);
-
+ seconds = seconds + (86400 * 7 * 4);
let interval = Math.floor(seconds / 31536000);
if (interval > 0.9) {
- return interval < 2 ? interval + ' year ago' : interval + ' years ago';
+ return interval < 2 ? interval + 'yr ago' : interval + 'yr ago';
}
interval = Math.floor(seconds / 2592000);
if (interval > 0.9) {
- return interval < 2 ? interval + ' month ago' : interval + ' months ago';
+ return interval < 2 ? interval + 'mo ago' : interval + 'mo ago';
+ }
+
+ interval = Math.floor(seconds / (86400 * 7));
+ if (interval > 0.9) {
+ if (interval === 4) return "1mo ago";
+ return interval < 2 ? interval + 'w ago' : interval + 'w ago';
}
+
interval = Math.floor(seconds / 86400);
if (interval > 0.9) {
- return interval < 2 ? interval + ' day ago' : interval + ' days ago';
+ return interval < 2 ? interval + 'd ago' : interval + 'd ago';
}
interval = Math.floor(seconds / 3600);
if (interval > 0.9) {
- return interval < 2 ? interval + ' hour ago' : interval + ' hours ago';
+ return interval < 2 ? interval + 'h ago' : interval + 'h ago';
}
interval = Math.floor(seconds / 60);
if (interval > 0.9) {
- return interval < 2 ? interval + ' min ago' : interval + ' min ago';
+ return interval < 2 ? interval + 'm ago' : interval + 'm ago';
}
return Math.floor(seconds) < 0
- ? '0 secs ago'
- : Math.floor(seconds) + ' secs ago';
+ ? '0s ago'
+ : Math.floor(seconds) + 's ago';
}
export const timeConverter = (timestamp) => {