diff --git a/.prettierrc b/.prettierrc
index 0a02bce..1ca0506 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,3 +1,9 @@
{
- "tabWidth": 4
+ "tabWidth": 4,
+ "useTabs": false,
+ "endOfLine": "lf",
+ "trailingComma": "all",
+ "bracketSameLine": false,
+ "printWidth": 120,
+ "bracketSpacing": true
}
diff --git a/app/app.css b/app/app.css
index 724d84f..81294ea 100644
--- a/app/app.css
+++ b/app/app.css
@@ -5,8 +5,8 @@
@theme {
--font-sans:
- "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
- "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
+ "Noto Color Emoji";
}
:root {
@@ -48,16 +48,11 @@
--radius: 0.375rem;
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
- --shadow-sm:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
- --shadow:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
- --shadow-md:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
- --shadow-lg:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
- --shadow-xl:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
+ --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
+ --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
+ --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
+ --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
+ --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
}
@@ -100,16 +95,11 @@
--radius: 0.375rem;
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
- --shadow-sm:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
- --shadow:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
- --shadow-md:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
- --shadow-lg:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
- --shadow-xl:
- 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
+ --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
+ --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
+ --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
+ --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
+ --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
}
diff --git a/app/components/app-layout.tsx b/app/components/app-layout.tsx
index bc44d4b..7dcb8ba 100644
--- a/app/components/app-layout.tsx
+++ b/app/components/app-layout.tsx
@@ -14,9 +14,7 @@ interface AppLayoutProps {
}
export default function AppLayout({ children }: AppLayoutProps) {
- let servers = Object.values(
- useServerListStore(useShallow((state) => state.servers)),
- );
+ let servers = Object.values(useServerListStore(useShallow((state) => state.servers)));
const matches = useMatches();
@@ -58,9 +56,7 @@ export default function AppLayout({ children }: AppLayoutProps) {
-
- {list}
-
+ {list}
diff --git a/app/components/channel-area.tsx b/app/components/channel-area.tsx
index a584906..991b876 100644
--- a/app/components/channel-area.tsx
+++ b/app/components/channel-area.tsx
@@ -1,7 +1,4 @@
-import {
- useInfiniteQuery,
- type QueryFunctionContext,
-} from "@tanstack/react-query";
+import { useInfiniteQuery, type QueryFunctionContext } from "@tanstack/react-query";
import type { Channel, Message, MessageId } from "~/lib/api/types";
import ChatMessage from "./chat-message";
import MessageBox from "./message-box";
@@ -17,33 +14,18 @@ export default function ChannelArea({ channel }: ChannelAreaProps) {
const fetchMessages = async ({ pageParam }: QueryFunctionContext) => {
return await import("~/lib/api/client/channel").then((m) =>
- m.default.paginatedMessages(
- channelId,
- 50,
- pageParam as MessageId | undefined,
- ),
+ m.default.paginatedMessages(channelId, 50, pageParam as MessageId | undefined),
);
};
- const {
- data,
- error,
- fetchNextPage,
- hasNextPage,
- isFetching,
- isFetchingNextPage,
- isPending,
- status,
- } = useInfiniteQuery({
- queryKey: ["messages", channelId],
- initialPageParam: undefined,
- queryFn: fetchMessages,
- getNextPageParam: (lastPage) =>
- lastPage.length < 50
- ? undefined
- : lastPage[lastPage.length - 1]?.id,
- staleTime: Infinity,
- });
+ const { data, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage, isPending, status } =
+ useInfiniteQuery({
+ queryKey: ["messages", channelId],
+ initialPageParam: undefined,
+ queryFn: fetchMessages,
+ getNextPageParam: (lastPage) => (lastPage.length < 50 ? undefined : lastPage[lastPage.length - 1]?.id),
+ staleTime: Infinity,
+ });
const fetchNextPageVisible = () => {
if (!isFetchingNextPage && hasNextPage) fetchNextPage();
@@ -63,10 +45,7 @@ export default function ChannelArea({ channel }: ChannelAreaProps) {
{status === "success" && renderMessages(data.pages)}
-
+
>
);
@@ -75,12 +54,8 @@ export default function ChannelArea({ channel }: ChannelAreaProps) {
return (
<>
-
- {channel?.name}
-
-
- {messageArea}
-
+
{channel?.name}
+
{messageArea}
@@ -95,22 +70,13 @@ function renderMessages(pages: Message[][]) {
const formatMessageDate = (date: Date) => {
const now = new Date();
- const today = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- );
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const yesterday = new Date(today);
yesterday.setDate(yesterday.getDate() - 1);
- const messageDate = new Date(
- date.getFullYear(),
- date.getMonth(),
- date.getDate(),
- );
+ const messageDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- const capitalize = (str: string) =>
- str.charAt(0).toUpperCase() + str.slice(1);
+ const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
if (messageDate.getTime() === today.getTime()) {
const rtf = new Intl.RelativeTimeFormat(undefined, {
diff --git a/app/components/chat-message-attachment.tsx b/app/components/chat-message-attachment.tsx
index 3896abe..ed751b2 100644
--- a/app/components/chat-message-attachment.tsx
+++ b/app/components/chat-message-attachment.tsx
@@ -10,12 +10,7 @@ import {
DialogTitle,
DialogTrigger,
} from "~/components/ui/dialog"; // Shadcn UI Dialog
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "~/components/ui/tooltip"; // Shadcn UI Tooltip
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "~/components/ui/tooltip"; // Shadcn UI Tooltip
import type { UploadedFile } from "~/lib/api/types"; // Adjust path as needed
import { formatFileSize } from "~/lib/utils"; // Adjust path
import { FileIcon } from "./file-icon";
@@ -24,9 +19,7 @@ interface ChatMessageAttachmentProps {
file: UploadedFile;
}
-export default function ChatMessageAttachment({
- file,
-}: ChatMessageAttachmentProps) {
+export default function ChatMessageAttachment({ file }: ChatMessageAttachmentProps) {
if (file.contentType.startsWith("image/")) {
return
;
}
@@ -38,29 +31,17 @@ function GenericFileAttachment({ file }: ChatMessageAttachmentProps) {
-
+
-
- {file.filename}
-
-
- {formatFileSize(file.size)}
-
+
{file.filename}
+
{formatFileSize(file.size)}