Skip to content

Commit

Permalink
fix: Remove animations, since they stopped working
Browse files Browse the repository at this point in the history
  • Loading branch information
y9san9 committed Jan 1, 2025
1 parent 24680dd commit 05c872a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {motion} from "framer-motion";
import {useEffect, useRef} from "react";
import {Input} from "@/modules/core/components/input.tsx";

Expand All @@ -8,9 +7,7 @@ export interface ChatListTopBarProps {
}

export function ChatListTopBarContent({nickname, setNickname}: ChatListTopBarProps) {
return <motion.div className="absolute left-0 right-0 m-auto" key="nickname" initial={{opacity: 0}} animate={{opacity: 1}}>
<NicknameInput text={nickname} setText={setNickname}/>
</motion.div>;
return <NicknameInput text={nickname} setText={setNickname}/>;
}

function NicknameInput(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ChatListTopBarLogic} from "@/modules/chat-list/logic/top-bar/chat-list-top-bar-logic.ts";
import {ChatListTopBarContent} from "@/modules/chat-list/components/top-bar/chat-list-top-bar-content.tsx";
import {ReactElement, useState} from "react";
import {useState} from "react";
import {useEach} from "@/coroutines/observable.ts";

export function ChatListTopBar({events, getNickname, setNickname}: ChatListTopBarLogic) {
Expand Down
16 changes: 5 additions & 11 deletions src/modules/chat/components/top-bar/chat-top-bar-content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {motion} from "framer-motion";
import {LoadingSpinner} from "@/modules/core/components/loading-spinner.tsx";

export interface ChatTopBarProps {
Expand All @@ -7,21 +6,16 @@ export interface ChatTopBarProps {
}

export function ChatTopBarContent({waiting, title}: ChatTopBarProps) {
if (!waiting) {
return <motion.div className="absolute left-0 right-0" key="loader" exit={{y: -10, opacity: 0}}>
<Updating/>
</motion.div>;
}

return <motion.div className="absolute left-0 right-0" key="loader" exit={{y: -10, opacity: 0}}>
<div className="w-full h-full flex justify-center items-center">
return waiting
? <div className="w-full h-full flex justify-center items-center">
<h4 className="text-2xl font-medium">{title}</h4>
</div>
</motion.div>;
: <Updating/>
}

function Updating() {
return <>
<div className="w-full h-full flex justify-center items-center"><p className="overflow-hidden text-ellipsis">Updating...</p><LoadingSpinner className="size-4"/></div>
<div className="w-full h-full flex justify-center items-center"><p
className="overflow-hidden text-ellipsis">Updating...</p><LoadingSpinner className="size-4"/></div>
</>;
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/modules/core/components/alert-dialog.tsx"
import {Input} from "@/modules/core/components/input.tsx";
AlertDialog, AlertDialogAction, AlertDialogCancel,
AlertDialogContent, AlertDialogDescription, AlertDialogFooter,
AlertDialogHeader, AlertDialogTitle,
AlertDialogTrigger
} from "@/modules/core/components/alert-dialog.tsx";
import {Button} from "@/modules/core/components/button.tsx";
import {Plus} from "lucide-react";
import {Input} from "@/modules/core/components/input.tsx";

export function ImportChat() {
export function NewChat() {
return (
<>
<AlertDialog>
Expand Down
17 changes: 17 additions & 0 deletions src/modules/new-chat/logic/new-chat-logic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {createObservable, Observable} from "@/coroutines/observable.ts";

export type NewChatEvent = {

}

export interface NewChatLogic {
events: Observable<NewChatEvent>;
}

export function createNewChatLogic(): NewChatLogic {
const events: Observable<NewChatEvent> = createObservable();

return {
events
};
}
23 changes: 12 additions & 11 deletions src/modules/top-bar/components/top-bar-content.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {ImportChat} from "@/modules/top-bar/components/import-chat.tsx";
import {motion, AnimatePresence} from "framer-motion";
import {LoadingSpinner} from "@/modules/core/components/loading-spinner.tsx";
import {ReactElement} from "react";
import {Link} from "wouter";
import {X} from "lucide-react";
import {Button} from "@/modules/core/components/button.tsx";
import {NewChat} from "@/modules/new-chat/component/new-chat.tsx";

export interface TopBarProps {
loading: boolean;
Expand All @@ -19,27 +19,28 @@ export function TopBarContent({loading, closeChat, Chat, ChatList}: TopBarProps)
<h1 className="text-2xl font-medium"><Link to="/">Seed</Link></h1>
<div className="flex h-full justify-center items-center flex-1 mx-4 relative">
<AnimatePresence>
{loading ? <Connecting/>
: Chat ? <Chat />
{loading
? <Connecting />
: Chat
? <Chat />
: <ChatList />}
</AnimatePresence>
</div>
</AnimatePresence>
</div>
{Chat
? <>
<div className="hidden md:block"><ImportChat/></div>
<div className="hidden md:block"><NewChat /></div>
<div className="md:hidden"><CloseChat onClick={closeChat}/></div>
</>
: <ImportChat/>
: <NewChat />
}
</div>
)
}

function Connecting() {
return <motion.div className="absolute left-0 right-0" key="loader" exit={{y: -10, opacity: 0}}>
<div className="w-full h-full flex justify-center items-center"><p
className="overflow-hidden text-ellipsis">Connecting...</p><LoadingSpinner className="size-4"/></div>
</motion.div>;
return <div className="w-full h-full flex justify-center items-center"><p
className="overflow-hidden text-ellipsis">Connecting...</p><LoadingSpinner className="size-4"/>
</div>;
}

export type CloseChatProps = {
Expand Down
1 change: 0 additions & 1 deletion src/modules/umbrella/logic/worker-state-handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export function createWorkerStateHandle(
content: sanitizeContent(message.content)
}
});
console.log("ADD MESSAGE!", messages);
await persistence.message.add(messages);
events.emit({ ...event, messages });
break;
Expand Down

0 comments on commit 05c872a

Please sign in to comment.