Skip to content

Commit 3625dfd

Browse files
committed
Unsubscribe page updated
1 parent edae79a commit 3625dfd

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

RELEASE_NOTES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
### ✨ Features
22

3+
- Unsubscribe page updated.
34
- New features and improvements.
45

56
### 🐛 Bug Fixes
67

7-
- Unsubscribe link bug fixed.
88
- Various bug fixes and optimizations.
99

1010
### 📚 Docs
1111

12-
See the latest documentation at [https://docs.letterspace.app](https://docs.letterspace.app).
12+
See the latest documentation at [docs.letterspace.app](https://docs.letterspace.app).
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export function UnsubscribePage() {
1414
const subscriberId = searchParams.get("sid")
1515
const campaignId = searchParams.get("cid")
1616

17-
const unsubscribeUser = trpc.subscriber.unsubscribe.useMutation({
17+
const {
18+
mutate: unsubscribeUser,
19+
isSuccess,
20+
isPending,
21+
} = trpc.subscriber.unsubscribe.useMutation({
1822
onError: (error) => {
1923
setError(error.message)
2024
},
@@ -36,10 +40,10 @@ export function UnsubscribePage() {
3640
}
3741

3842
const handleUnsubscribe = () => {
39-
unsubscribeUser.mutate({ sid: subscriberId, cid: campaignId })
43+
unsubscribeUser({ sid: subscriberId, cid: campaignId })
4044
}
4145

42-
if (unsubscribeUser.isSuccess) {
46+
if (isSuccess) {
4347
return (
4448
<PageWrapper>
4549
<div className="flex justify-center">
@@ -71,6 +75,8 @@ export function UnsubscribePage() {
7175
<Button
7276
onClick={handleUnsubscribe}
7377
variant="destructive"
78+
disabled={isPending}
79+
loading={isPending}
7480
className="w-full bg-red-500 hover:bg-red-600"
7581
>
7682
<MailX className="w-4 h-4 mr-2" />
@@ -94,11 +100,11 @@ const PageWrapper = ({ children }: { children: React.ReactNode }) => (
94100
<footer className="mt-8 text-sm text-gray-500">
95101
<Link
96102
to={constants.GITHUB_URL}
97-
className="flex items-center hover:text-gray-300 transition-colors"
103+
className="flex items-center hover:text-gray-300 transition-colors gap-1"
98104
target="_blank"
99105
rel="noopener noreferrer"
100106
>
101-
<IconBrandGithub className="w-4 h-4 mr-2" />
107+
<IconBrandGithub className="w-4 h-4" />
102108
Powered by <LetterSpaceText as="span" />
103109
</Link>
104110
</footer>

apps/web/src/pages/unsubscribe/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.4",
2+
"version": "0.4.5",
33
"name": "letterspace",
44
"private": true,
55
"scripts": {

0 commit comments

Comments
 (0)