Skip to content

Commit 41c14c8

Browse files
authored
Merge pull request #8699 from Couchers-org/na/chat-after-decline
Improve decline flow and add private feedback
2 parents 362ed22 + ceb786b commit 41c14c8

18 files changed

Lines changed: 1104 additions & 338 deletions

app/web/components/ConfirmationDialogWrapper.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface ConfirmationDialogWrapperProps {
1515
title: string;
1616
message: string;
1717
confirmButtonLabel?: string;
18+
cancelButtonLabel?: string;
1819
onConfirm: () => void;
1920
}
2021

@@ -23,6 +24,7 @@ export default function ConfirmationDialogWrapper({
2324
title,
2425
message,
2526
confirmButtonLabel,
27+
cancelButtonLabel,
2628
onConfirm,
2729
}: ConfirmationDialogWrapperProps) {
2830
const { t } = useTranslation();
@@ -42,7 +44,7 @@ export default function ConfirmationDialogWrapper({
4244
</DialogContent>
4345
<DialogActions>
4446
<Button variant="outlined" onClick={() => setIsOpen(false)}>
45-
{t("cancel")}
47+
{cancelButtonLabel ?? t("cancel")}
4648
</Button>
4749
<Button onClick={handleConfirm}>
4850
{confirmButtonLabel ? confirmButtonLabel : t("confirm")}

app/web/features/messages/constants.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,16 @@ export const requestStatusChangedMessageToTransKey = {
2626
[HostRequestStatus.HOST_REQUEST_STATUS_PENDING]: null,
2727
} as const;
2828

29+
export const requestStatusChangedMessageToSelfTransKey = {
30+
[HostRequestStatus.HOST_REQUEST_STATUS_ACCEPTED]:
31+
"control_message.host_request_status_changed.accepted_self",
32+
[HostRequestStatus.HOST_REQUEST_STATUS_CANCELLED]:
33+
"control_message.host_request_status_changed.cancelled_self",
34+
[HostRequestStatus.HOST_REQUEST_STATUS_CONFIRMED]:
35+
"control_message.host_request_status_changed.confirmed_self",
36+
[HostRequestStatus.HOST_REQUEST_STATUS_REJECTED]:
37+
"control_message.host_request_status_changed.rejected_self",
38+
[HostRequestStatus.HOST_REQUEST_STATUS_PENDING]: null,
39+
} as const;
40+
2941
export const MARK_LAST_SEEN_TIMEOUT = 500;

app/web/features/messages/groupchats/ChatContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import InfiniteMessageLoader from "features/messages/messagelist/InfiniteMessage
55
import MessageList from "features/messages/messagelist/MessageList";
66
import { GetGroupChatMessagesRes } from "proto/conversations_pb";
77
import { HostRequest } from "proto/requests_pb";
8+
import { ReactNode } from "react";
89

910
const StyledInfiniteMessageLoader = styled(InfiniteMessageLoader)(
1011
({ theme }) => ({
@@ -26,6 +27,7 @@ const ChatContent = ({
2627
hasNextPage,
2728
markLastSeen,
2829
isError,
30+
footer,
2931
}: {
3032
isHostRequest: boolean;
3133
isLoading: boolean;
@@ -36,6 +38,7 @@ const ChatContent = ({
3638
hasNextPage: boolean;
3739
markLastSeen: (messageId: number) => void;
3840
isError: boolean;
41+
footer?: ReactNode;
3942
}) => {
4043
if (isLoading) {
4144
return <CenteredSpinner minHeight="100%" />;
@@ -60,6 +63,7 @@ const ChatContent = ({
6063
markLastSeen={markLastSeen}
6164
messages={messages.pages.map((page) => page.messagesList).flat()}
6265
/>
66+
{footer}
6367
</StyledInfiniteMessageLoader>
6468
);
6569
};

app/web/features/messages/locales/en.json

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,44 @@
33
"mark_all_read_button_text_chats": "Mark all chats as read",
44
"mark_all_read_button_text_hosting": "Mark all host requests as read",
55
"mark_all_read_button_text_surfing": "Mark all surf requests as read",
6-
"request_closed_message": "This host request is closed. To continue chatting, send the other person a normal message.",
76
"write_reference_button_text": "Write a Reference",
8-
"close_request_dialog_title": "Are you done messaging?",
9-
"close_request_dialog_host": "Please make sure you are done chatting before you decline their request.",
10-
"close_request_dialog_surfer": "Please make sure you are done chatting before you cancel your request.",
7+
"reference_card": {
8+
"title": "Write a reference",
9+
"description": "Share your experience to help the community."
10+
},
1111
"close_request_button_text": "Decline",
12+
"respond_box_title": "Send a response",
13+
"respond_box_description": "Select a response to let {{name}} know immediately. Feel free to follow up with a message.",
14+
"status_bar_edit_button": "Edit",
15+
"status_bar_cancel_edit_button": "Cancel",
16+
"status_bar_close_button": "Close",
17+
"surfer_bar_pending": "You sent a host request — waiting for {{name}} to respond.",
18+
"cancel_request_button": "Cancel request",
19+
"cancel_request_dialog_title": "Cancel request?",
20+
"cancel_request_dialog_message": "Are you sure you want to cancel your request? This cannot be undone.",
21+
"cancel_request_dialog_confirm_button": "Yes, cancel",
22+
"cancel_request_dialog_dismiss_button": "No",
23+
"private_feedback_card": {
24+
"title": "Feedback on this request",
25+
"quality_label": "Privately rate this request (Optional):",
26+
"quality_high": "High quality",
27+
"quality_okay": "Okay",
28+
"quality_low": "Low quality",
29+
"decline_reason_label": "Why did you decline?",
30+
"reason_didnt_read_profile": "Didn't read my profile",
31+
"reason_dont_want_to_host": "I don't want to host this person",
32+
"reason_not_available": "I'm not available to host then",
33+
"reason_other": "Other",
34+
"reason_other_placeholder": "Please tell us more...",
35+
"privacy_notice": "Your responses are private and will not be shared with the user. We may use them in an aggregated and anonymous form—combined with many others—to improve feedback for all users.",
36+
"skip_button": "Skip",
37+
"next_button": "Next",
38+
"back_button": "Back",
39+
"submit_button": "Submit"
40+
},
1241
"confirm_request_button_text": "Confirm",
42+
"surfer_confirm_box_title": "{{name}} accepted your request!",
43+
"surfer_confirm_box_description": "Confirm to lock in your stay, or cancel if your plans have changed.",
1344
"host_pending_request_help_text": "<0>Things to consider</0> before responding.",
1445
"surfer_declined_request_help_text": "<0>Read our guide</0> on how to write a request that will get accepted.",
1546
"past_request_help_text": "This request is in the past, you can still send messages but cannot otherwise modify it.",
@@ -136,9 +167,13 @@
136167
"admin_removal_text": "{{user}} removed {{target_user}} as admin",
137168
"host_request_status_changed": {
138169
"accepted": "{{user}} has accepted the request",
170+
"accepted_self": "You have accepted the request",
139171
"cancelled": "{{user}} has cancelled the request",
172+
"cancelled_self": "You have cancelled the request",
140173
"confirmed": "{{user}} has confirmed the request",
141-
"rejected": "{{user}} has rejected the request"
174+
"confirmed_self": "You have confirmed the request",
175+
"rejected": "{{user}} has declined the request",
176+
"rejected_self": "You have declined the request"
142177
},
143178
"unknown_message_text": "Unknown control message"
144179
},
@@ -155,14 +190,15 @@
155190
"pending": "This request is still pending",
156191
"host_status": {
157192
"accepted": "You have accepted this request",
193+
"accepted_waiting": "You have accepted this request — waiting for the surfer to confirm.",
158194
"cancelled": "You have cancelled this request",
159-
"confirmed": "You have confirmed this request",
195+
"confirmed": "Have fun! You have accepted and the surfer has confirmed this request.",
160196
"rejected": "You have declined this request"
161197
},
162198
"surfer_status": {
163-
"accepted": "Your request was accepted",
199+
"accepted": "Have fun! {{name}} has accepted the request.",
164200
"cancelled": "Your request was cancelled",
165-
"confirmed": "Your request was confirmed",
201+
"confirmed": "Have fun! {{name}} accepted and you confirmed this request.",
166202
"rejected": "Your request was declined"
167203
}
168204
},

app/web/features/messages/messagelist/ControlMessageView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Skeleton, styled } from "@mui/material";
22
import TextBody from "components/TextBody";
3+
import { useAuthContext } from "features/auth/AuthProvider";
34
import { useLiteUser } from "features/userQueries/useLiteUsers";
45
import { useTranslation } from "i18n";
56
import { MESSAGES } from "i18n/namespaces";
@@ -35,6 +36,7 @@ export default function ControlMessageView({
3536
className,
3637
}: MessageProps) {
3738
const { t } = useTranslation(MESSAGES);
39+
const { authState } = useAuthContext();
3840
const { data: author, isLoading: isAuthorLoading } = useLiteUser(
3941
message.authorUserId,
4042
);
@@ -64,6 +66,7 @@ export default function ControlMessageView({
6466
user: authorName,
6567
target_user: targetName,
6668
t,
69+
isCurrentUser: message.authorUserId === authState.userId,
6770
})}
6871
</TextBody>
6972
) : (

0 commit comments

Comments
 (0)