fix hook order error
This commit is contained in:
parent
74f903cc9f
commit
3d1c545892
@ -42,14 +42,14 @@ export default function Conversation() {
|
||||
{(!isPreviousMessageFromSameSender || !shouldGroupMessages) && (
|
||||
<div className="flex py-2 space-x-1 text-xs justify-center">
|
||||
<strong>
|
||||
{new Date(message.sentAt).toLocaleDateString("fr-FR", {
|
||||
{new Date(message.sentAt).toLocaleDateString("en-US", {
|
||||
weekday: "long",
|
||||
day: "2-digit",
|
||||
month: "short",
|
||||
})}
|
||||
</strong>
|
||||
<span>
|
||||
{new Date(message.sentAt).toLocaleTimeString("fr-FR", {
|
||||
{new Date(message.sentAt).toLocaleTimeString("en-US", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
|
@ -43,7 +43,7 @@ function formatMessageDate(date: Date): string {
|
||||
|
||||
const isToday = diff.days > -1;
|
||||
if (isToday) {
|
||||
return messageDate.toFormat("HH:mm", { locale: "fr-FR" });
|
||||
return messageDate.toFormat("HH:mm", { locale: "en-US" });
|
||||
}
|
||||
|
||||
const isDuringLastWeek = diff.days > -8;
|
||||
@ -51,5 +51,5 @@ function formatMessageDate(date: Date): string {
|
||||
return messageDate.weekdayLong;
|
||||
}
|
||||
|
||||
return messageDate.toFormat("dd/MM/yyyy", { locale: "fr-FR" });
|
||||
return messageDate.toFormat("dd/MM/yyyy", { locale: "en-US" });
|
||||
}
|
||||
|
@ -14,10 +14,11 @@ const ConversationPage: BlitzPage = () => {
|
||||
|
||||
const router = useRouter();
|
||||
const recipient = decodeURIComponent(router.params.recipient);
|
||||
const pageTitle = `Messages with ${recipient}`;
|
||||
const conversation = useConversation(recipient)[0];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Layout title={pageTitle} hideFooter>
|
||||
<header className="absolute top-0 w-screen h-12 backdrop-filter backdrop-blur-sm bg-white bg-opacity-75 border-b grid grid-cols-3 items-center">
|
||||
<span className="col-start-1 col-span-1 pl-2 cursor-pointer" onClick={router.back}>
|
||||
<FontAwesomeIcon size="lg" className="h-8 w-8" icon={faLongArrowLeft} />
|
||||
@ -31,18 +32,6 @@ const ConversationPage: BlitzPage = () => {
|
||||
<Suspense fallback={<div className="pt-12">Loading messages with {recipient}</div>}>
|
||||
<Conversation />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
ConversationPage.getLayout = function ConversationLayout(page) {
|
||||
const router = useRouter();
|
||||
const recipient = decodeURIComponent(router.params.recipient);
|
||||
const pageTitle = `Messages with ${recipient}`;
|
||||
|
||||
return (
|
||||
<Layout title={pageTitle} hideFooter>
|
||||
{page}
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ export default function PhoneCallsList() {
|
||||
return (
|
||||
<li key={phoneCall.id} className="flex flex-row justify-between py-2">
|
||||
<div>{recipient}</div>
|
||||
<div>{new Date(phoneCall.createdAt).toLocaleString("fr-FR")}</div>
|
||||
<div>{new Date(phoneCall.createdAt).toLocaleString("en-US")}</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
|
Loading…
Reference in New Issue
Block a user