fix loads of errors, make messages have the actual username added to

them aswell xd
This commit is contained in:
Soph :3 2026-01-05 07:59:23 +02:00
parent bf679f9ee0
commit 424fe4cf42
6 changed files with 157 additions and 76 deletions

View file

@ -14,13 +14,18 @@
import Button, { buttonVariants } from './ui/button/button.svelte';
import User from './extra/User.svelte';
import type { SessionValidationResult } from '$lib/server/auth';
import type { OverviewData } from '$lib';
let {
currentPage = $bindable<string | null>(),
data,
user,
...restProps
}: { currentPage: string | null; data: Data; user: SessionValidationResult['user'] } = $props();
}: {
currentPage: string | null;
data: OverviewData;
user: SessionValidationResult['user'];
} = $props();
</script>
<Sidebar.Root {...restProps}>
@ -48,7 +53,7 @@
</Button>
</Dialog.Trigger>
<Dialog.Content class="sm:max-w-[425px]">
<Dialog.Content class="sm:max-w-106.25">
<Dialog.Header>
<Dialog.Title>Add a friend</Dialog.Title>
<Dialog.Description>
@ -132,7 +137,7 @@
</Button>
</Dialog.Trigger>
<Dialog.Content class="sm:max-w-[425px]">
<Dialog.Content class="sm:max-w-106.25">
<form method="POST" action="?/createGroup">
<Dialog.Header>
<Dialog.Title>Create a group</Dialog.Title>
@ -161,7 +166,7 @@
</Button>
</Dialog.Trigger>
<Dialog.Content class="sm:max-w-[425px]">
<Dialog.Content class="sm:max-w-106.25">
<form method="POST" action="?/joinServer">
<Dialog.Header>
<Dialog.Title>Join a server</Dialog.Title>
@ -185,7 +190,7 @@
</Button>
</Dialog.Trigger>
<Dialog.Content class="sm:max-w-[425px]">
<Dialog.Content class="sm:max-w-106.25">
<form method="POST" action="?/createServer">
<Dialog.Header>
<Dialog.Title>Create a server</Dialog.Title>

View file

@ -23,6 +23,19 @@ export type OverviewUser = {
image: string;
dmId?: string;
};
export interface Message {
id: string;
authorId: string;
content: string;
timestamp: number;
}
export interface ReturnMessage extends Message {
author: {
id: string;
name: string;
};
}
export type OverviewServer = {
id: string;

View file

@ -84,6 +84,7 @@ export const invite = sqliteTable('invite', {
.references(() => server.id),
code: text('code').notNull()
});
export type Session = typeof session.$inferSelect;
export type User = typeof user.$inferSelect;
export type Group = typeof group.$inferSelect;

View file

@ -5,7 +5,7 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function formatTimestamp(dateString: string) {
export function formatTimestamp(dateString: string | number | Date) {
const date = new Date(dateString);
const now = new Date();