Big Updated, added some tests, added comments for all functions, I forgot the rest

This commit is contained in:
Alois 2026-03-15 14:52:09 +01:00
commit 90a1059cc8
59 changed files with 1816 additions and 203 deletions

View file

@ -1,5 +1,10 @@
import type { Community } from "@tensamin/shared/features/conversation/schema";
/**
* Executes CommunityModal.
* @param props Parameter props.
* @returns unknown.
*/
export default function CommunityModal(props: { community: Community }) {
return <div>{props.community.community_title}</div>;
}

View file

@ -1,4 +1,4 @@
import Basic from "@/components/modals/basic";
import { Basic, Loading } from "@/components/modals/basic";
import Wrapper from "@tensamin/user/wrapper";
import {
ContextMenu,
@ -8,22 +8,52 @@ import {
ContextMenuTrigger,
} from "@tensamin/ui/cmp/context-menu";
import { useNavigate } from "@tanstack/react-router";
import { type User } from "@tensamin/user/context";
/**
* Renders the conversation modal user preview card.
* @param user Loaded user data.
* @returns Conversation preview card JSX.
*/
function renderConversationUser(user: User) {
return <Basic user={user} />;
}
/**
* Renders the conversation modal user preview card skeleton while loading user data.
* @returns Conversation preview card skeleton JSX.
*/
function renderConversationUserLoading() {
return <Loading />;
}
/**
* Renders a conversation context-menu entry for a specific user.
* @param props Component props with selected user id.
* @returns Conversation modal trigger and menu JSX.
*/
export default function ConversationModal(props: { userId: number }) {
const navigate = useNavigate();
/**
* Navigates to the selected conversation in chat view.
* @returns Void.
*/
const onConversationClick = () => {
void navigate({ to: "/chat", search: { id: props.userId } });
};
return (
<ContextMenu>
<ContextMenuTrigger>
<div
className="select-none cursor-pointer"
onClick={() => {
void navigate({ to: "/chat", search: { id: props.userId } });
}}
onClick={onConversationClick}
>
<Wrapper
loading={renderConversationUserLoading()}
userId={props.userId}
component={(user) => <Basic user={user} />}
component={renderConversationUser}
/>
</div>
</ContextMenuTrigger>