From 3d141cbcdd9f20199a3ca0f027816f869b6042c8 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Thu, 5 Dec 2024 11:56:18 +0100 Subject: [PATCH 1/6] Use custom api url for external links --- src/components/MainList.tsx | 9 ++++++--- src/components/NavBar.tsx | 17 ++++++++++------- src/core/WakaTimeCore.ts | 20 ++++++++++---------- src/reducers/currentUser.ts | 5 +++-- src/utils/settings.ts | 18 ++++++++++++++++++ src/utils/user.ts | 23 +++++------------------ 6 files changed, 52 insertions(+), 40 deletions(-) diff --git a/src/components/MainList.tsx b/src/components/MainList.tsx index 3a84e60..879f177 100644 --- a/src/components/MainList.tsx +++ b/src/components/MainList.tsx @@ -6,6 +6,7 @@ import { userLogout } from '../reducers/currentUser'; import { ReduxSelector } from '../types/store'; import { User } from '../types/user'; import changeExtensionState from '../utils/changeExtensionStatus'; +import { getWebsiteUrl } from '../utils/settings'; export interface MainListProps { loggingEnabled: boolean; @@ -15,10 +16,10 @@ const openOptionsPage = async (): Promise => { await browser.runtime.openOptionsPage(); }; -export default function MainList({ +export default async function MainList({ loggingEnabled, totalTimeLoggedToday, -}: MainListProps): JSX.Element { +}: MainListProps): Promise { const dispatch = useDispatch(); const user: User | undefined = useSelector( @@ -53,6 +54,8 @@ export default function MainList({ ) : null; + const url = await getWebsiteUrl(); + return (
{user ? ( @@ -119,7 +122,7 @@ export default function MainList({ diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 05d1f88..305050d 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -2,8 +2,9 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { ReduxSelector } from '../types/store'; import { User } from '../types/user'; +import { getWebsiteUrl } from '../utils/settings'; -export default function NavBar(): JSX.Element { +export default async function NavBar(): Promise> { const user: User | undefined = useSelector( (selector: ReduxSelector) => selector.currentUser.user, ); @@ -20,13 +21,14 @@ export default function NavBar(): JSX.Element { } }; - const customRules = () => { + const customRules = async () => { if (user) { + const url = await getWebsiteUrl(); return (
  • @@ -40,13 +42,14 @@ export default function NavBar(): JSX.Element { } }; - const dashboard = () => { + const dashboard = async () => { if (user) { + const url = await getWebsiteUrl(); return (
  • @@ -84,8 +87,8 @@ export default function NavBar(): JSX.Element {
    {signedInAs()}
    ) : null; - const url = await getWebsiteUrl(); - return (
    {user ? ( @@ -122,7 +120,7 @@ export default async function MainList({ From 87d76c97cda5a50d28b00620f4104384d9251fcc Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Thu, 5 Dec 2024 12:36:27 +0100 Subject: [PATCH 4/6] bump v4.0.11 --- src/manifests/chrome.json | 2 +- src/manifests/edge.json | 2 +- src/manifests/firefox.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/manifests/chrome.json b/src/manifests/chrome.json index 574c74f..a18227c 100644 --- a/src/manifests/chrome.json +++ b/src/manifests/chrome.json @@ -33,5 +33,5 @@ "page": "options.html" }, "permissions": ["alarms", "tabs", "storage", "activeTab"], - "version": "4.0.10" + "version": "4.0.11" } diff --git a/src/manifests/edge.json b/src/manifests/edge.json index 7f9c219..cba4cf7 100644 --- a/src/manifests/edge.json +++ b/src/manifests/edge.json @@ -33,5 +33,5 @@ "page": "options.html" }, "permissions": ["alarms", "tabs", "storage", "activeTab"], - "version": "4.0.10" + "version": "4.0.11" } diff --git a/src/manifests/firefox.json b/src/manifests/firefox.json index dbabeb2..6b307f3 100644 --- a/src/manifests/firefox.json +++ b/src/manifests/firefox.json @@ -39,5 +39,5 @@ "page": "options.html" }, "permissions": ["alarms", "tabs", "storage", "activeTab"], - "version": "4.0.10" + "version": "4.0.11" } From 6e55a43cb5872e5ed1ce1e3f2485e8b0d949e320 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Thu, 5 Dec 2024 12:44:22 +0100 Subject: [PATCH 5/6] Fix bug in async react component --- src/components/NavBar.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 305050d..dfc46b4 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -2,9 +2,8 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { ReduxSelector } from '../types/store'; import { User } from '../types/user'; -import { getWebsiteUrl } from '../utils/settings'; -export default async function NavBar(): Promise> { +export default function NavBar(): JSX.Element { const user: User | undefined = useSelector( (selector: ReduxSelector) => selector.currentUser.user, ); @@ -21,9 +20,9 @@ export default async function NavBar(): Promise> { } }; - const customRules = async () => { + const customRules = () => { if (user) { - const url = await getWebsiteUrl(); + const url = 'https://wakatime.com'; return (
  • > { } }; - const dashboard = async () => { + const dashboard = () => { if (user) { - const url = await getWebsiteUrl(); + const url = 'https://wakatime.com'; return (
  • > {