diff --git a/src/apis/user_api.ts b/src/apis/user_api.ts index 86be014..b24f264 100644 --- a/src/apis/user_api.ts +++ b/src/apis/user_api.ts @@ -1,4 +1,5 @@ export interface UserApi { getUserPointer: (email: string, token: string) => Promise advanceUserPointer: (email: string, token: string) => Promise + reverseUserPointer: (email: string, token: string) => Promise } diff --git a/src/apis/user_api_impl.ts b/src/apis/user_api_impl.ts index a750ab5..b703f72 100644 --- a/src/apis/user_api_impl.ts +++ b/src/apis/user_api_impl.ts @@ -29,4 +29,18 @@ export class UserApiImpl implements UserApi { const json = await response.json() return json.data.current_pointer } + + async reverseUserPointer(email: string, token: string): Promise { + const response = await fetch(getUrl("/user/pointer/reverse"), { + method: 'PATCH', + body: JSON.stringify({ + email, + }), + headers: { + 'x-access-token': token, + } + }) + const json = await response.json() + return json.data.current_pointer + } } diff --git a/src/components/app_nav.tsx b/src/components/app_nav.tsx index 0a4ca72..32d2ad4 100644 --- a/src/components/app_nav.tsx +++ b/src/components/app_nav.tsx @@ -54,7 +54,7 @@ export const AppNav = () => { background: (router.route === '/' || router.route === '/surahs/[id]') ? 'gainsboro' : 'none' }} > - Koran + koran     @@ -64,7 +64,7 @@ export const AppNav = () => { background: router.pathname === '/bookmark' ? 'gainsboro' : 'none' }} > - Bookmark + bookmark     @@ -74,7 +74,7 @@ export const AppNav = () => { background: router.pathname === '/favs' ? 'gainsboro' : 'none' }} > - Favorite + favorite diff --git a/src/pages/bookmark.tsx b/src/pages/bookmark.tsx index ef298fa..ff016d9 100644 --- a/src/pages/bookmark.tsx +++ b/src/pages/bookmark.tsx @@ -114,7 +114,7 @@ export default function BookmarkPage() { textDecoration: isFav ? undefined : "underline" }} > - {!isFav ? "favorite" :
❤️
} + {!isFav ? "🩶" : "❤️"} ) } @@ -129,7 +129,7 @@ export default function BookmarkPage() { }) }} > - {bookmarkSettings.hideVerse ? "show" : "hide"} verse + {bookmarkSettings.hideVerse ? "🛐" : "☪️"} ) } @@ -144,7 +144,7 @@ export default function BookmarkPage() { }) }} > - {bookmarkSettings.hideTranslation ? "show" : "hide"} translation + {bookmarkSettings.hideTranslation ? "📕" : "📖"} ) } @@ -178,7 +178,42 @@ export default function BookmarkPage() { justifyContent: 'right' }} > - Next + next + + + ) + } + + const renderReverse = () => { + return ( + <> + + ) @@ -216,10 +251,23 @@ export default function BookmarkPage() {
- {renderNext()} +
+ {renderReverse()} +
+
+ {renderNext()} +
) diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index d1503fe..6c380b8 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -54,7 +54,7 @@ export default function ProfilePage() { paddingRight: 0, }} > - Logout + logout )