From 944196899ab47f0900881bad1a6f8b084b010d7e Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Thu, 26 Dec 2024 08:18:40 +0100 Subject: [PATCH 1/5] feat: animate account refresh button Signed-off-by: Adam Setch --- src/renderer/routes/Accounts.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/renderer/routes/Accounts.tsx b/src/renderer/routes/Accounts.tsx index e906ce1a9..c66cf7894 100644 --- a/src/renderer/routes/Accounts.tsx +++ b/src/renderer/routes/Accounts.tsx @@ -153,9 +153,17 @@ export const AccountsRoute: FC = () => { type="button" className={cn(BUTTON_CLASS_NAME, 'px-0')} title={`Refresh ${account.user.login}`} - onClick={async () => { + onClick={async (e) => { + const button = e.currentTarget; + button.classList.add('animate-spin'); + await refreshAccount(account); navigate('/accounts', { replace: true }); + + // typically the above completes very quickly, so add an artificial delay to allow the spinner to do a few loops + setTimeout(() => { + button.classList.remove('animate-spin'); + }, 500); }} > Date: Thu, 26 Dec 2024 08:20:21 +0100 Subject: [PATCH 2/5] feat: animate account refresh button Signed-off-by: Adam Setch --- src/renderer/routes/Accounts.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/routes/Accounts.tsx b/src/renderer/routes/Accounts.tsx index c66cf7894..58d471844 100644 --- a/src/renderer/routes/Accounts.tsx +++ b/src/renderer/routes/Accounts.tsx @@ -160,7 +160,10 @@ export const AccountsRoute: FC = () => { await refreshAccount(account); navigate('/accounts', { replace: true }); - // typically the above completes very quickly, so add an artificial delay to allow the spinner to do a few loops + /** + * Typically the above refresh API call completes very quickly, + * so we add an brief artificial delay to allow the icon to spin a few times + */ setTimeout(() => { button.classList.remove('animate-spin'); }, 500); From f957752e8c0cc04d6a1a373e28f8f9627fd44578 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Thu, 26 Dec 2024 17:46:29 +0100 Subject: [PATCH 3/5] feat: animate account refresh button Signed-off-by: Adam Setch --- src/renderer/routes/Accounts.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/routes/Accounts.tsx b/src/renderer/routes/Accounts.tsx index 58d471844..01f8a0f91 100644 --- a/src/renderer/routes/Accounts.tsx +++ b/src/renderer/routes/Accounts.tsx @@ -166,7 +166,7 @@ export const AccountsRoute: FC = () => { */ setTimeout(() => { button.classList.remove('animate-spin'); - }, 500); + }, 250); }} > Date: Thu, 26 Dec 2024 17:48:32 +0100 Subject: [PATCH 4/5] feat: animate account refresh button Signed-off-by: Adam Setch --- .../__snapshots__/Accounts.test.tsx.snap | 126 +++++------------- 1 file changed, 37 insertions(+), 89 deletions(-) diff --git a/src/renderer/routes/__snapshots__/Accounts.test.tsx.snap b/src/renderer/routes/__snapshots__/Accounts.test.tsx.snap index a58979d0a..2ba0493f3 100644 --- a/src/renderer/routes/__snapshots__/Accounts.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Accounts.test.tsx.snap @@ -15,14 +15,12 @@ exports[`renderer/routes/Accounts.tsx General should render itself & its childre > @@ -40,13 +38,11 @@ exports[`renderer/routes/Accounts.tsx General should render itself & its childre >