Skip to content

Commit 0636835

Browse files
committed
needHelpWithYourIssue, askADoctor
1 parent 9e39303 commit 0636835

File tree

3 files changed

+29
-39
lines changed

3 files changed

+29
-39
lines changed

messages/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
},
77
"Feedback": {
88
"helpMessage": "Help OpenHealth solve health problems for you and many others",
9-
"shareFeedback": "Share Feedback"
9+
"shareFeedback": "Share Feedback",
10+
"needHelpWithYourIssue": "Need Help with Your Issue?",
11+
"askADoctor": "Ask a Doctor"
1012
},
1113
"ChatSideBar": {
1214
"sources": "Sources",

messages/ko.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
},
77
"Feedback": {
88
"helpMessage": "오픈헬스를 도와 당신의 건강문제와 더 많은 사람들의 건강문제를 해결할 수 있도록 해주세요",
9-
"shareFeedback": "피드백 남기기"
9+
"shareFeedback": "피드백 남기기",
10+
"needHelpWithYourIssue": "문제 해결이 필요하신가요?",
11+
"askADoctor": "의사에게 문의"
1012
},
1113
"ChatSideBar": {
1214
"sources": "소스",

src/app/chat/[id]/screen.tsx

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {ChatRole} from "@prisma/client";
1616
import ChatSettingSideBar from "@/components/chat/chat-setting-side-bar";
1717
import {useTranslations} from "next-intl";
1818
import {NavLinks} from "@/components/ui/nav-links";
19+
import {useSession} from "next-auth/react";
1920

2021
interface ScreenProps {
2122
isMobile: boolean;
@@ -25,6 +26,7 @@ export default function Screen(
2526
{isMobile}: ScreenProps
2627
) {
2728
const {id} = useParams<{ id: string }>();
29+
const {data: auth} = useSession()
2830
const t = useTranslations('Chat')
2931
const tf = useTranslations('Feedback')
3032

@@ -35,20 +37,13 @@ export default function Screen(
3537
const [isJsonViewerOpen, setIsJsonViewerOpen] = useState(false);
3638
const [isLeftSidebarOpen, setIsLeftSidebarOpen] = useState(!isMobile);
3739
const [isRightSidebarOpen, setIsRightSidebarOpen] = useState(!isMobile);
38-
const [showFeedbackBanner, setShowFeedbackBanner] = useState<boolean>();
3940

4041
const {data, mutate} = useSWR<ChatMessageListResponse>(`/api/chat-rooms/${id}/messages`, async (url: string) => {
4142
const response = await fetch(url);
4243
return response.json();
4344
});
4445
const messages = useMemo(() => data?.chatMessages || [], [data]);
4546

46-
useEffect(() => {
47-
if (showFeedbackBanner === undefined) {
48-
setShowFeedbackBanner(!localStorage.getItem('feedbackBannerClosed'));
49-
}
50-
}, [showFeedbackBanner]);
51-
5247
useEffect(() => {
5348
if (messagesEndRef.current) {
5449
messagesEndRef.current.scrollIntoView({behavior: 'smooth'});
@@ -108,11 +103,6 @@ export default function Screen(
108103
}
109104
};
110105

111-
const handleCloseFeedbackBanner = () => {
112-
setShowFeedbackBanner(false);
113-
localStorage.setItem('feedbackBannerClosed', 'true');
114-
};
115-
116106
return (
117107
<div className="h-screen flex flex-col">
118108
<div className="bg-white dark:bg-zinc-900 border-b h-14 flex items-center px-4 shrink-0">
@@ -151,32 +141,28 @@ export default function Screen(
151141
))}
152142
<div ref={messagesEndRef}/>
153143
</div>
154-
<div className="border-t mb-16 md:mb-0">
155-
{showFeedbackBanner && (
156-
<div className="p-4 bg-blue-50 flex items-center justify-between">
157-
<div className="text-sm text-blue-800 flex-1 pr-4">
158-
<p>{tf('helpMessage')}</p>
159-
</div>
160-
<div className="flex gap-2 items-center shrink-0">
161-
<Button
162-
variant="outline"
163-
size="sm"
164-
className="text-blue-600 border-blue-200 hover:bg-blue-100"
165-
onClick={() => window.open('https://tally.so/r/3xl2GE', '_blank')}
166-
>
167-
{tf('shareFeedback')}
168-
</Button>
169-
<Button
170-
variant="ghost"
171-
size="default"
172-
className="h-8 w-8 text-gray-500 hover:text-gray-700"
173-
onClick={handleCloseFeedbackBanner}
174-
>
175-
176-
</Button>
177-
</div>
144+
<div className="mb-16 md:mb-0">
145+
<div className="p-4 flex items-center justify-between">
146+
<div className="text-sm text-blue-800 flex-1 pr-4"/>
147+
<div className="flex gap-2 items-center shrink-0">
148+
<Button
149+
variant="outline"
150+
size="sm"
151+
className="text-blue-600 border-blue-200 hover:bg-blue-100"
152+
onClick={() => window.open('https://openhealthforall.channel.io', '_blank')}
153+
>
154+
{tf('needHelpWithYourIssue')}
155+
</Button>
156+
<Button
157+
variant="outline"
158+
size="sm"
159+
className="text-blue-600 border-blue-200 hover:bg-blue-100"
160+
onClick={() => window.open(`https://tally.so/r/mDZrYq?user_id=${auth?.user?.id}`, '_blank')}
161+
>
162+
{tf('askADoctor')}
163+
</Button>
178164
</div>
179-
)}
165+
</div>
180166
<div className="border-t p-4 z-10 md:static fixed bottom-0 left-0 w-full bg-white">
181167
<div className="flex gap-2">
182168
<Input

0 commit comments

Comments
 (0)