Skip to content

Commit

Permalink
moved i18n folder to src
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcio2115 committed Sep 26, 2024
1 parent 729e86e commit d5b7c1e
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { useRouter } from "next/navigation";
import type { SupportedLanguages } from "~/i18n/settings";
import ProjectCreateForm from "~/components/create-project/project-create-form";
import { useCreateProjectMutation } from "~/lib/mutations/useCreateProjectMutation";
import type { InsertProject } from "~/lib/validators/project";
Expand All @@ -21,7 +22,7 @@ const defaultValues: InsertProject = {
};

interface CreateProjectPageProps {
params: { name: string };
params: { name: string; lang: SupportedLanguages };
}

export default function CreateProjectPage({ params }: CreateProjectPageProps) {
Expand All @@ -42,6 +43,7 @@ export default function CreateProjectPage({ params }: CreateProjectPageProps) {
mutate={mutate}
isPending={isPending}
defaultValues={defaultValues}
lang={params.lang}
/>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[lang]/dashboard/[name]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type PropsWithChildren } from "react";

import Dashnav from "~/components/dashboard/dashnav";
import Navbar from "~/components/navbar";
import type { SupportedLanguages } from "~/app/i18n/settings";
import type { SupportedLanguages } from "~/i18n/settings";

type DashboardLayoutProps = PropsWithChildren<{
params: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[lang]/dashboard/[name]/overview/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from "next/navigation";
import { Suspense } from "react";
import type { SupportedLanguages } from "~/app/i18n/settings";
import type { SupportedLanguages } from "~/i18n/settings";
import ProjectGrid from "~/components/dashboard/project-grid";
import ProjectsSkeleton from "~/components/dashboard/project-grid-skeleton";
import ProjectPagination from "~/components/dashboard/project-pagination";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
type SubmitHandler,
useForm,
} from "react-hook-form";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

import AlertModal from "~/components/modals/alertModal";
import DialogModal from "~/components/modals/dialogModal";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/[lang]/dashboard/[name]/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { useRouter } from "next/navigation";
import { useState } from "react";
import { type FieldErrors, useForm } from "react-hook-form";
import { Trans } from "react-i18next";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

import AlertModal from "~/components/modals/alertModal";
import { Button } from "~/components/ui/button";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SessionProvider } from "~/providers/session-provider";
import { ThemeProvider } from "~/providers/theme-provider";
import { auth } from "~/server/auth";
import "~/styles/globals.css";
import { LANGUAGES, type SupportedLanguages } from "~/app/i18n/settings";
import { LANGUAGES, type SupportedLanguages } from "~/i18n/settings";

export async function generateStaticParams() {
return LANGUAGES.map((lng) => ({ lng }));
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/[lang]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {

import Navbar from "~/components/navbar";
import PricingPlans from "~/components/pricing-plans";
import { translation } from "~/app/i18n";
import type { SupportedLanguages } from "../i18n/settings";
import { translation } from "~/i18n";
import type { SupportedLanguages } from "../../i18n/settings";

const featureIcons = [GitPullRequestArrow, Lock, RefreshCw, Fingerprint];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,29 @@ import { Checkbox } from "../ui/checkbox";
import { cn } from "~/lib/utils";
import ChannelsSelect from "./channel-select";
import type { UseCreateProjectMutationResult } from "~/lib/mutations/useCreateProjectMutation";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

interface ProjectFormProps {
defaultValues: InsertProject;
mutate: UseCreateProjectMutationResult["mutate"];
isPending?: UseCreateProjectMutationResult["isPending"];
lang: SupportedLanguages;
}

export default function ProjectCreateForm({
mutate,
isPending = false,
defaultValues,
lang,
}: ProjectFormProps) {
const form = useForm<TProjectForm>({
resolver: zodResolver(projectFormSchema),
defaultValues,
});

const { t } = useTranslation(lang, "create-project", {});

const [showMore, setShowMore] = useState(false);

const video = form.watch("video");
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/dashboard/dashnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import Link from "next/link";
import { usePathname } from "next/navigation";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

import { cn } from "~/lib/utils";

Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/dashboard/search-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Button } from "~/components/ui/button";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState, type ChangeEvent } from "react";
import { useDebounce } from "@uidotdev/usehooks";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";
import { useTranslation } from "~/i18n/client";

interface ProjectGridProps {
orgName: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/modals/alertModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
} from "~/components/ui/alert-dialog";

import { Input } from "../ui/input";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

type AlertModalProps = {
isOpen: boolean;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "./ui/dropdown-menu";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";
import { useTranslation } from "~/i18n/client";

interface NavbarProps {
lang: SupportedLanguages;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/organization-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import {
import { Input } from "./ui/input";
import { Skeleton } from "./ui/skeleton";
import { useToast } from "./ui/toaster/use-toast";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";
interface OrganizationSelectProps {
lang: SupportedLanguages;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/pricing-plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
CardHeader,
CardTitle,
} from "./ui/card";
import { useTranslation } from "~/app/i18n/client";
import type { SupportedLanguages } from "~/app/i18n/settings";
import { useTranslation } from "~/i18n/client";
import type { SupportedLanguages } from "~/i18n/settings";

interface PricingPlansProps {
lang: SupportedLanguages;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/web/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { auth } from "./server/auth";
import { NextResponse } from "next/server";
import acceptLanguage from "accept-language";
import { FALLBACK_LANG, LANGUAGES, COOKIE_NAME } from "./app/i18n/settings";
import { FALLBACK_LANG, LANGUAGES, COOKIE_NAME } from "./i18n/settings";

const authedPathsRegex = new RegExp(`^/(${LANGUAGES.join("|")})/dashboard.*`);

Expand Down

0 comments on commit d5b7c1e

Please sign in to comment.