(
+ ({ className, date }, ref) => {
+ const locale = useLocale();
+ const currentTime = convertUnixTime(date);
+
+ const relative = Math.floor(
+ (new Date().getTime() - currentTime.getTime()) / 1000
+ );
+
+ const getDateFormat = (dateFormat: string) => {
+ return format(currentTime, dateFormat, {
+ locale: locale === "pl" ? pl : enUS
+ });
+ };
+
+ const fullDate = getDateFormat("P p");
+
+ const getDateWithFormatDistance = () => {
+ // When date is < 1 day
+ if (relative < 86400) {
+ return formatDistance(currentTime, new Date(), {
+ addSuffix: true,
+ locale: locale === "pl" ? pl : enUS
+ });
+ }
+
+ // When date is < 7 days
+ if (relative < 604800) {
+ return getDateFormat(locale === "pl" ? "EEEE, H:mm" : "EEEE, H:mm a");
+ }
+
+ // When date is < 1 year
+ return getDateFormat(locale === "pl" ? "d MMMM, H:mm" : "MMMM d, H:mm a");
+ };
+
+ if (currentTime.getFullYear() == new Date().getFullYear()) {
+ return (
+
+
+
+
+ {getDateWithFormatDistance()}
+
+
+
+ {fullDate}
+
+
+
+ );
+ }
+
+ return (
+
+ {fullDate}
+
+ );
+ }
+);
+
+DateFormat.displayName = "DateFormat";
diff --git a/frontend/components/date-format/date-format.tsx b/frontend/components/date-format/date-format.tsx
deleted file mode 100644
index c4e67c558..000000000
--- a/frontend/components/date-format/date-format.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { useLocale } from "next-intl";
-import { enUS, pl } from "date-fns/locale";
-import { format, formatDistance } from "date-fns";
-
-import { convertUnixTime } from "@/functions/date";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger
-} from "../ui/tooltip";
-
-interface Props {
- date: number;
- className?: string;
-}
-
-export const DateFormat = ({ className, date }: Props) => {
- const locale = useLocale();
- const currentTime = convertUnixTime(date);
-
- const relative = Math.floor(
- (new Date().getTime() - currentTime.getTime()) / 1000
- );
-
- const getDateFormat = (dateFormat: string) => {
- return format(currentTime, dateFormat, {
- locale: locale === "pl" ? pl : enUS
- });
- };
-
- const fullDate = getDateFormat("P p");
-
- const getDateWithFormatDistance = () => {
- // When date is < 1 day
- if (relative < 86400) {
- return formatDistance(currentTime, new Date(), {
- addSuffix: true,
- locale: locale === "pl" ? pl : enUS
- });
- }
-
- // When date is < 7 days
- if (relative < 604800) {
- return getDateFormat(locale === "pl" ? "EEEE, H:mm" : "EEEE, H:mm a");
- }
-
- // When date is < 1 year
- return getDateFormat(locale === "pl" ? "d MMMM, H:mm" : "MMMM d, H:mm a");
- };
-
- if (currentTime.getFullYear() == new Date().getFullYear()) {
- return (
-
-
-
- {getDateWithFormatDistance()}
-
-
- {fullDate}
-
-
-
- );
- }
-
- return {fullDate};
-};
diff --git a/frontend/components/editor/plugins/code/container-code-action-menu.tsx b/frontend/components/editor/plugins/code/container-code-action-menu.tsx
index c6943d5ba..5f1616259 100644
--- a/frontend/components/editor/plugins/code/container-code-action-menu.tsx
+++ b/frontend/components/editor/plugins/code/container-code-action-menu.tsx
@@ -16,7 +16,7 @@ import {
type PrettierFormatError
} from "./prettier/prettier-button-code-action";
import { AlertDialog, AlertDialogContent } from "@/components/ui/alert-dialog";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { CopyButtonCodeAction } from "./copy/copy-button-code-action";
const PrettierAlertDialog = lazy(() =>
diff --git a/frontend/components/editor/toolbar/buttons/emoji/emoji-button.tsx b/frontend/components/editor/toolbar/buttons/emoji/emoji-button.tsx
index 6d06e973a..fbb6fac3a 100644
--- a/frontend/components/editor/toolbar/buttons/emoji/emoji-button.tsx
+++ b/frontend/components/editor/toolbar/buttons/emoji/emoji-button.tsx
@@ -8,7 +8,7 @@ import {
PopoverTrigger
} from "@/components/ui/popover";
import { Button } from "@/components/ui/button";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
const ContentEmojiButtonEditor = lazy(() =>
import("./content").then(module => ({
diff --git a/frontend/components/groups/input/content/content.tsx b/frontend/components/groups/input/content/content.tsx
index bc6c4d13b..feab232b6 100644
--- a/frontend/components/groups/input/content/content.tsx
+++ b/frontend/components/groups/input/content/content.tsx
@@ -5,7 +5,7 @@ import { useQuery } from "@tanstack/react-query";
import { useDebouncedCallback } from "use-debounce";
import { cn } from "@/functions/classnames";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { Input } from "@/components/ui/input";
import {
Command,
diff --git a/frontend/components/groups/input/group-input.tsx b/frontend/components/groups/input/group-input.tsx
index 92fd91262..c9554a8a7 100644
--- a/frontend/components/groups/input/group-input.tsx
+++ b/frontend/components/groups/input/group-input.tsx
@@ -9,7 +9,7 @@ import type { TextLanguage } from "../../../graphql/hooks";
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover";
import { Button } from "../../ui/button";
import { Badge } from "../../ui/badge";
-import { Loader } from "../../loader/loader";
+import { Loader } from "../../loader";
import { useTextLang } from "../../../hooks/core/use-text-lang";
export interface GroupInputItem {
diff --git a/frontend/components/header-content/header-content.tsx b/frontend/components/header-content/header-content.tsx
index ded7a990a..0589ad2db 100644
--- a/frontend/components/header-content/header-content.tsx
+++ b/frontend/components/header-content/header-content.tsx
@@ -1,4 +1,5 @@
import type { ReactNode } from "react";
+import { forwardRef } from "react";
import { cn } from "@/functions/classnames";
@@ -18,15 +19,13 @@ interface HeaderContentH2Props extends HeaderContentProps {
h1?: never;
}
-export const HeaderContent = ({
- children,
- className,
- desc,
- h1,
- h2
-}: HeaderContentH1Props | HeaderContentH2Props) => {
+export const HeaderContent = forwardRef<
+ HTMLDivElement,
+ HeaderContentH1Props | HeaderContentH2Props
+>(({ children, className, desc, h1, h2 }, ref) => {
return (
);
-};
+});
+
+HeaderContent.displayName = "HeaderContent";
diff --git a/frontend/components/icon/icon.tsx b/frontend/components/icon/icon.tsx
index 3988ea7cd..e4816266a 100644
--- a/frontend/components/icon/icon.tsx
+++ b/frontend/components/icon/icon.tsx
@@ -21,15 +21,6 @@ export const Icon = memo(({ className, name, ...props }: Props) => {
.then(mod => ({ default: mod }))
);
- // const LucideIcon = dynamic(
- // () => import(`lucide-react`).then(mod => mod[name]),
- // {
- // loading: () => {
- // return ;
- // }
- // }
- // );
-
return (
}>
diff --git a/frontend/components/icon/input/content/content.tsx b/frontend/components/icon/input/content/content.tsx
index 99fdd0b29..79ea84f21 100644
--- a/frontend/components/icon/input/content/content.tsx
+++ b/frontend/components/icon/input/content/content.tsx
@@ -7,7 +7,7 @@ import { TabsTrigger } from "@/components/tabs/tabs-trigger";
import { Input } from "@/components/ui/input";
import { SkinSelectEmojiButtonEditor } from "@/components/editor/toolbar/buttons/emoji/skin-select";
import { CONFIG } from "@/config";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
const EmojisContentIconInput = lazy(() =>
import("./emojis/emojis").then(module => ({
diff --git a/frontend/components/icon/input/icon-input.tsx b/frontend/components/icon/input/icon-input.tsx
index a679c1371..bea9ab95b 100644
--- a/frontend/components/icon/input/icon-input.tsx
+++ b/frontend/components/icon/input/icon-input.tsx
@@ -12,7 +12,7 @@ import {
PopoverTrigger
} from "@/components/ui/popover";
import { cn } from "@/functions/classnames";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import type { IconInputProps } from "./content/content";
const Content = lazy(() =>
diff --git a/frontend/components/loader/loader.tsx b/frontend/components/loader.tsx
similarity index 100%
rename from frontend/components/loader/loader.tsx
rename to frontend/components/loader.tsx
diff --git a/frontend/components/ui/button.tsx b/frontend/components/ui/button.tsx
index 32d2d38bd..188dce531 100644
--- a/frontend/components/ui/button.tsx
+++ b/frontend/components/ui/button.tsx
@@ -4,7 +4,7 @@ import { forwardRef, type ButtonHTMLAttributes } from "react";
import { useTranslations } from "next-intl";
import { cn } from "@/functions/classnames";
-import { Loader } from "../loader/loader";
+import { Loader } from "../loader";
import { TooltipPortalButton } from "./button-tooltip-portal";
import { Tooltip, TooltipProvider, TooltipTrigger } from "./tooltip";
diff --git a/frontend/components/ui/dropdown-menu.tsx b/frontend/components/ui/dropdown-menu.tsx
index 844f7056c..f3eec4f0f 100644
--- a/frontend/components/ui/dropdown-menu.tsx
+++ b/frontend/components/ui/dropdown-menu.tsx
@@ -11,7 +11,7 @@ import {
import { useTranslations } from "next-intl";
import { cn } from "@/functions/classnames";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
const DropdownMenu = DropdownMenuPrimitive.Root;
diff --git a/frontend/components/user/inputs/content/content.tsx b/frontend/components/user/inputs/content/content.tsx
index c7669d4bf..7541a0117 100644
--- a/frontend/components/user/inputs/content/content.tsx
+++ b/frontend/components/user/inputs/content/content.tsx
@@ -7,7 +7,7 @@ import { useDebouncedCallback } from "use-debounce";
import { cn } from "@/functions/classnames";
import { UserInputContentList } from "./list";
import type { UserInputItem } from "../user-input";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { Input } from "@/components/ui/input";
import {
Command,
diff --git a/frontend/components/user/inputs/user-input.tsx b/frontend/components/user/inputs/user-input.tsx
index c0dd066b7..380d09f10 100644
--- a/frontend/components/user/inputs/user-input.tsx
+++ b/frontend/components/user/inputs/user-input.tsx
@@ -9,7 +9,7 @@ import {
PopoverContent,
PopoverTrigger
} from "@/components/ui/popover";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { Badge } from "@/components/ui/badge";
const UserInputContent = lazy(() =>
diff --git a/frontend/themes/1/core/views/global/loading/loading-view.tsx b/frontend/themes/1/core/views/global/loading/loading-view.tsx
index 21ef427d7..5f6330097 100644
--- a/frontend/themes/1/core/views/global/loading/loading-view.tsx
+++ b/frontend/themes/1/core/views/global/loading/loading-view.tsx
@@ -1,7 +1,7 @@
import { useTranslations } from "next-intl";
import { Card, CardHeader } from "@/components/ui/card";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { cn } from "@/functions/classnames";
interface Props {
diff --git a/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/change-avatar.tsx b/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/change-avatar.tsx
index 71d6f04ba..2aa0ccc67 100644
--- a/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/change-avatar.tsx
+++ b/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/change-avatar.tsx
@@ -11,7 +11,7 @@ import {
TooltipTrigger
} from "@/components/ui/tooltip";
import { Button } from "@/components/ui/button";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { useSession } from "@/hooks/core/use-session";
const ModalChangeAvatar = lazy(() =>
diff --git a/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/modal/modal-change-avatar.tsx b/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/modal/modal-change-avatar.tsx
index 9e2aa3fb3..90bb5e5b4 100644
--- a/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/modal/modal-change-avatar.tsx
+++ b/frontend/themes/1/core/views/settings/views/overview/header/change-avatar/modal/modal-change-avatar.tsx
@@ -12,7 +12,7 @@ import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
import { Form, FormField } from "@/components/ui/form";
import { FilesInput } from "@/components/ui/files/files-input";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { useModalChangeAvatar } from "@/hooks/core/settings/avatar/use-modal-change-avatar";
import { useSession } from "@/hooks/core/use-session";
diff --git a/frontend/themes/1/forum/views/forum/forums/views/[id]/actions/actions.tsx b/frontend/themes/1/forum/views/forum/forums/views/[id]/actions/actions.tsx
index 1825c42be..5ddca56ea 100644
--- a/frontend/themes/1/forum/views/forum/forums/views/[id]/actions/actions.tsx
+++ b/frontend/themes/1/forum/views/forum/forums/views/[id]/actions/actions.tsx
@@ -7,7 +7,7 @@ import { useParams } from "next/navigation";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
import { getIdFormString } from "@/functions/url";
import type { PermissionsForumForumsCount } from "@/graphql/hooks";
diff --git a/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/item.tsx b/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/item.tsx
index c836642fb..2924a53e0 100644
--- a/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/item.tsx
+++ b/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/item.tsx
@@ -1,6 +1,6 @@
import { useTranslations } from "next-intl";
-import { DateFormat } from "@/components/date-format/date-format";
+import { DateFormat } from "@/components/date-format";
import type { ShowTopicsForums } from "@/graphql/hooks";
import { useTextLang } from "@/hooks/core/use-text-lang";
import { Link } from "@/i18n";
diff --git a/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/topics-list.tsx b/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/topics-list.tsx
index 017bd6b30..c671fcc4d 100644
--- a/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/topics-list.tsx
+++ b/frontend/themes/1/forum/views/forum/forums/views/[id]/topics-list/topics-list.tsx
@@ -5,7 +5,7 @@ import { Virtuoso } from "react-virtuoso";
import { type ShowTopicsForumsObj } from "@/graphql/hooks";
import { ItemTopicListForum } from "./item";
import { useTopicsList } from "@/hooks/forums/forum/use-topics-list";
-import { Loader } from "@/components/loader/loader";
+import { Loader } from "@/components/loader";
interface Props {
initData: ShowTopicsForumsObj;
diff --git a/frontend/themes/1/forum/views/forum/topic/posts/meta-tags/meta-tag.tsx b/frontend/themes/1/forum/views/forum/topic/posts/meta-tags/meta-tag.tsx
index 73c8b060e..b925ff16e 100644
--- a/frontend/themes/1/forum/views/forum/topic/posts/meta-tags/meta-tag.tsx
+++ b/frontend/themes/1/forum/views/forum/topic/posts/meta-tags/meta-tag.tsx
@@ -1,7 +1,7 @@
import { Lock, Tag, Unlock, type LucideIcon } from "lucide-react";
import { useTranslations } from "next-intl";
-import { DateFormat } from "@/components/date-format/date-format";
+import { DateFormat } from "@/components/date-format";
import type { ShowPostsForumsMetaTags } from "@/graphql/hooks";
import { cn } from "@/functions/classnames";
import { UserLink } from "@/components/user/link/user-link";
diff --git a/frontend/themes/1/forum/views/forum/topic/posts/post/post.tsx b/frontend/themes/1/forum/views/forum/topic/posts/post/post.tsx
index 2b999c8c7..79bf53e81 100644
--- a/frontend/themes/1/forum/views/forum/topic/posts/post/post.tsx
+++ b/frontend/themes/1/forum/views/forum/topic/posts/post/post.tsx
@@ -2,7 +2,7 @@ import { useTranslations } from "next-intl";
import { AvatarUser } from "@/components/user/avatar/avatar-user";
import { UserLink } from "@/components/user/link/user-link";
-import { DateFormat } from "@/components/date-format/date-format";
+import { DateFormat } from "@/components/date-format";
import { GroupFormat } from "@/components/groups/group-format";
import { ReadOnlyEditor } from "@/components/editor/read-only/read-only-editor";
import type { TextLanguage, User } from "@/graphql/hooks";