Skip to content

Commit cf1b50f

Browse files
committed
Merge branch 'feature/translate-to-spanish' into feature/improve-toast-ux
2 parents 9d53835 + 23bdd8c commit cf1b50f

40 files changed

+1162
-515
lines changed

app/[locale]/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ export default async function LocaleLayout({
2727
return (
2828
<>
2929
<Script
30+
id='clarity-script'
3031
strategy='afterInteractive'
3132
dangerouslySetInnerHTML={{
3233
__html: `
33-
<script type="text/javascript">
3434
(function(c,l,a,r,i,t,y){
3535
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
3636
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
3737
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
3838
})(window, document, "clarity", "script", "sk0lq3aio2");
39-
</script>
4039
`,
4140
}}
4241
/>

app/[locale]/report-bugs/page.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import { YourEntityRequests } from "@/components/your-entity-requests";
1111
import ReportBugsForm from "./report-bugs-form";
1212
import { BugReportCreate } from "@/types";
1313
import AwardByReportingBugs from "@/components/award-by-reporting-bugs";
14+
import { getTranslations } from "next-intl/server";
1415

1516
export async function generateMetadata({
1617
params
1718
}: {params: any}): Promise<Metadata>{
19+
const t = await getTranslations("reportBugs");
1820
return {
19-
title: `Report Bugs | ${config.brandName}`
21+
title: `${t("pageTitle")} | ${config.brandName}`
2022
}
2123
}
2224

@@ -43,20 +45,22 @@ const ReportBugsPage = async() => {
4345
const resp = await reportBug(data, timezone);
4446
return resp;
4547
}
48+
const t = await getTranslations("reportBugs");
49+
4650
return (
4751
<div className="flex flex-col min-h-screen bg-gray-50 dark:bg-gradient-to-br dark:from-gray-900 dark:via-gray-900 dark:to-gray-950">
4852
<Toaster position="bottom-center" />
49-
<Header title="Report Bugs" />
53+
<Header title={t("pageTitle")} />
5054
<main className="flex-grow relative flex flex-col-reverse md:flex-row gap-5 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-4">
51-
55+
5256
<div className="md:max-w-3xl mx-auto w-full flex-1 flex flex-col gap-5">
53-
<ReportBugsForm handleReport={handleReport} />
54-
55-
<YourEntityRequests title="Bugs Reports" requests={bugsReported} type="reports" />
57+
<ReportBugsForm handleReport={handleReport} />
58+
59+
<YourEntityRequests title={t("bugsReportsTitle")} requests={bugsReported} type="reports" />
5660
</div>
5761
<div className="flex flex-col gap-3 sticky md:h-80 w-full md:w-72 lg:w-96 ">
5862
<AwardByReportingBugs/>
59-
63+
6064
</div>
6165
</main>
6266
</div>

app/[locale]/settings/layout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ import { SettingsSidebar } from "@/components/navigation/settings-sidebar";
66
import { BLACK_BACKGROUND } from "@/lib/colors";
77
import { cn } from "@/lib/utils";
88
import type React from "react";
9+
import { useTranslations } from "next-intl";
910

1011
export default function SettingsLayout({
1112
children,
1213
}: {
1314
children: React.ReactNode;
1415
}) {
16+
const t = useTranslations("settings");
1517
return (
1618
<div className="flex-1 flex flex-col" suppressHydrationWarning>
17-
<Header title="Settings" />
19+
<Header title={t("title")} />
1820
<div className={cn("hidden md:max-w-7xl md:w-full md:block mx-auto relative px-4 sm:px-6 lg:px-8 ")}>
1921

2022

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,76 @@
1-
import { config } from "@/config/environment";
2-
import { getUser } from "@/services/auth";
3-
import { Metadata } from "next";
4-
import { redirect } from "next/navigation";
1+
import {
2+
getFeaturesSuggestedByUser,
3+
suggestFeature,
4+
} from "@/services/user-feedback";
5+
6+
import AwardBySupporting from "@/components/award-by-supporting";
57
import FeatureRequestForm from "./feature-request-form";
6-
import Header from "@/components/header";
78
import { FeatureSuggestCreate } from "@/types";
8-
import { getFeaturesSuggestedByUser, suggestFeature } from "@/services/user-feedback";
9-
import { Toaster } from "react-hot-toast";
10-
import { unstable_cache } from "next/cache";
11-
import AwardBySupporting from "@/components/award-by-supporting";
129
import FoundBugQuestion from "@/components/found-bug-question";
10+
import Header from "@/components/header";
11+
import { Metadata } from "next";
12+
import SuggestFeaturesHeader from "@/components/suggest-features-header";
13+
import { Toaster } from "react-hot-toast";
1314
import { YourEntityRequests } from "@/components/your-entity-requests";
15+
import { config } from "@/config/environment";
16+
import { getUser } from "@/services/auth";
17+
import { redirect } from "next/navigation";
18+
import { unstable_cache } from "next/cache";
19+
import { useTranslations } from "next-intl";
1420

1521
export async function generateMetadata({
16-
params,
22+
params,
1723
}: {
18-
params: any;
24+
params: any;
1925
}): Promise<Metadata> {
20-
return {
21-
title: `Suggest Features | ${config.brandName}`,
22-
};
26+
return {
27+
title: `Suggest Features | ${config.brandName}`,
28+
};
2329
}
2430

25-
26-
27-
2831
const SuggestFeatures = async () => {
29-
const user = await getUser();
30-
if (!user) return redirect("/");
31-
32-
const getFeatures = unstable_cache(
33-
async (user) => {
34-
return getFeaturesSuggestedByUser(user);
35-
},
36-
[user._id.toString()],
37-
{
38-
tags: ["features-suggestions"],
39-
}
40-
);
32+
const user = await getUser();
33+
if (!user) return redirect("/");
4134

35+
const getFeatures = unstable_cache(
36+
async (user) => {
37+
return getFeaturesSuggestedByUser(user);
38+
},
39+
[user._id.toString()],
40+
{
41+
tags: ["features-suggestions"],
42+
}
43+
);
4244

43-
const featuresSuggested = await getFeatures(user);
45+
const featuresSuggested = await getFeatures(user);
4446

45-
46-
const handleSuggest = async(data: FeatureSuggestCreate, timezone: string) =>{
47-
"use server";
48-
const resp = await suggestFeature(data, timezone);
49-
return resp;
50-
}
51-
return (
52-
<div className="flex flex-col min-h-screen bg-gray-50 dark:bg-gradient-to-br dark:from-gray-900 dark:via-gray-900 dark:to-gray-950">
53-
<Toaster position="bottom-center" />
54-
<Header title="Suggest Features" />
55-
<main className="flex-grow relative flex flex-col-reverse md:flex-row gap-5 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-4">
56-
57-
<div className="md:max-w-3xl mx-auto w-full flex-1 flex flex-col gap-5">
58-
<FeatureRequestForm handleSuggest={handleSuggest} />
59-
<YourEntityRequests title="Features Requests" requests={featuresSuggested} type="suggestions" />
60-
</div>
61-
<div className="flex flex-col gap-3 sticky md:h-80 w-full md:w-72 lg:w-96 ">
62-
<AwardBySupporting/>
47+
const handleSuggest = async (
48+
data: FeatureSuggestCreate,
49+
timezone: string
50+
) => {
51+
"use server";
52+
const resp = await suggestFeature(data, timezone);
53+
return resp;
54+
};
6355

64-
65-
66-
</div>
67-
</main>
68-
</div>
69-
);
56+
return (
57+
<div className='flex flex-col min-h-screen bg-gray-50 dark:bg-gradient-to-br dark:from-gray-900 dark:via-gray-900 dark:to-gray-950'>
58+
<SuggestFeaturesHeader />
59+
<main className='flex-grow relative flex flex-col-reverse md:flex-row gap-5 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-4'>
60+
<div className='md:max-w-3xl mx-auto w-full flex-1 flex flex-col gap-5'>
61+
<FeatureRequestForm handleSuggest={handleSuggest} />
62+
<YourEntityRequests
63+
title='Features Requests'
64+
requests={featuresSuggested}
65+
type='suggestions'
66+
/>
67+
</div>
68+
<div className='flex flex-col gap-3 sticky md:h-80 w-full md:w-72 lg:w-96 '>
69+
<AwardBySupporting />
70+
</div>
71+
</main>
72+
</div>
73+
);
7074
};
7175

7276
export default SuggestFeatures;

components/accordion/calendar-accordion.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { useLocale, useTranslations } from "next-intl";
77
import { Button } from "../ui/button";
88
import { Calendar as CalendarComponent } from "@/components/ui/calendar";
99
import { CalendarIcon } from "lucide-react";
10+
import { PRIMARY_COLOR } from "@/lib/colors";
1011
import React from "react";
1112
import { cn } from "@/lib/utils";
1213
import { format } from "date-fns";
1314
import { formatDateLocalized } from "@/utils/date";
14-
import { useTheme } from "@/contexts/ThemeContext";
15+
import { useTheme } from "next-themes";
1516

1617
const CalendarAccordion = ({
1718
date,
@@ -22,7 +23,7 @@ const CalendarAccordion = ({
2223
}) => {
2324
const t = useTranslations("datePicker");
2425
const locale = useLocale();
25-
const { theme } = useTheme();
26+
const theme = useTheme().theme;
2627
return (
2728
<div className='w-full'>
2829
<Button
@@ -56,11 +57,11 @@ const CalendarAccordion = ({
5657
classNames={{
5758
day_selected: cn(
5859
"",
59-
`bg-${theme.primary}-500 text-white hover:bg-${theme.primary}-500 hover:text-${theme.primary}-50 focus:bg-${theme.primary}-500 focus:text-${theme.primary}-50`
60+
`bg-${PRIMARY_COLOR[theme]}-500 text-white hover:bg-${PRIMARY_COLOR[theme]}-500 hover:text-${PRIMARY_COLOR[theme]}-50 focus:bg-${PRIMARY_COLOR[theme]}-500 focus:text-${PRIMARY_COLOR[theme]}-50`
6061
),
6162
day_today: cn(
6263
"",
63-
`bg-${theme.primary}-100 text-${theme.primary}-900`
64+
`bg-${PRIMARY_COLOR[theme]}-100 text-${PRIMARY_COLOR[theme]}-900`
6465
),
6566
}}
6667
mode='single'

components/award-by-reporting-bugs.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
"use client";
2+
13
import { Award } from 'lucide-react'
24
import React from 'react'
5+
import { useTranslations } from 'next-intl'
36

47
const AwardByReportingBugs = () => {
8+
const t = useTranslations("reportBugs.award");
59
return (
610
<div>
711
<div className=" p-5 bg-gradient-to-r from-amber-50 to-yellow-50 rounded-xl border border-amber-100">
812
<div className="flex items-start gap-3">
913
<Award className="h-6 w-6 text-amber-500 mt-0.5 flex-shrink-0" />
1014
<div>
11-
<p className="text-sm font-medium text-gray-800">Get recognized for your contributions</p>
15+
<p className="text-sm font-medium text-gray-800">{t("title")}</p>
1216
<p className="text-sm text-gray-600 mt-1">
13-
Users who submit bug reports that lead to implemented fixes will receive special recognition badges on
14-
their profile. Your contributions help make our product better for everyone.
17+
{t("description")}
1518
</p>
1619
<div className="flex items-center gap-2 mt-3">
1720
<div className="flex -space-x-2">
@@ -25,7 +28,7 @@ const AwardByReportingBugs = () => {
2528
🏆
2629
</div>
2730
</div>
28-
<span className="text-xs text-gray-500">Earn badges like these</span>
31+
<span className="text-xs text-gray-500">{t("earnBadges")}</span>
2932
</div>
3033
</div>
3134
</div>

0 commit comments

Comments
 (0)