Skip to content

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

fix tagged/colored notes page title

Ammar Ahmed099520ed14a4
diff --git a/apps/mobile/src/components/header/title.js b/apps/mobile/src/components/header/title.js
index 00f5eb29c..926324fa0 100644
--- a/apps/mobile/src/components/header/title.js
+++ b/apps/mobile/src/components/header/title.js
@@ -26,7 +26,7 @@ export const Title = () => {
? db.notebooks?.notebook(currentScreen.notebookId)?.data
: null;
const title = currentScreen.title;
- const isTag = title.slice(0, 1) === '#';
+ const isTag = currentScreen?.name === 'TaggedNotes';
const onScroll = data => {
if (currentScreen.name !== 'Notebook') {
@@ -97,7 +97,7 @@ export const Title = () => {
#
</Heading>
) : null}
- {isTag ? title.slice(1) : title}
+ {title}
</Heading>
) : null}
</View>
diff --git a/apps/mobile/src/screens/notes/colored.tsx b/apps/mobile/src/screens/notes/colored.tsx
index fe27e1f56..1c1ffeeb4 100644
--- a/apps/mobile/src/screens/notes/colored.tsx
+++ b/apps/mobile/src/screens/notes/colored.tsx
@@ -33,7 +33,7 @@ ColoredNotes.navigate = (item: ColorType, canGoBack: boolean) => {
{
name: 'ColoredNotes',
alias: toCamelCase(alias),
- title: item.title,
+ title: toCamelCase(item.title),
id: item.id,
type: 'color',
//@ts-ignore
diff --git a/apps/mobile/src/screens/notes/common.ts b/apps/mobile/src/screens/notes/common.ts
index 08377f09d..2a0e193c2 100644
--- a/apps/mobile/src/screens/notes/common.ts
+++ b/apps/mobile/src/screens/notes/common.ts
@@ -21,7 +21,7 @@ export function getAlias(params: NotesScreenParams) {
: item.type === 'color'
? db.colors?.alias(item.id)
: params?.title;
- return alias || '';
+ return alias || item.title;
}
export function openMonographsWebpage() {
diff --git a/apps/mobile/src/screens/notes/index.tsx b/apps/mobile/src/screens/notes/index.tsx
index c7c8db163..489d74ccf 100644
--- a/apps/mobile/src/screens/notes/index.tsx
+++ b/apps/mobile/src/screens/notes/index.tsx
@@ -86,16 +86,17 @@ const NotesPage = ({
const syncWithNavigation = () => {
const { item, title } = params.current;
//@ts-ignore
- let alias = getAlias({ item: item });
+ let alias = getAlias(params.current);
+ console.log(alias, title, 'syncWithNavigation', params.current);
useNavigationStore.getState().update(
{
name: route.name,
- title: title,
+ title: alias || title,
id: item?.id,
type: 'notes',
//@ts-ignore
notebookId: item?.notebookId,
- alias: toCamelCase(alias),
+ alias: route.name === 'ColoredNotes' ? toCamelCase(alias) : alias,
//@ts-ignore
color: item.type === 'color' ? item.title?.toLowerCase() : undefined
},
@@ -156,7 +157,10 @@ const NotesPage = ({
};
return (
- <DelayLayout wait={loading || loadingNotes}>
+ <DelayLayout
+ color={route.name === 'ColoredNotes' ? params.current?.item.title.toLowerCase() : undefined}
+ wait={loading || loadingNotes}
+ >
<List
listData={notes}
warning={warning ? WARNING_DATA : null}
@@ -166,8 +170,7 @@ const NotesPage = ({
screen="Notes"
headerProps={{
heading: params.current.title,
- color:
- params.current?.item?.type === 'color' ? params.current?.item.title.toLowerCase() : null
+ color: route.name === 'ColoredNotes' ? params.current?.item.title.toLowerCase() : null
}}
placeholderData={placeholderData}
/>
diff --git a/apps/mobile/src/screens/notes/tagged.tsx b/apps/mobile/src/screens/notes/tagged.tsx
index 9086e8919..8eabaa81c 100644
--- a/apps/mobile/src/screens/notes/tagged.tsx
+++ b/apps/mobile/src/screens/notes/tagged.tsx
@@ -32,7 +32,7 @@ TaggedNotes.navigate = (item: TagType, canGoBack: boolean) => {
Navigation.navigate<'TaggedNotes'>(
{
name: 'TaggedNotes',
- alias: '#' + alias,
+ alias: alias,
title: item.title,
id: item.id,
type: 'tag'
@@ -40,7 +40,7 @@ TaggedNotes.navigate = (item: TagType, canGoBack: boolean) => {
{
item: item,
canGoBack,
- title: '#' + alias
+ title: alias
}
);
};